Radeon Posted May 8, 2011 Share Posted May 8, 2011 Hi its Mike,I am building a snake game again, however this time multi-player. I was thinking client-server would be best option, what do you think? I need to get feedback on the gameplay, userfriendlyness and the UI. Source: http://pastebin.com/Y5EvLe63 NOTE: can be very addictive so dont play when you have any work to do lol. I am currently looking into a design pattern, planning it out using UML of a more OOP design. Pseudo-logic of the client would be: - connect to server - if connection successful, get initial state of game, points, etc - game loop: -- check input, send to server -- receive current game board -- draw the current game board - disconnect/free resources Pseudo-logic of the basic server would be: - initialize network stuff - do nothing until two connections are established -- check inputs -- handle gameplay as usual with the inputs -- send the game board to each connected client -- repeat - close/free resources/start another game/whatever The first message type would be sent from the client to the server. When the message type is "INPUT," you could set the string to something like "arrowUp" and, in the game server, handle it appropriately. The rest would be sent from the server to the game. For "BOARD," you could interpret the string to be something like "0 1 0 3 ...", where each number means either obstacle, empty spot, or whatever else you want. Managing this would be as simple as splitting the string at each space and using a loop to set values in a Map grid/structure. Lastly, POINTSPLAYER and POINTSOPPONENT would set the string to a number which would be the amount of points for the corresponding player/opponent. Ideas? thoughts and opinions? what is the game play like, user friendly? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now