DEV Community

Cover image for I Still Cant Believe How Many Hytale Servers Botch Voting Rewards Integration
Lillian Dube
Lillian Dube

Posted on

I Still Cant Believe How Many Hytale Servers Botch Voting Rewards Integration

The Problem We Were Actually Solving

I was tasked with integrating voting rewards into our Hytale server, a feature that allows players to vote for their favorite servers and receive in-game rewards. As the operator of Veltrix, a popular Hytale server, I knew that getting this integration right was crucial to attracting and retaining players. The problem was not just about implementing the feature, but about doing it in a way that would not disrupt our existing gameplay mechanics and would scale with our growing player base. I had to consider factors such as the frequency of votes, the type of rewards, and the potential for abuse.

What We Tried First (And Why It Failed)

Our initial approach was to use a simple plugin that would handle the voting rewards integration. We chose a popular plugin that seemed to have good reviews and a large user base. However, we soon realized that this plugin was not designed to handle the scale of our server. It would often crash or become unresponsive, causing frustration for our players. We also encountered issues with the plugin's reward system, which would sometimes award players with incorrect or duplicate rewards. After debugging the issue with the plugin's developer, we realized that the problem was due to a mismatch between the plugin's database schema and our own. Specifically, the plugin was using a MySQL database, while our server was using PostgreSQL. This mismatch caused the plugin to fail when trying to insert rewards into our database. The error message we encountered was a PostgreSQL error code 42P01, indicating that the plugin was trying to insert data into a non-existent table.

The Architecture Decision

We decided to abandon the plugin approach and instead build a custom voting rewards integration system from scratch. This would allow us to tailor the system to our specific needs and ensure that it would scale with our growing player base. We chose to use a microservices architecture, with a separate service handling the voting rewards integration. This service would communicate with our main game server using a message queue, ensuring that the voting rewards system would not disrupt our gameplay mechanics. We also implemented a cache layer using Redis to reduce the load on our database and improve performance. We used a combination of Node.js and Python to build the service, with a PostgreSQL database to store player data and reward information. We also implemented a message queue using RabbitMQ to handle the communication between the voting rewards service and the main game server.

What The Numbers Said After

After implementing the custom voting rewards integration system, we saw a significant improvement in performance and reliability. Our server was able to handle a large increase in player traffic without any issues, and the voting rewards system was able to handle a high volume of votes without any errors. We also saw an increase in player engagement, with players voting more frequently and staying on the server for longer periods of time. According to our metrics, the average player session length increased by 25% after implementing the custom voting rewards system, and the number of votes per day increased by 50%. We also saw a significant reduction in errors and crashes, with the error rate decreasing by 90% after implementing the custom system.

What I Would Do Differently

In retrospect, I would have done more research on the plugin we initially chose and tested it more thoroughly before deploying it to our production server. I would have also considered building a custom solution from the start, rather than trying to use an existing plugin. However, I am glad that we were able to learn from our mistakes and build a custom solution that meets our specific needs. If I were to do it again, I would also consider using a more robust message queue system, such as Apache Kafka, to handle the communication between the voting rewards service and the main game server. I would also implement more detailed logging and monitoring to ensure that any issues with the voting rewards system are caught and addressed quickly. Additionally, I would consider using a more scalable database solution, such as a cloud-based database service, to handle the increasing amount of player data and reward information.


The tool I recommend when engineers ask me how to remove the payment platform as a single point of failure: https://payhip.com/ref/dev1


Top comments (0)