Dynamic Rooms (sovled)

Hi folks; long time reader, first time caller.

I'm going through the docs to learn about Colyseus for a concept I'm considering. In this concept, I'd need to create many, many, many "rooms". Each room would hold a small number of players who could then move between rooms.

Each room would actually provide the same logic, but the data that I pull from the database would be the differentiating factor.

Specifically, each room would represent a "sector" in space, and each sector would have different features: stars, planets, stations, etc.

Using Colyseus, is there a way to "template" a room and spawn an instance onJoin, assigning it an identifier/ID based on the options passed in from the client? Specifically, a room would represent a "sector", and I'd like to have several dozen sectors. As you can imagine, creating several dozen static rooms means duplicating code several dozen times, and any change to one would require a change to all. Instead, I'd like to be able to create a room and instantiate it based on data from a database (If a player wants to enter "sector 112", the server would spin up a sector instance and query the datastore for all info on "sector 112" when building that room).

Thanks!

Hi @Scopique, glad you're considering using it for your next project!

What you described is exactly how Colyseus has been designed to operate! :)

Taking mazmorra.io as an example - it is a "dungeon crawler" type of game. Every dungeon has the same logic behind it, the only difference is their "progress":

Full sources: https://github.com/endel/mazmorra

Hope this helps! Feel free to ask if you happen to have specific questions during development!

Cheers!

@endel Excellent, thank you! I'll check these out.

From what I know about Colyseus and Mazmorra they seem to be the perfect fit: Each dungeon floor in Mazmorra is exactly one room in Colyseus, created and deleted by demand. But as far as I know players in different dungeon floors / rooms do not see each other and do not interact with each other - except within the chat, which is a totally different system.

But what about cross-room-interaction?

Let's assume I want to make a MMORPG with a (logically) twodimensional, persistent game world and hundreds of players. Players have a "sight range", both for gameplay and technical reasons. Players only see each other and can interact with each other inside that sight range. Based on that sight range players could technically be "clustered" in some way - maybe rooms, maybe not, maybe something else. In case they are clustered in rooms, maybe even according to predefined areas of the game world, in the simplest case in quadratic areas, there needs to be some interaction/connection between the rooms, because the player being near the border of such an area need to see the players on the other side of the border, at least up to their sight range.

Are there any "best practices" regarding such a scenario?

Currently I use one single room (of Colyseus) for the whole game world, created at server start and deleted at server shutdown, and never ever a second room. Regarding the state synchronization (of Colyseus) including all player data like position for example I currently think about using the filter functions (of Colyseus). But so far I really doubt that this is a great idea, mostly for performance reasons and because those functions might not be intended for that.

I'd really appreciate some suggestions and pros and cons for this scenario.