We're working on adding networking to our game and one issue that's come up is how to separate render-only data from the other data. Our server will just be a console application, so there's absolutely no need for it to be loading models and textures. At the same time, both it and the client will need to work with the other data in a class. Take a simple entity class for example. It has a position, a rotation, a scale, and a model. The client needs all of the data to render, the server only needs the first 3 for doing calculations.
How do you go about structuring this so there isn't tons of duplicate code and also no need for render-specific data on the server?
Client/Server setup
Started by Telanor, Oct 04 2012 10:32 PM
2 replies to this topic
Ad:
#2 Members - Reputation: 4604
Posted 04 October 2012 - 11:18 PM
Model-View-Controller design pattern
In other words, you need to seperate the game model data from controller and view data. I.e. your game entity (model) could consist of
Then you can define a physic controller, which changes position and rotation depending on input and finally you create a render view which contains the render data to the according game entity.
This way you can divide the single components quite easily, like
In other words, you need to seperate the game model data from controller and view data. I.e. your game entity (model) could consist of
- position - rotation - scale - model_name
Then you can define a physic controller, which changes position and rotation depending on input and finally you create a render view which contains the render data to the according game entity.
This way you can divide the single components quite easily, like
Client: game model + render view Server: game model + physics controller
Ashaman
My game: Gnoblins
Developer journal about Gnoblins
Small goodies: Simple alpha transparency in deferred shader
My game: Gnoblins
Developer journal about Gnoblins
Small goodies: Simple alpha transparency in deferred shader






