Bachus
2004.09.14, 12:40 PM
So I'm working on the networking code for my uDG entry. While the networking specifics (opening sockets, transmitting data, etc) are no problem, I'm running into problems on the general design of the program.
The popular thing to do seems to be separate the game code into a client and server that runs separately, even in single-player mode. I shim a network layer between the two that handles communications. However, that seems woefully inefficient. If the server is also playing (or in single-player mode) then there would either need to be two copies of the game state in memory, or there would be a mess of spaghetti code to work around it.
So basically I'm looking for some insight into network code structure (specifically related to video games preferably). Tutorials, sample code, articles, snippets of wisdom, anything. Such knowledge seems to be lacking on the grand intraweb of ours.
The popular thing to do seems to be separate the game code into a client and server that runs separately, even in single-player mode. I shim a network layer between the two that handles communications. However, that seems woefully inefficient. If the server is also playing (or in single-player mode) then there would either need to be two copies of the game state in memory, or there would be a mess of spaghetti code to work around it.
So basically I'm looking for some insight into network code structure (specifically related to video games preferably). Tutorials, sample code, articles, snippets of wisdom, anything. Such knowledge seems to be lacking on the grand intraweb of ours.