Search code examples
iphoneopengl-eslevels

Designing and loading levels in a game


I'm very new to game programming so excuse my very vague questions :P

I've begun working on a 2D game using OpenGL on the iPhone as a means to teach myself game programming. I've come to the point where I've written an engine, gotten things like collision detection working and other animations but now I need to actual start on creating something sort of playable and my first big question is on levels. For my project I'm going to be using a Tiled map for the levels and my question is: How would I go about "designing" a level? And by this I mean, how do programmers know at what point in a map should certain enemies come into play? How can they specify certain things in the level that will happen? Overall is there a methodology for designing a level (from programming perspective) and be able to load it to use it? How do game programmers do this? I know of course there is an enemy AI part to this so that I of course wouldn't be pre-writing each and every movement for every enemy but at least basically knowing when each one should come into play and things of that sort though? Thanks again for any help and again I'm sorry if my questions are too vague because I'm just starting out :D


Solution

  • You can start with the old-fashioned way: make mobs stationary. Your map data can contain mobs, where they are located, what type they are, and how they move. A carefully designed map can make the game very challenging and fun.

    For AI's, typically a hybrid of multiple algorithms will be necessary. Say if you're doing something like a single player free-mode StarCraft, the AI can be combination of heuristics (i.e. pre-cooked strategy such as flooding player base with overwhelming power, creating second base) and min-max algorithm decision (i.e. in an encounter, take out the most threatening unit as you would do in chess). That is an interesting topic and is also the foundation of many fellow programmers'/scientists' career.