Jump to content
  • Advertisement


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


Writing and loading large levels

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

I am just getting into game programming and have read a couple of books on the subject, however, they all seem to deal with small games. They have no information about how to create or load large levels without having to instantiate and place every single sprite, wall or tree individually into the code. I want to be able to write a medium sized game with the flexibility to easily change and create levels. If anyone knows of a good book on this subject or has any top tips I would be most appreciative. (Specifically interested in writing a 2D game with DirectX using C++)

Share this post

Link to post
Share on other sites
if its a 2d scroller, the easiet thing to do is have a huge array of tiles. each tile would represent a different object (0 could be space you can move through, 1 could be a brick)

so if you have a 3x3 level, it'd look like this.

int level[3][3];


then you'd have a function to load the level into the game.

the only problem here is that it takes FOREVER to code a fairly larged sized level like this, so the best thing to do is to create a level editor that will save this array to a file, and then have your program load this file into your level array.

hope that helped.

[edited by - manoliisfat on October 22, 2002 1:22:16 PM]

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!