All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.barrybecker4.game.common.online.package.html Maven / Gradle / Ivy




   
   


This package provides the core classes for online game playing. To play online you need an instance of the OnlineGameServer running on a server. Then when you start an instance of a specific game on a client, it should detect the server and create a ServerConnection to is (using a socket). The client issues GameCommands to the server whenever something happens to change the game state. When the server receives the command, it will update the central game state on the server and broadcast the new state to all the clients. Clients can communicate with each other using the chat window embedded in the client UI.

The architecture works like this. The OnlineGameServer has a ServerCommandProcessor. The ServerCommanProcessor has an OnlineGameTableList and a GameController for keeping track of the universal game state. The GameController has a list of players - all of which are SurrogatePlayers except for the RobotPlayers. The client has a GamePanel of some type which contains a GameController as well. This GameController, however, contains players which are all surrogates except for one- the human player on this client. The server will broadcast all moves (robot or human) so that all the clients are in synch.

    Server
    ---------
    OnlinePokerServer
         ServerCommandProcessor
             OnlineGameTableList
             GameController - has list of players (all of which are surrogate except for the robots).
         ServerSocket
         
   Client
   ---------
    GamePanel
        GameController
              ServerConnection - calls handleServerUpdate on all registered OnlineGameListeners (e.g. controller, Surrogates, GameInfo)
              list of players (all of which are surrogate except for the single human player on this client)
        GameViewer - shows ths current game state
        GameInfo - shows the game stats and chat window.

Current Bugs

When you cancel or close the new game dialog, the player should automatically stand up from whatever table he is at.

Some Ideas for Future Enhancments





© 2015 - 2024 Weber Informatics LLC | Privacy Policy