Jump to content

Game world serialization


tjheldna
 Share

Recommended Posts

Hi All,

 

I'm looking at serializing the current game state for saving and loading. My first question is...

 

Do entity's that are added/removed from the world editor have some sort of unique id assigned to them that I can access?

 

I noticed that the entity "name" field is unique and increments as you drag them in the world, however this could easily be trouble with duplicate names due to copy/paste and user error. That dosen't seem like a robust solution to use the name for its unique identifier.

 

So what I plan to do is loop through all objects in the world match the id's; if its of a certain type then call its load/save function as required.

 

Maybe is there a better way of doing this task?

 

Cheers!

trindieprod.png?dl=0spacer.png?dl=0steam-icon.png?dl=0twitter-icon.png?dl=0spacer.png?dl=0
Link to comment
Share on other sites

Nothing to stop you assigning your own unique IDs as you can simply loop through the level objects children assigning them to a new key value. You probably already loop through them in order to create internal game objects so there is no additional overhead really. As these are static then this should always be repeatable.

 

With a base class that all dynamic object classes are derived from containing the ID and a set of virtual functions for loading and saving; each derived class can have its own save load functions which can save/overwrite key data for the restored level.

 

 

Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...