I have read a lot about handling network communication. What I have not read is how to structure objects. I am thinking for c++ specifically.
for instance a server and client share the same entity behavior. Some may be disabled if it is considered authoritative or not. Which the client could be authoritative in single player or when hosting a game, but not when connecting to another server. Also some entities may be predictive like player where it will still run the authorative code. The behavior part is easy enough to account for.
An entity will of course contain a graphical part and a behavior part.
A console server will only need the behavior part.
I can only think of 2 ways.
Have preprocessor statements in every entity to remove all graphics code. Which is a bit annoying as I will need to access model animations and it's transformations.
The other is have completely separate server and client code and if they run in the same app have the server and client code run. Problem being is there will be some duplication of information and also any predictive code will need to be written in the client object as well as the server. I suppose it could inherit the code from the server side.
So I was just wondering what methods you have seen used and which s the best and why.
I am pretty tired so sorry if this seems a bit silly. I was just wondering if there is a better way.