Hello!
I’m completely new in Nakama and I’m currently creating a Real-time Strategy game (like Travian). To better understand what the context is:
- Gameplay is slow-paced/transactional.
- Building upgrades and troop marches can take minutes or hours to complete.
- Small latency is not a primary concern.
- World state must be persistent and survive server restarts.
I’ve read through the documentation regarding Authoritative Matches but as far as I understood, managing a persistent world map seems risky due to RAM volatility and could result resource-heavy.
I was wondering if this pattern is a good to go, or if there is a better way of doing it:
- All game state (building upgrades, troop marches) are stored in the database.
- Player triggers actions via RPCs (e.g. StartMarch), which saves the start_time and end_time on the database.
- Inside the InitModule, I launch a goroutine wiith a ticker that runs every 1 second, this will query the DB for events where end_time >= now, it then processes the logic (result of the action), and updates the DB accordingly sending a notification/update to players.
Additionally:
- If I plan to have multiple kingdoms (servers/realms), would you recommend spawning a separate Goroutine/ticker for each kingdom ID to process their specific queries in parallel?
- For the ticker query, is it better to use a custom SQL table, or is the Nakama Storage Engine’s Listing feature performant enough for frequent polling?
Thanks in advance!