Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


reading and writing a pointer in binary mode.

This topic is 5307 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

this problem came up while trying to save and load some engine related data to disk. in my engine i have a list of Entity pointers, each pointer pointing to memory for the entity, of course. is there an elegant way to dump/read the entire Entity object to/from disk? or am i stuck to writing/reading each sub-component of entity to disk?

Share this post

Link to post
Share on other sites
My favorite way to do stuff like this is to store all of you''re entities in a block of contiguous memory... If you''re entities point to eachother, don''t store ABSOLUTE pointers, store offsets from the beginning of the buffer... And likewise, when you want to use entities, don''t use absolute pointers... Store and offset from the beginning of the buffer...

Now, you can read and write the whole buffer to disk... and the code (since all of the pointers are relative), will work...

I thought of this technique when I had to store and then be able to read from disk a whole n-ary tree....


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!