Package io.sockit.gameserver
This is the core package for the Sockit Multiplayer Game (Server) Engine and provides the classes necessary to implement the server side of a multiplayer turn based game. The game Logic will reside on the server. Clients will only input events and render the game. To create/develop a game using this library the following 3 custom classes will have to be defined by the developer
Game Room This class will contain the Game Logic. The class should extend the Room class and override the various event/callback methods such as onRoomJoined()
, onSeatTaken()
, beforeGameStarted()
, etc.
Game Player This class will maintain the player state. The class should extend the Player class. An instance of this class represents a single player in a room.
Game This class is responsible for creation of Locations and add Game Room instances to each location. This class should extend the AbstractGame class
Starting the Server The Server class is used to Start and Stop the Game Engine. See example code
Server.setDataStore(new LevelDbStore("./gameDb")); //sets the Database
Server.setLogger(new FileLogger("./serverLog.txt",true)); // Sets the Logger
Server.setWebHandler((new DefaultWebHandler("/webRoot")); //Sets the web handler
Server.registerGame(new TicTacToeGame());
Server.startServerAsHttp(0); //0 will use default port of 80
-
Interface Summary Interface Description CompressibleData This is the super interface for User Data that can be saved in the Server databaseDataIterator An Iterator over entries in a DataStoreDataStore A DataStore is a representation of the Game Database as a Key Value data store.SessionListener Interface for Session event callbacksSessionListenerFactory This interface represents a factory for creating an Session Listeners.WebHandler This interface allows you to implement your own web handler to handle web Requests on the server. -
Class Summary Class Description AbstractBot Super class for Bot class for internal use.DefaultWebHandler A Default Web Handler for web requests.Game An instance of this class represents a New Game.JsonUtil This class contains convenience/utility methods for the java Json processing api.LevelDbStore An implementation of the DataStore interface which uses LevelDB to save/persist the Game Engine data.Location A container for Game rooms.Player This class represents a player in a game room.Room This class is the super class for all Game Rooms.Server This class is used to start and stop the Game Engine.Session Represents a client session - i.e.User This class represents a user who can login to the server.WebResource An instance of this class represents a web resource that will be sent by the server to the web client such as your web browser. -
Enum Summary Enum Description RoomType Enumeration of the possible room types -
Exception Summary Exception Description DuplicateGameNameHashException Exception thrown byregisterGame()
method attempts to register a Game where the hash of the Game's name is equal to the hash of another Game's nameGamePlayInProgressException Exception thrown whenGame.reconfigurePrivateRoom()
is invoked while gamePlay is in progressSeatsNotEmptyException Exception thrown whenGame.reconfigurePrivateRoom()
is invoked with an attempt to change the totalNoOfSeats and the seats are not empty