If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Object Managment

I do have some code for this but i forgot to grab it so ill have to add it later. I'm working on a game engine... funny its my first real project im doing other than a few other small ones, but i learn better with experience so i might as well learn a little bit of everything. Anyways im trying to make a object managment system and im stuck on how im gonna hold the objects and their information. Each object will have its own individual ID 1,2,3,4,5,6,,7,8,9,10,etc. But then (most) or probably all have to hold more information such as color and weight for some of them. But the only thing I can think of is a normal array as im pretty sure that none of the stl arrays can hold more than one matching piece. One alternative could be that whenever an object is created the creator would have to give it a name and that would be the name of the array. Or should each object just be made as a class and then just have another declaration of the class made when you want to have it exist. Also I have a couple more questions...

- What is the difference between these two methods and when and where should i use them if there is one:

Re: Object Managment

I'm working on a game engine... funny its my first real project im doing other than a few other small ones

Building a game engine is complex and requires experience. I would start with some smaller, more concrete projects to learn C++.

Originally Posted by HavingPhun

Anyways im trying to make a object managment system and im stuck on how im gonna hold the objects and their information. Each object will have its own individual ID 1,2,3,4,5,6,,7,8,9,10,etc. But then (most) or probably all have to hold more information such as color and weight for some of them. But the only thing I can think of is a normal array as im pretty sure that none of the stl arrays can hold more than one matching piece.

What is the purpose of this "object management system"? It's no problem to keep objects of different types in a container as long as they are derived from the same base class. But that means that the functionality of all these objects should also be accessible through the base class (using virtual functions).

Originally Posted by HavingPhun

Or should each object just be made as a class and then just have another declaration of the class made when you want to have it exist.

That doesn't make any sense. An object is an instance of a class. You create classes at compile time; objects are created at run-time.

Originally Posted by HavingPhun

- What is the difference between these two methods and when and where should i use them if there is one:

Neither are valid C++, so which 'methods' do you mean?

Originally Posted by HavingPhun

Also do I have too put what the function Start() does in a .cpp file or can I just put it all in a header file.

You can inline functions in a header file either by writing the function definition in the class definition or prefixing the function definition with the 'inline' keyword. However, you should only do that for small (one-liner) functions to improve performance.

Cheers, D Drmmr

Please put [code][/code] tags around your code to preserve indentation and make it more readable.

As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky

Re: Object Managment

I think your right about me starting with something smaller. I dont think im really sure i know what im talking about. Also I didnt mean an object in cpp. But an object such as a ball or a cube, etc. But programming it to exist in the game\program. I would want to be able to manage there stats. So would that make more since now. Also what kind of thing should i make first as a easy project?

Re: Object Managment

Originally Posted by HavingPhun

Also I didnt mean an object in cpp. But an object such as a ball or a cube, etc. But programming it to exist in the game\program. I would want to be able to manage there stats. So would that make more since now.

You can write classes Ball and Cube, but if you want to have 2 cubes you don't define an extra class, you just create two Cube objects. How to 'manage' those objects is about application design. Before delving into that I would suggest you get yourself familiar with the techniques by writing programs where most things are fixed in the code. So, if you want two cubes, you write

Code:

Cube cube1;
Cube cube2;

inside a function and then do something with them.

Originally Posted by HavingPhun

Also what kind of thing should i make first as a easy project?

That depends on how much you have learned, but in principle it can be anything. I remember writing all kinds of simple games before I even learned how to write classes.

Cheers, D Drmmr

Please put [code][/code] tags around your code to preserve indentation and make it more readable.

As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky

Re: Object Managment

Ok thanks. Also I still need to learn alot more about physics and graphics to make it. Also Im starting by making the graphics system with opengl. Do you think I should switch to directx eventually or not? Also what are the advantages of each other. I know that opengl 3.0/4.0 are supposebly as good as directx, is that true?

* The Perfect Platform for Game Developers: Android
Developing rich, high performance Android games from the ground up is a daunting task. Intel has provided Android developers with a number of tools that can be leveraged by Android game developers.

* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.