Sign in to follow this  
Isokron

Restricted access to data

Recommended Posts

Im currently writing a RTS game that uses syncronized simulation on all machines and just sending user input over the network. The problem is that some parts of the programs are unsyncronized (everything having to do with drawing etc) and some syncronized (all the stuff that actually change the gameworld). Now to keep the simulation syncronized I need to restrict how data is accessed. Syncronized code can read/write syncronized data and write unsyncronized data while unsynced code can read/write unsyncronized data but only read syncronized data. As long as I was the only coder in the project this was somewhat easy to uphold but now that a few more people has started coding on the project the risk of mistakes increase. Is there some way to uphold the above access patterns by some features in C++ ?

Share this post


Link to post
Share on other sites
If you're worried about the data being corrupted, I'd say push everything into some source control (CVS, for one) - look around at other source control options too - most have some sort of user-level security where you can specify read/write permissions...

Share this post


Link to post
Share on other sites
In general, make your synchronized data private and control access to it. Any code within the scope of the data can change it, and any code outside of the scope can't.

I suspect that much of the problem is the result of the data comprising the synchronized game state being scattered all over. Some reorganization with a stronger distinction between synchronized and non-synchronized might help solve the problem.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this