Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


efficient way to organize level data?

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

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

Share this post

Link to post
Share on other sites
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 information

int 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 information

char 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.

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

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!