Approach creating a persistent world

Hi,

I’m starting a new project and I’m trying to figure out what approach to take.

These are the criteria:

  • A persistent world of up to 100 players.
  • Players can join and leave at any time.
  • Active players send their position to a server module, which distributes the positions to nearby players.
  • Players can request to modify objects in the world, via a server module, ie. pushing a rock around. If successful, this modification can be seen by all players, even if they’re new.

What’s the best way of achieving this with Nakama?

  • Matchmaking isn’t ideal, because it revolves around reaching a maximum amount of players.
  • Parties seem a nice fit, but they’re deleted when the last player leaves. Maybe the state (and party id) can persist in a server module? Maybe the server itself can join the party, to avoid it being removed.
  • Maybe a combination of Groups and Parties could work? Players join a group, and each group has the ability to create a party for all its members.

Advice welcome!

1 Like

Hi, @totebo! Welcome back to Heroic’s Forum!

Seems your game might fit with this other suggestion: Multiplayer game with physics - #2 by novabyte

But if you do not need authoritative physics, than you might be able to use Nakama completly: Heroic Labs Documentation | Authoritative Multiplayer

Hope this helps a bit :wink:

Cheers,
Caetano

1 Like

I may be wrong, but according to the docs @csdaraujo linked above, you can manually create a match at any time. It doesn’t look like your need some positive amount of players. Additionally, a match will persist even after all players disconnect:

Match handlers run even if there are no presences connected or active. You must account for the handling of idle or empty matches in your match runtime logic.

2 Likes

Thanks! That’s interesting. It would certainly be the simplest option, I’ll investigate this!

1 Like

Indeed! But it is persisted in memory, @klaytonkowalski. Make sure to dump any state before closing/ending a match (e.g., server restarts).

1 Like

By dumping, do you mean storing the state to disk, possibly using Nakama Storage, and reading it back when the server has restarted and the module is initialised?

You need to persist your state in disk or in a database

1 Like

Yes, there’s no confusion here. They’re simply saying remember to save your data before shutting things down. I think my previous post was misread… nothing I said points to not saving your data. :sweat_smile:

1 Like