Concepts
Basic architecture
This diagram shows 4 systems. You write code for the web frontend
and the room functions
. We write code for the runner
and client
so you don't have to.
tip
All infrastructure shown is managed, scaled, and operated by UrTurn.
For you, it will feel like your frontend is seamlessly communicating directly with your room functions.
caution
The user is able to control the game frontend. This means critical game logic should always be in your room functions (e.g. validation of user data, handling transition of state, etc.), which is managed by our cloud servers.
Room
- Rooms are instances of games.
- Rooms will have an associated
RoomState
to track the current state of the room. - Players create new rooms whenever they click play on your game. UrTurn will automatically place players together in a room if it is public.
private
rooms are created by players when they clickcreate private room
.- You can handle private rooms differently than public rooms (see roomStartContext) in your room functions.
- For example, you might want players to be able to control various game settings or rules in a private room.
- If a user accidentally closes their browser, they may reopen it to view the room again (exception: see disconnectTimeout)
Game
Each game can have a thumbnail, title, description, and specific code related to it that is run whenever a room is created.
Automatic Disconnect Handling
- When a user is disconnected from a
public
room, the user will be automatically kicked from the room withonPlayerQuit
after30 seconds
. - This does not apply to
private
rooms! Meaning, even if a player disconnects from a private room indefinitely, they will not be forced out of it.