Dev Update 4

Another week of faffing about with the code. This time I’ve managed to implement something useful: SignalR.

I’ve only added it to the unit production screen for now while I figure out how to get all the bits working together. It uses a connection identifier which is the city ID. When the unit is added to the city a notification is created with a connection ID property linking it to the connection. There is a “notify at” time too, which is the tick at which the unit will be completed.

A service polls the database and retrieves any notifications that are required for the tick, and sends the notifications to any listening clients.

The client connection handler will re-fetch the city build queue and garrison when a unit has been completed. I may end up changing this to be more targeted by removing a unit from the build queue and adding it to the garrison components, as that should reduce server load, but as no one will actually play this game, I might as well sort that out in future if it ever becomes a problem.

Nothing much more to report on for this week. The SignalR stuff took a couple of days to implement, and I’ve not really been feeling up to coding anything due to being ill. But I do think it’s a good start on what will become a major feature of the game: real-time server updates.

back to dev blog

27th January 2024

Chris's Blog


2024-01-27