How do I efficiently code both the client and server at the same time?

Posted by liamzebedee on Game Development See other posts from Game Development or by liamzebedee
Published on 2011-12-06T05:38:17Z Indexed on 2012/07/07 15:24 UTC
Read the original article Hit count: 274

I'm coding my game using a client-server model. When playing on singleplayer, the game starts a local server, and interacts with it just like a remote server (multiplayer). I have done this to avoid coding separate singleplayer and multiplayer code.

I have just started coding and have encountered a major problem. Currently I'm developing the game in Eclipse, having all the game classes organized into packages. Then, in my server code, I just use all the classes in the client packages.

The problem is, these client classes have variables that are specific to rendering, which obviously wouldn't be performed on a server.

Should I create modified versions of the client classes to use in the server? Or should I just modify the client classes with a boolean, to indicate if its the client/server using it. Are there any other options I have? I just had a thought about maybe using the server class as the core class, then extending it with rendering stuff?

© Game Development or respective owner

Related posts about java

Related posts about networking