Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Breaking up the GAME module
09-24-2012, 04:51 AM,
Breaking up the GAME module
I came accross the idea of allowing networked gameplay over LAN in VDrift. I am new to the code base, so I looked it up, and as far as I could gather, most of the event loop runs in GAME module. I gathered that the dynamics.update(GetTimeStep()) call does all the physics heavy-lifting, and most of the rest deals with user interaction.

In order to implement network support, I'd like to start off by breaking up the GAME module into two modules - SERVER and CLIENT, where CLIENT does most of the user interaction handling, and passes the control inputs to the SERVER over a UDP socket (or some other way, if it is on the same computer). So there would be multiple CLIENT threads running, one for the human player and others for the AI. In case of a networked game, CLIENTs would run on all the computers. The SERVER takes input commands for all CLIENTs, and does the physics heavy-lifting.

Since I'm a novice to the source code, any suggestions or criticism is welcome. Please comment on the idea.
09-24-2012, 06:20 AM, (This post was last modified: 09-24-2012, 06:22 AM by NaN.)
RE: Breaking up the GAME module
The client server concept is good even for non networked application. The idea is to move the simulation into a separate thread anyway.

The issue you will have to deal with is latency. But then it is a racing sim not a FPS. I'd say go ahead and see how it works out.

Btw there is StuntRally which is based on VDrift and has network/LAN support. They are using prediction/correction and run the simulation on clients and correct the velocity/position. I haven't really looked into their code, not sure how they deal with the latency when calculating the state correction.

Forum Jump:

Users browsing this thread: 1 Guest(s)