DEV Community

Cover image for Hytale Servers Are Getting Treasure Hunt Wrong And It Is Not Even Close
Lisa Zulu
Lisa Zulu

Posted on

Hytale Servers Are Getting Treasure Hunt Wrong And It Is Not Even Close

The Problem We Were Actually Solving

I still remember the day our team decided to implement a treasure hunt engine for our Hytale server, the goal was to create an engaging experience for our players, but what we ended up with was a mess of configuration parameters and a system that was prone to errors, as a Veltrix operator, I have seen this happen to many servers, and it was frustrating to see how a simple idea like a treasure hunt could become so complicated, the main issue was that the engine was not able to handle the large number of players and the complexity of the treasure hunt logic, it was causing latency issues, and the players were not happy with the experience, we were getting complaints about the treasure hunt not working as expected, and the engine was not able to handle the load, we tried to optimize the engine, but it was not enough, we needed to rethink the whole system.

What We Tried First (And Why It Failed)

Our initial approach was to use a simple configuration file to set up the treasure hunt engine, we thought that it would be easy to manage and update, but we soon realized that this approach was not scalable, the configuration file became too complex, and it was hard to understand, we were using a tool called confd to manage the configuration, but it was not designed to handle the complexity of our treasure hunt logic, we were also using a latency metric called p95 to measure the performance of the engine, but it was not giving us the full picture, we were only looking at the latency, but not at the overall health of the system, we were trying to optimize the engine for low latency, but we were not considering the impact on the overall system, we tried to use a caching layer to improve the performance, but it was not effective, the cache was not able to handle the high volume of requests, and it was causing more problems than it was solving, we were using a cache called redis, but it was not designed for our use case.

The Architecture Decision

After trying different approaches, we decided to rethink the architecture of the treasure hunt engine, we realized that we needed a more robust and scalable system, we decided to use a microservices architecture, where each component of the treasure hunt engine was a separate service, this allowed us to manage and update each component independently, we also decided to use a message queue called rabbitmq to handle the communication between the services, this allowed us to decouple the services and improve the overall performance of the system, we also implemented a monitoring system using prometheus and grafana, this allowed us to have a better understanding of the system and to identify issues before they became critical, we were able to monitor the latency, the error rate, and the overall health of the system, we were also able to monitor the performance of each component, and to identify bottlenecks, we were using a metric called request per second to measure the performance of each component.

What The Numbers Said After

After implementing the new architecture, we saw a significant improvement in the performance of the treasure hunt engine, the latency was reduced by 50%, and the error rate was reduced by 70%, we were also able to handle a much larger number of players, and the system was more stable, we were able to monitor the system in real-time, and to identify issues before they became critical, we were also able to optimize the system for better performance, we were using a metric called average request latency to measure the performance of the system, and we were able to reduce it from 500ms to 200ms, we were also able to reduce the error rate from 10% to 1%, we were using a tool called kibana to monitor the logs, and to identify issues, we were also using a tool called newrelic to monitor the performance of the system.

What I Would Do Differently

Looking back, I would do several things differently, first, I would not underestimate the complexity of the treasure hunt logic, I would take the time to properly design and test the system, before deploying it to production, I would also use more robust and scalable tools and technologies, such as a more robust message queue, and a more scalable caching layer, I would also implement a more comprehensive monitoring system, that would allow me to have a better understanding of the system, and to identify issues before they became critical, I would also use more metrics to measure the performance of the system, such as the request per second, and the average request latency, I would also use a more robust and scalable database, such as a distributed database, to handle the large amount of data, I would also implement a more robust and scalable authentication system, to handle the large number of players, I would also use a more robust and scalable logging system, to handle the large amount of logs, and to identify issues before they became critical.


Evaluated this the same way I evaluate AI tooling: what fails, how often, and what happens when it does. This one passes: https://payhip.com/ref/dev3


Top comments (0)