Skip to main content
gamedev.net
🔒 Locked

Good idea???

Started by CJ Jul 11, 2000 at 4:06 AM 2 replies 400+ views
Original Post
CJ
CJ
Hi y'' all, been a while since I visited this board, and I''ve got a question concerning my new game mainframe. I am working on this mainframe with Object Orientation in my mind. So, therefore most classes inherit the functions etc of other objects. Now one of my classes is called Object. Which inherits from C_Obj, which in general represents a 3d point in space. This way I will know where the object is located at in space. Now comes the more difficult part. The Object itself contains a pointer to an array of objects. These objects are the polygons, the class Object also has a pointer to an array of C_Obj''s (3d points). In case of the real object it will represent the box it is in. In case of the polygons this will represent the position of the polygon inside the real object. I was just wondering if you guys would think this a good way of programming the objects in the game. In general it''ll look like class Object : public C_Obj { public Object() : C_Obj() {} Object *Polygons; Object *Prev_Object; Object *Next_Object; C_Obj *Coor_Obj; }; ///////////////// Object test; test.Polygons = new Object[6]; // let''s say a box, 6 polygons test.Polygons->Coor_Obj = new C_Obj[4]; test.Polygons->Coor_Obj[0] = .... etc etc etc (note, this is not my original code, but in some case looks like it). Would it be a good idea or not>
shamen
shamen
I dont think there necessarily is a right or wrong way to design your framework for your 3d engine.

If its your first 3d engine, then basically its going to be a learning exercise anyhow as you will release that doing it slightly differently would help for the implementation you are planning, or some new technique is published which you will need to redesign your engine to take into account.

I think the best piece of advice for starting on a new engine, is to try and keep it as flexible as possible. Its unlikely to be the fastest thing that the world has ever seen (my first one isnt), but keeping it a little bit flexible (and maybe trading a bit of speed) will allow you to make design changes which would otherwise mean a lot of hacking or starting over.

The way i designed my first engine was to keep the core very simple and unspecialised and build derivations of an object base class to handle all my specifics. That way, i reasoned i could throw away or change any single derivation without it affecting the rest of the engine. Then once you have completed it, you will have a feel about how it will work and what could be done better next time - which functions are fundimental and which ones are implementation specific.
CJ
CJ
Thanks for replying...
You are talking object based, just like I am talking. No, it isn''t my first engine, and I am designing this engine on speed rather tahn nice graphics (like all of my previous). It is my framework, and I''ll just see whether it is a good one or not. If it isn''t I only have to change the class Object and it''ll work (with probably a few adjustments to the other classes, if I change the functions).

Maybe I should''ve asked the question in an other way.

Is there anybody out there who worked a bit like I explained in the question...and made it to work according his / her own plans.

Thanks,
CJ
zedzeek
zedzeek
i don''t know that looks a bit to compilated i would do someit like this

struct Model {
vertices,polygons info
};

class Object {
vector posistion,rotateion etc
void updateobject();
void moveobject();
Model model;
};

class person : public Object {

};

class Door :public Object {
};



Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.