- Sep 15, 2005
- 3,622
- 1
- 0
I am working on a game.
I currently have a multi-threaded socket server that can be connected to and communicated with.
I am now getting ready to implement the game logic, but am a little tripped up by how I should compose and arrange my classes.
My main classes are :
Server
->Serves Connections
ServerConnection extends Thread
->receives and sends messages to clients connected to server
MessageBuilder
-> builds messages to be sent back over the ServerConnection to a player
based on game data
GameController
-> controls flow of game
I am wondering if I should change this to make the GameController extend thread instead of the ServerConnection and have ServerConnection be a member of the GameController.
I need 1 instance of the Game Controller per player who connects to the Server. This is not a multi-player game, but a server based single player game (for the time being).
I don't think this idea will work though, because the run method of my ServerConnection object that extends thread is where the messages are received from the client...
Any guidance would be greatly appreciated.
I currently have a multi-threaded socket server that can be connected to and communicated with.
I am now getting ready to implement the game logic, but am a little tripped up by how I should compose and arrange my classes.
My main classes are :
Server
->Serves Connections
ServerConnection extends Thread
->receives and sends messages to clients connected to server
MessageBuilder
-> builds messages to be sent back over the ServerConnection to a player
based on game data
GameController
-> controls flow of game
I am wondering if I should change this to make the GameController extend thread instead of the ServerConnection and have ServerConnection be a member of the GameController.
I need 1 instance of the Game Controller per player who connects to the Server. This is not a multi-player game, but a server based single player game (for the time being).
I don't think this idea will work though, because the run method of my ServerConnection object that extends thread is where the messages are received from the client...
Any guidance would be greatly appreciated.
Last edited:
