Rooms Entity
The rooms entity represents game maps and scenes with tilemap configuration, enabling creation of complete game worlds.
Managing rooms in the admin panel
Rooms are in the Rooms section of the admin sidebar, under Rooms (/reldens-admin/rooms). The same section holds the Change Points and the Return Points that connect the rooms:
To create a room:
- Create the map in Tiled Map Editor and export it as JSON, following the layer name conventions in Create a Room / Map.
- Log in to the admin panel at /reldens-admin and open Rooms > Rooms.
- Click Create New (the form opens at /reldens-admin/rooms/edit).
- Fill in the Name (required and unique, the room identifier used by the game, for example reldens-forest) and the Title (required, the name shown to the players).
- In Map Filename (required) click Choose File and upload the map JSON.
- In Scene Images (required) click Choose Files and select every tileset image used by the map at once: the field accepts multiple files, and each file name must match the image of a tileset in the map JSON.
- Optionally fill in the Room Class Key (custom server room class), the Server Url (room hosted on another game server) and the CustomData JSON.
- Click Save, the room view opens.
- Connect the room with the others: the Link rooms form of the room view creates a change point on this room and a return point on the destination room, both picked on the map with Pick in map (see "Linking Rooms and Picking Tiles in the Map" in the Admin Panel Guide).
- Restart the server, the rooms and their maps are loaded on startup.
In the form, r marks a required field and u a field that must be unique. The default room cannot be deleted, and deleting any other room also deletes its change points and return points, see "Deleting a Room" in the Admin Panel Guide.
Change points and return points
The change points and return points can also be created one by one. A change point moves the player to another room when the player walks into a tile:
- Open Rooms > Change Points and click Create New.
- Select the origin Room ID, fill in the Tile Index of the exit tile (or click Pick in map and click the tile) and select the Next Room ID.
- Click Save.
A return point is the position where the player appears when entering a room:
- Open Rooms > Return Points and click Create New.
- Select the Room ID where the player appears, the Direction the player faces (up, down, left or right) and the X / Y position in pixels.
- Check Is Default for the default entry of the room, or select the From Room ID when the room has one entry per origin room.
- Click Save.
Key Properties
- name: Unique room identifier used in code
- title: Display name for players
- map_filename: Tilemap JSON file (in maps/ directory)
- scene_images: Comma-separated tileset images
- room_class_key: Custom server room class (see Custom room classes below)
- server_url: Game server that hosts the room, empty for the current server (see Multiple game servers below)
- customData: JSON with the room options (see Room options in CustomData below)
Room options in CustomData
The CustomData field of the room form is a JSON object with the options of that room. Every key is optional and the rooms are loaded when the server starts, so restart the server after a change. Some of the sample rooms:
// reldens-forest-level-3
{"enabled":true,"allowGuest":true,"weather":{"clouds":{"alpha":0.37,"quantity":9},"rain":true}}
// reldens-bots-forest
{"allowGuest":true,"joinInRandomPlace":true,"joinInRandomPlaceGuestAlways":true}
Access
- enabled (default true) - with false the server does not load the room: it is not offered in the room selectors and nobody can enter it. The maps importer creates the rooms with false, and the Set default option of the room view sets it to true.
- allowGuest - when the server/players/guestUser/allowOnRooms config is 0, only the rooms with true accept the guest players (a guest walking into a change point to another room stays where it is). With the config at 1 every room accepts guests. See Guest System.
Join position
- joinInRandomPlace - a player that joins the room away from the default return point (more than 50 pixels, for example on the saved position of the last session) is placed on a random walkable tile. A player that joins on the default return point keeps it. The walkable tiles come from the path finder grid, so keep usePathFinder enabled in that room.
- joinInRandomPlaceAlways - with joinInRandomPlace, the registered players are always placed on a random walkable tile, also when they join on the default return point.
- joinInRandomPlaceGuestAlways - the same for the guest players.
Allowed actions
- allActionsDisabled - true ignores every action message the players send in the room (skills, objects interactions and the other features messages), the players can only move.
- disallowedActions - list of blocked actions, each entry can be:
- a message act, for example action for every skill use;
- a skill class name: TypeAttack, TypeEffect, TypePhysicalAttack or TypePhysicalEffect (the classes Reldens uses for the skill types);
- target-pj (any action on a player) or target-obj (any action on an object);
- a target type with an act or a skill class, like target-pj-action or target-obj-TypePhysicalAttack.
- pvpEnabled - false disables the battles between players in the room (see Battle System).
For example, a room where the players can not use attack skills on other players, while the effect skills on players and every skill on the enemies still work:
{"allowGuest":true,"disallowedActions":["target-pj-TypeAttack","target-pj-TypePhysicalAttack"]}
Physics and network
- usePathFinder (default true) - creates the path finder grid of the room, used by the click to move, the objects that chase the players and the random movement.
- patchRate - milliseconds between the room state updates sent to the clients (the Colyseus default is 50).
- The world options (movementSpeed, applyGravity, gravity, jumpSpeed, bulletsStopOnObject, the collision groups and the others) replace the global server/rooms/world config for this room, the complete list is in Collision Configuration.
Visual and admin
- weather - clouds and rain over the room, see Weather Effects.
- mapElementsFile - elements file loaded by the Maps Elements Editor instead of the default [map name]-room-map-elements.json.
Gravity rooms (platformer view)
With "applyGravity":true the room works like a side view platformer: the players fall to the ground, the up key jumps and the down key does nothing, and the click to move is disabled. The sample room reldens-gravity uses:
{"allowGuest":true,"gravity":[0,625],"applyGravity":true,"allowPassWallsFromBelow":true,"timeStep":0.012,"useFixedWorldStep":false,"maxSubSteps":2,"movementSpeed":160,"usePathFinder":false}
- gravity - the world gravity as [x, y].
- jumpSpeed (540) and jumpTimeMs (180) - the jump impulse and how long it lasts.
- allowPassWallsFromBelow - the players can jump through the platforms from below and land on them.
- usePathFinder is disabled because the path finder grid is for top-down movement.
Map layers
The map is a Tiled Map Editor JSON. Reldens reads the layers by name, any layer whose name contains one of these keywords gets the behavior (the details are in the layer name conventions):
- collisions - every non-empty tile is a wall on the server.
- change-points - the tiles where a change point can be placed; the destination of each tile is the Change Points row with its Tile Index.
- respawn-area - the tiles where the respawn objects (enemies, mining rocks) appear.
- below-player and over-player - the layers drawn under or over the players.
The NPCs, enemies and other objects are not placed in the map file: they are rows of Game Objects > Objects with the room, the layer name and the tile index (see Objects Entity).
Multiple game servers
All the game servers of a multi-server setup share the same database, and the Server Url of each room says which one hosts it:
- The server sends the URL of every room to the client (the empty ones get the current server public URL), and when the player enters a room on another server the client connects to that server and joins the room there.
- A server refuses to create a room whose Server Url is not its own server/baseUrl (config server/rooms/validateRoomOnServer, default true).
- When a user logs in on one server, the other servers are asked to disconnect that user (config server/players/disconnectUsersOnServerChange, default true). The requests are signed, so every server must use the same RELDENS_SIGNED_TOKENS_SECRET (see Environment Variables).
Custom room classes
Each room is a Colyseus room created from RoomScene (lib/rooms/server/scene.js). To use your own class, extend RoomScene, register it in the server custom classes under roomsClass and set its key in the room Room Class Key:
// server plugin, on reldens.beforeInitializeManagers
customClasses.roomsClass['my-boss-room'] = MyBossRoom;
The class is read from the server/customClasses/roomsClass/[room class key] config, a room with a key that is not registered is not loaded (the server logs "Custom room class not found").
Database Relations
- objects: Interactive elements in this room
- rooms_change_points: Room transition points
- rooms_return_points: Spawn and return points
Related Documentation
- Create a Room / Map - Tiled map creation, layer name conventions and tile index calculation.
- Room Tileset Override - Replacing the tileset images of a room.
- Objects Entity - The objects placed in the room layers.
- Admin Panel Guide - Deleting rooms, linking rooms and picking tiles in the map.
reldens