Jump to content

  • Log In with Google      Sign In   
  • Create Account

Client/Server setup


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Telanor   Members   -  Reputation: 1334

Like
1Likes
Like

Posted 04 October 2012 - 10:32 PM

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?

Sponsor:

#2 Ashaman73   Crossbones+   -  Reputation: 7488

Like
1Likes
Like

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

- 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


#3 Telanor   Members   -  Reputation: 1334

Like
1Likes
Like

Posted 05 October 2012 - 07:44 PM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS