Skip to content

ServerConfiguration

Greg edited this page Sep 2, 2013 · 19 revisions

These are passed to cloak.configure() before calling cloak.run() See ServerAPI for more details on running the server.

  • port to run on
  • gameLoopSpeed how frequently do game loop "pulses" happen in ms. default 100
  • defaultRoomSize Maximum number of players in a room. Default null (no maximum) but can be any number 1 or greater. Set to 1 for a single player game.
  • autoJoinLobby default true. Players automatically join the lobby after connecting, when leaving a room, etc.
  • autoCreateRooms default false. create rooms as soon as there are enough users in the lobby to meet the minRoomMembers. When a room is created, players in the lobby are automatically added.
  • minRoomMembers Minimum number of players required for a room to be created. Use with autoCreateRooms. If a room drops below this number of members, all members are kicked and the room is closed.
  • reconnectWait how long the server waits (in milliseconds) for a user to reconnect before deleting them and removing them from any rooms they're in. default 10000. set to null to wait forever
  • reconnectWaitRoomless override reconnectWait for users that are not in a room. default null which means same as reconnectWait Note: this wait time refers to how long they have been disconnected total, not how long since they left a room.
  • roomLife how long in ms a room is open before it automatically closes. set to null for infinite. default null
  • messages
    • custom events to handle messages from client
  • room
    • init callback on new room
    • pulse called periodically for rooms
    • newMember called when a new member joins the room. this is the room, function arg is the user
    • memberLeaves called when a member leaves the room. this is the room, function arg is the user
    • close callback on closing of room
  • lobby
    • has the same events as room (see above) but they only apply to the lobby

Clone this wiki locally