Sign in to follow this  
the vines

Hard code maps or make a map loader?

Recommended Posts

I say make the loader.

Even if you use a text editor instead of a real map editor, it'll be easier to create new maps or update existing ones in an external file. Plus, you won't have to recompile just to see the last map or update you made.

Share this post

Link to post
Share on other sites
Wasn't there a topic with the exact same content a couple of days ago ?
anyway, always load from file, except it's random generated.
Why ? It'll be way easier to extend your game.
Always make as little as possible hardcoded. Especially in big projects the Game- or Level Designer is not the Programmer.
Even if you think that right now you're the only one working on it, that might change.. If not, you'll have the experience for a future project.

Share this post

Link to post
Share on other sites
I agree with the above -- unless your game is a small throw-away sort of game that you do not intend to reuse. The time taken to develop and test the additional code may not be worth it in that case, and it's more important to release a good-quality working product than it is to follow best practices, particularly if those practices will have little-to-no impact on you.

Writing the code to load your maps is otherwise clearly a better choice though:
  1. You don't have to recompile to add maps or see changes, allowing you to more easily test your game and make sure it's fun to play.

  2. You can more easily add additional levels, or completely replace the existing ones if you're adapting your code for a different game or sequel.

  3. You allow the possibility of player-created content.

For example, let's say you're writing a simple brick-breaker type game, where you have a paddle at the bottom of the screen, some bricks up the top, and a ball bouncing around that destroys the bricks:
A simple brick-breaker game
This is a pretty simple game, and if yours doesn't include a lot of different brick layouts or special powerups or the like then it's probably going to be very quick and easy to simply hardcode a couple of levels; unless you're planning a more sophisticated sequel or want to reuse the code you're probably better off just getting it released rather than spending a whole day or two writing and testing level-loading code.

However, let's say you're still writing a brick-breaker type game, but you've got a bit more sophisticated:
A more complex brick-breaker game
Your game has a series of different levels, each with lots of bricks in drastically different layouts.

You'll probably need to tweak these levels during development to make sure they're fun and challenging, meaning multiple test-plays, which would be a hassle with hard-coded level data.

You'll probably want a lot of levels, and may want to add more later. This is difficult and time consuming with hard-coded level data.

In this case, the time spent to write proper level-loading code is probably well spent.

Hope that helps! [smile]

[Edited by - jbadams on October 3, 2010 2:53:21 AM]

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this