Easter Update (#9)

It has been quiet for the last few weeks so I feel like it is time for another short update on the current progress


As many of you know I'm working on hackero in my free time. Unluckily I've had a lot of things to do in my job in the last weeks so I did not have enough time to look into everything that happened on the Discord server.
I've continued working on hackero, however, I did not make the progress I would have made normally. However, a few things changed and were improved:
First of all, Hackero moved to a different provider! Back in 2019, I've deployed hackero on something called Kubernetes. I've selected DigitalOcean at the time which felt like a reasonable choice. However CPUs and Hardware are expensive there, so I've searched for alternatives. Together with Kubernetes, it's hard to find anything that's cheaper, however, technologies improved, and therefore other useful tools were developed. That's why I've finally made the step to change to a different infrastructure. The transition was smooth, and everything works as expected. This allowed me to drop monthly server costs to about a quarter of what it was before. But the most important change for you as players is performance! Since the hardware got better The game can utilize more CPU resources which result in better performance.

However as some of you already pointed out performance is not perfect yet. I know about the problems and this is something I've been working on in the last few weeks. I've analyzed the backend for performance issues and it turned out to be quite problematic. The main problem has to do something with how the backend handles requests. Explaining everything in detail would not fit in this post, however the basic problem is that one socket connection of one player is always bound to one thread which means that when your thread is blocking you are experiencing a delay.

People who know about Node.js development might ask now, why do you not just make code asynchronous and nonblocking, well that's already the case. The main problem is the parsing of filesystems! These can get really big and nested. There are already a lot of optimizations in the code trying to get around this. However, since these entities are touched quite often it's really hard to cache them. and also whenever a filesystem is updated this change must be propagated to other threads and other clients and this is where the problems start and at this point, I'd like to go a little bit into detail:

Clients bound to a single thread

Based on the image above if for example Player 2 edits a file on an NPC that change must be acknowledged by the server. Once it's saved changes must be forwarded to all other players connected to this server. For Player 3 this is not a problem as he is on the same Thread as Player 2 and therefore the updated filesystem can be sent to player 3 and everything is working like charm. For Player 1 however, thins are a little bit more complicated as the changes must be forwarded to a different thread. this happens through serialization of the filesystem through JSON. and this is what blocks the threads. parsing large filesystems can easily take a few seconds and currently, there is no good way to solve this. I've tried different approaches but did not get to a solution. Though, I'm working on an approach that solves a lot of these problems but will take more time.

Since this is a problem with Node.js I've created a similar implementation in Golang which uses the awesome Pararelisation features of the language to distribute work over differen thread even better. this speeds up filesystem requests of small filesystems from around 300ms to less than 1ms and large filesystems do not take more than 30-40ms to process. This makes the loading of filesystems a lot quicker and snappier! It also gives me complete control over how the data is loaded and sent which allows me to do further optimization.

But also to be realistic it will not be possible to just migrate over 15000 lines of code to a different language. thats why I've decided to keep the original backend and only migrate routes with performance issues. therefore loading other routes is not affected but filesystems speed up by the factor 100. In the future more and more gamplay relevant features will be migrated which will hopefully result in a go based backend.

Therefore there are no new gameplay features to showcase right now.

However I've been reading through your feedback and there are a lot of good suggestions which I will add to the todolist.

That is all for now, I'm preparing a bigger update so stay tuned!

If you would like to support my work the best way is to subscribe to my patreon page! I'm putting a lot of work into this and every new Patreon allows me to focus even more on the development of hackero by covering server costs etc.