Message Routing - Development Log #415

Michi talks (again) about the current server issues and the challenges that come with the new context system.

Avatar Michi

Michi (molp)

Last week I talked about the performance and stability problems that we are currently trying to address. The good news is, that last week's patch was successful: the memory consumption went down quite a lot. The bad news: That didn't solve the problem of the restarting server nodes. It even seemed to have worsened after the patch.

If we are using less memory for the game's actors, then who is using more, causing these crashes? I once again recorded a heap dump, basically a copy of the memory of a server node, and analyzed it. It seems that an internal task scheduler of a framework that we are using is holding on to actor instances and won't let them go, effectively hindering the garbage collector from doing its job.

I have prepared a patch that will hopefully fix the issue and will deploy it later this week.

I also got some technical work for the politics update done. A few devlogs ago I wrote about how we want to implement a context system that allows players to switch between contexts. For example, players can have one set of screens for the company context where they manage their company and another, different set of screens for a potential government context they are in, say as governor of a planet.

Implementing these contexts means touching a lot of systems that were only ever meant to work with the company context in mind, so of course a lot of things break and need to be made more flexible. I already talked about the screens, but there is more:

In most cases, whenever a message is routed from the server to the connected client, for example a notification or a price change, all connected clients (browsers) of the given player will get a copy, so they can update their state and display the information. With the new contexts this leads to problems: Say we want to book a warehouse fee: if all contexts get that message, the accounting in all clients will process that message. The warehouse fee might origin from the company context, so it should not be allowed to change the accounting in a government context. On the server side this is, and has in fact always been working correctly, but we never had to care about to which clients we send these messages in the past.

The same goes with notifications. We don't want to mark all notifications in all contexts as read when hitting the respective button in one context. We might want to see if another context has new notifications though. I am currently working on that. I hope to be able to show a screenshot of how we imagine this could look like in the next devlog.

As always: we'd love to hear what you think: join us on Discord or the forums!

Happy trading!