Jump to content
  • Advertisement
Sign in to follow this  
Angelic Ice

C++ Builder and Structure: Categorising objects

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

Hello forum!

I have a structure for my game-field, similar to a scene-graph one could say. Every object in this scene-graph has the base-class Scene_Graph_Object.

Now, when the savefile is being deserialised, an object builds all of these Scene_Graph_Objects from the file.

Nonetheless, there is one thing separating these Scene_Graph_Objects, their purpose within the game-field. Some have no function, some are purely visual, others are playable, ... They are being sorted into different vectors depending on their category, more precisely put: Scene_Graph_Objects could be downcast to Visual_Only_Scene_Graph_Object, Playable_Scene_Graph_Object, ...

And this brings up my question: Where should this differentiation happening?

Deserialise -> Create Visual_Only_Scene_Graph_Object, Playable_Scene_Graph_Object, ... save them as Scene_Graph_Object base, and send that to the game-field-builder? I feel like all these up- and downcasting isn't really a pretty thing to do. Also considered to use some flags instead. As in an enum that all Scene_Graph_Objects own and can be checked once they are meant to be sorted into the scene-graph.

The reason behind these categories is, that they help me to build a pretty simple and tailored game-field, but somewhat I think that inheritance is not really bringing up any advantages, because inherited classes do not really extend the usage but only categorise the scene-graph-objects.

Would be quite happy to hear what you think : )

 

Edited by Angelic Ice

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • 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!