Object System

Started by
4 comments, last by EpicLand 15 years, 4 months ago
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.
Advertisement
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).
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.
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.
Check out the first gameplay video from my javascript/PHP RTS game
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.

My Oculus Rift Game: RaiderV

My Android VR games: Time-Rider& Dozer Driver

My browser game: Vitrage - A game of stained glass

My android games : Enemies of the Crown & Killer Bees

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!

This topic is closed to new replies.

Advertisement