• Advertisement
Sign in to follow this  

Client/Server setup

This topic is 1933 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
[url="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller"]Model-View-Controller design pattern[/url]

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

[CODE]
- position
- rotation
- scale
- model_name

[/CODE]

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
[CODE]
Client: game model + render view
Server: game model + physics controller
[/CODE]

Share this post


Link to post
Share on other sites
Alright, we kind of figured that was the solution, I wanted to see how others tackled this problem. We'll give that a try and see how it works out.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement