Sign in to follow this  

Object System

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

Hi guys, sorry for my English, i am from Russia. I am new here, but i am not new in gamedev so i wanna know what object system do you using? What mean Object for you? How you manage your objects? I am using XNA and C#, so feel free give any code.

Share this post


Link to post
Share on other sites
When using an object-oriented design, I use objects to represent stateful entities in my code. I usually take advantage of the object system provided by the language (C# supports object-oriented programming through classes, for instance), and don't make any particular effort to manage objects (of course, if the language is not garbage-collected, I set up ownership policies for any references, but C# is garbage-collected).

Share this post


Link to post
Share on other sites
Thx for reply.
So what should be structure of 3d entity? Should it encapsulate few structures like position, orientation, etc? Should it include physical body? Or it shall realise few interfaces? How better to hold meshes for object: inside it or in static class with all meshes preloaded? I am making simple RTS so i need to use messaging system. Is it actual in nowadays? Or there is better method to manage objects? And which way to integrate terrain with object system? Via meta-data?

I am asking because i wanna know which way is better.

Share this post


Link to post
Share on other sites
Usually, you try to design a hierarchy of objects starting from the most general (a scene), to the most specific (a single joint in the animation skeleton of a single character inside the scene, for example). If you do it this way, it is much easier to add code in very specific modules.

This keeps you from having to worry too much about how different systems will interact, and get bogged down in details. If the animation system is independent from the graphics system, which is independent from the game system, etc., you can focus on a single aspect of the engine until you are 100% satisfied with it, then move on to the next thing. That way you don't have to repeatedly change focus during development, which costs time.

Share this post


Link to post
Share on other sites
I would go with an Entity class which Extends a logic class and owns a graphics and a physics-mesh class as members. This is because usually:
1) The logic data or "state" of the entity will probably be different for every entity (structures like position, orientation, current animation).This means that we will want a different copy fpr every entity.
2) Graphics and Physics-mesh classes tend to have data that you do not want to duplicate, like meshes and animation heirerchies. Since many entities in the game usually share the same mesh duplicating mesh's for every entity (for example 100 soldiers) is a waste. So I would go with pointers to preloded meshes.

Share this post


Link to post
Share on other sites
Thank you for answers, guys!
So what about object tracking? Which way will be good in RTS?
Should i have some Task manager or messaging system will be better?
And which better way to glue all objects with terrain?
For example, if i wanna select all units within selection box, better way ( as i think ) is to select active terrain sectors ( that visible in camera ) and go foreach units in that sectors and check intersection with box. But what about design? Any ideas? Thanks!

Share this post


Link to post
Share on other sites

This topic is 3311 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.

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