Best way to go about networking

Hi, I am aiming for my next game to be a proper multiplayer online game.
I have used sockets before and understand how they work, but I am not sure about the best way to build my game.

Should I build both server and client at the same time, whenever I change something in the client make sure it works in the server? or can I implement the networking after I have the game running in single player?

I don’t especially want to duplicate lots of code from my client and stick it in my server. Is there a way to make the client do most of the game processing, and the server just relay messages, adding and kicking players, and handle important variables like damage etc so it isn’t as easily hacked?

Thanks,
roland

To prevent hacking and modifications of the game, it is a usual design to have the server do all the work and the clients be the graphical front-end of all the relayed data from the server.

EDIT: Have you looked into KryoNet? It is a very solid networking library that does all the low-level socket legwork for you.

Thanks :slight_smile:

If you are planning to create a large online game that many people will play at the same time, you can avoid having a server do all the work by distributing the work across the network of users. As for hacking, you could have the game scan a nearby user’s output for discrepancies and send out a message for other connected copies of the game to check it. Then if it is found to be strange, have that user booted out of the network.