Jump to content
  • Advertisement
Sign in to follow this  
Ainokea

Base object class

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

I am working on a base object class that all my objects in my game inherit from (IE. cars, trees, skybox, etc...). What would go in it? All I have so far is orientation, position, upvector. What else would go in it? [Edited by - Ainokea on September 28, 2004 12:20:00 PM]

Share this post


Link to post
Share on other sites
Advertisement
As you've demonstrated yourself a base type called "object" isn't very useful, its ambiguous, the term object means more than one thing depending on the context of use. The only exception i would make is if a type "object" is a root of an instrusive reference counted type hierarchy basically memory management even then i would reconsider to me the type "object" is way to abstract and not a very useful abstraction.

Share this post


Link to post
Share on other sites
Quote:
Original post by snk_kid
As you've demonstrated yourself a base type called "object" isn't very useful, its ambiguous, the term object means more than one thing depending on the context of use. The only exception i would make is if a type "object" is a root of an instrusive reference counted type hierarchy even then i would reconsider to me the type "object" is way to abstract and not a very useful abstraction.

Your probally right.

Share this post


Link to post
Share on other sites
I'm going to disagree slightly with snk_kid.

If you have a concise definition of what an "object" is, then it might be useful to implement an Object class (though that is not a great name) and use it as a base class.

If you are thinking of making a base class just to hold variables that are common to several classes, then you are making a big mistake.

In your case, it probably makes sense to have an Object class that represents something that exists in your world and has a position and orientation. Does it make sense to say that an Object class represents something that exists in your world and has a position and orientation and a texture?

Share this post


Link to post
Share on other sites
Quote:
Original post by JohnBolton
If you have a concise definition of what an "object" is, then it might be useful to implement an Object class (though that is not a great name) and use it as a base class.


Usually there is no concise definition, and the reason why Ainokea started this thread because he's not sure what an "object" is mean't to have. When people say object there are usually refering it to a specific context and there is usually a better terminology.

Quote:
Original post by JohnBolton
If you are thinking of making a base class just to hold variables that are common to several classes, then you are making a big mistake.


That is exactly what he's considering to do, and thats what most people tend to do.

Ainokea there is more than one way to model an inheritance relationship, you could consider "state inheritance" for this instead of making this a static relationship as type inheritance implies beside type inhertiance is more about inheriting behaviours, you might wont to read this for better alternative.

[Edited by - snk_kid on September 28, 2004 7:32:43 AM]

Share this post


Link to post
Share on other sites
What you want to do is probably "Entity", a physically existing object in your coordinate space. It would be more like an interface for entities in your world. If you want it to move often, you may put look/move direction into it, up-direction, and next to them - relative matrix, recomputed every time is is needed. Position, too, of course. It may contain a basic anti-collision system, but that could be too much...

When it comes to #textures, it rather belongs to a render object. An Entity may have a reference(or pointer) to a render object...

Cheers.
/def

Share this post


Link to post
Share on other sites
I just looked at the OGRE engine and I am going to do what they did. Have a class that takes care of movement only. Thanks for the help.

Share this post


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

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!