Package io.sockit.gameserver.bot
This is the core package for the Sockit Game Bot and provides the classes necessary to create bots running on the server side of a multiplayer turn based game. Below are some of the core classes in this package
Bot This class represents a Bot running on the server. It has methods to login the Bot to the Server, enter a game, fetch list of rooms, join a room, etc. Bots are instantiated in the setUpGame() method of the Game class
BotListener Interface for Bot events/callbacks. An instance of this interface should be registered with the bot object to handle async events received from the server
public class TicTacToeBotListener implements BotListener {
{@literal @}Override
public void onLoggedIn(Bot bot) {
bot.getRooms( "Mumbai", RoomType.normal); //fetches room list from Mumbai location
}
{@literal @}Override
public void onGetRooms(Bot bot, String gameName, String location, RoomType roomtype, List<RoomInfo> rooms) {
bot.joinRoom(rooms.get(0).roomId); //joins the first room in the list
}
....
}
Room This class represents a Game Room. An instance of this class is passed to many of the event/callback methods in the BotListener interface
Player This class represents a Player seated in the room for a Bot
-
Interface Summary Interface Description BotEventListener Interface for Bot events/callbacks. -
Class Summary Class Description Bot This class represents a Bot running on the server.BotEventAdapter An abstract adapter class for receiving bot events.ErrorCodes List of Error codes sent by the serverPlayer This class represents a Player seated in the room for a BotRoom This class represents a game room for a Bot.RoomInfo This class represents the key info for each room in the room list -
Enum Summary Enum Description BotTurnDelayType Enumeration of the possible Bot TurnDelay Types.RoomType Enumeration of the possible room types -
Exception Summary Exception Description GamePlayNotInProgressException Exception thrown when GamePlay has not started and Bot invokes playAction() method