efficient way to organize level data?

Started by
0 comments, last by Gammastrahler 22 years ago
hi, i have the following problem: i started programming my 3d engine three months ago, and now, my data structures are somewhat messed up that i have problems to keep track of my source files and to add further features to my engine... i want start again from 0 because the current project is too messy. so i need some hints how i could do it the better way. point 1: data structures. in my current engine, it was at follows:
  
struct object_t        //  used for all sort of objects, 

                       //  from rooms to solid objects

{
    int      numVerts;
    vertex_t *vertices;
    int      numFaces;
    face_t   *faces;
    int      numLightmaps;
    lightmap_t *lightmaps;
};

struct vertex_t {
    float    x, y, z, w, u, v;
    vec3_t   normal;
    vec3_t   color;
};

struct face_t {
    int     vIndices[3];
    plane_t plane;
};

  
ok this may not seem messy but this is only a short extract of the data structures. would be glad to get some answers! thanks gammastrahler
Advertisement
These are useful structs and others might suggest wrapping them into different classes so you can tie some functions to them. But what I think would help would be a look at a higher level of organization in terms of creating an list class that has some functions like sorting, saving to hard-drive and loading from hard-drive. I also noted you texture vertex information as well. Texture loading is another task that needs to be sorted out.

Your best best is to sit down with different _large_ sheets of paper and decide where the data should stored and where the list-sorting+loading+saving function should be.


  class Object3dList{int numVertex; // is this the right level for this informationint numObjects;char ListFileName[30];list <object_t> myObjectList; // I use STL here but any list type would be fine CPtrList etc.};class Object3d{int numVertex; // is this the right level for this informationchar OnjectName[30];int objectID;list <vertex> myObjectVertexList; list <texture> myAttachedTextures;  // maybe if some textures are shared Object3dList would be a better place for this or maybe a separate class altogether?};class Scene{};  


I had a similar problem with a series of sprites I had to load, sort, and store. I got some clarity away from the computer by writing down the different stuff I would need and sorting it out on paper.

ZoomBoy
Developing a iso-tile 2D RPG with skills, weapons, and adventure. See my old Hex-Tile RPG GAME, character editor, diary, 3D Art resources at Check out my web-site

This topic is closed to new replies.

Advertisement