How to load/draw levels

Started by
2 comments, last by pcmattman 16 years, 10 months ago
I'm about to start work on my game engine, but I've run into some problems while figuring out how to make it work. I'm thinking of having a set of functions such as DrawCube, DrawSphere, etc... to make drawing much simpler, and maybe some functions to dynamically change textures on the fly. I'm using Direct3D, so all this isn't that difficult. My main question is, how do I go about loading level data? How would my level files (which I haven't thought about yet, hence the reason I'm asking) be formatted and translated into on-screen geometry?
Advertisement
unfotunately, that's all information that you'll have to figure out on your own, as the data is up to you as to what data you want your levels to consist of.

and it doesn't sound like your ready to make an engine at this stage of your learning, I'd just suggest thinking about making the game.
-----------------------------------------------The ZoloProject
There are many ways to go about this, and nearly every game uses a different method for storing and drawing levels. Assuming your game is 3D, you can come up with a file format that basically tells the computer how to draw your level.
Something like this:

mylevel.txt
LevelName: "MyLevel"       // Name of the levelTexture: "mytex.bmp"       // Name of the current textureCube: 5, 3, 2, 10          // x, y, z, sidelengthSphere: 2, 2, 2, 5         // x, y, z, radiusMesh: "mymesh.x", 3, 5, 6  // Name of mesh file, x, y, z


All your program has to do now is go through the level file and do what it says. So when it reaches the line "Cube: ...", it calls the DrawCube function with the supplied data, and if there is a collision detection system it passes this information to that system so that it becomes "aware" of the cube.

This is an extremely simple example, your game will probably require a more sophisticated level format but the general idea remains the same.
Thanks for your assistance, I'll look into implementing that into my engine.

This topic is closed to new replies.

Advertisement