7 Replies Latest reply on Jul 28, 2010 2:02 PM by gimbal2

    EJB as game server logic

      I want to develop network card game with multiuser infrastructure.
      is there any doubt to use glassfish as game server and EJB as server logic managment ?
      I read many posts over net, but there is no standart one way solution.
      In my mind in EJB server logic will be more easy to write.
        • 1. Re: EJB as game server logic
          Glassfish + EJB could work, although it wouldn't be so easy to keep your clients up to date; they would have to keep polling the EJB to see if there are changes.

          I would look into setting up a simple socket server that can send and receive simple text messages. For example, following this trail to get some more information about the subject:

          • 2. Re: EJB as game server logic
            thanks for replay !

            two Month ago I created update server for my own application and it is not so easy with sockets. :)
            i suppose it will be hard to write server from raw socket :(
            I can create SSL connection to server, but I have no idea about authentication and authentication handling during the client game playing.
            how to support user authentication on every talk to server???
            • 3. Re: EJB as game server logic
              it is not that hard. Start simple with the echo server, and expand from there into sending simple text messages between the server and the client. These text messages can form the basis of your communication protocol, for example you could send messages like ID|MESSAGETYPE|DATA. A login from a client could be a message like:


              The server could send this back if the authorization failed:

              2|AUTHFAILED|Your username or password is invalid.

              And after sending this message to the client, the server closes the connection to the client.

              Create a simple class that can parse and create these type of messages so it is easy to generate them. Then from your client you could send the AUTH message to the server to allow the player to enter a game, and return an AUTHFAILED or AUTHSUCCEED message from the server to let the client known if it is allowed in or not.

              As for managing the user accounts, you could provide a small web application in which users can register or change their details. Then validate the username and password the client sends against a database in the server.
              • 4. Re: EJB as game server logic
                thank you gimbal2 !
                • 5. Re: EJB as game server logic
                  I made an error in my previous explanation; the idea was that the ID of the response that the server sends is the same as the ID that the client sent; this way you can easily match which messages belong together, should you send out multiple at the same time. But that is more advanced stuff, I don't think you will even need that.
                  • 6. Re: EJB as game server logic
                    Hi. Im also trying to develop network card game. I know something about Sockets . Do you think WebServices is good for communication ? I dont know much about it
                    • 7. Re: EJB as game server logic
                      My first answer in this thread is the same one I'd give to you given the information in your post. How are you developing this card game? Client software using Swing? An applet? Is it purely web based?