Level editor

Hi All,

I am quite new to OpenGL and 3D development. I have done a few tutorials and built a room using quads however i was wondering what is the easiest way to go about building full levels e.g multiple rooms and corridors without hard coding the actual vectors.

Any help would be great.



You could look at using some sort of XML text file to hold the descriptions. There is an open source library to read these files called TinyXML

Well, there are a host of file formats for the description of 3D scenes. For instance, game developers will often define their own proprietary format tailored specifically to their needs. There are however, industry-standard formats like COLLADA which are open and widely supported. Content exported to such formats is created in various tools, e.g. Blender or 3D Studio Max.

You can always specify your own format and, for instance, write an export script for an existing tool, e.g. a python script for blender, that exports directly to your format and then write import code used by your application to process scene contents at runtime.

Whether you define your own format or use an existing format, bear in mind that a game needs data for more than just rendering, e.g. collision, path-finding, trigger regions for scripts, etc.

For complex scenes, you can’t just render everything every frame, you need some sort of culling system so that you only render parts you might be able to see. This often relies upon data which is stored as part of the level. But with modern hardware, you could probably render an entire Quake level without needing any form of culling.

If you just want to take the next step beyond hard-coded data, the Wavefront OBJ format is very simple and can be written by most modelling software. Searching for “OpenGL” and “OBJ” will provide many hits (of varying quality; it’s popular “my first OpenGL-related blog post” material).

Yes, unfortunately since OBJ supports different indices for each vertex attribute it does not directly map to OpenGL. Of course there is no end of threads explaining solutions on this forum :wink: :wink: