   Making a platformer?
  HiI've done some games but never a platformer. What is the best way to go if i look at something similar to Super Mario World (i know thats a large project but anyway)?At first (looking at mario 1) i though about having the world consist of an 2dimention-array of terrain-blocks. That makes collision very easy. But what about slopes and moving platforms?Also any platformer need a nice level-editor.Any good ideas or open engines? I looked through the articles but found nothing there...ThanksErik   
Quote:Also any platformer need a nice level-editor.I heard Tile Studio is pretty good, never used it myself though.Quote:Any good ideas or open engines? I looked through the articles but found nothing there...I've seen quite a few pretty good platformers made with the Allegro library; might be an interesting option if you're using C++. I haven't used Allegro myself, so I can't share any personal experience with it.As for handling slopes there are many different approaches. If you don't want to go with a general solution and do per-pixel collision you can use different approximative techniques. If the angle of the slope in each cell is known you can use the line equation for that particular slope to check for collisions, for example.(EDIT: Note that Allegro might provide the required utilities for collision detection)   ;  I already use a gfx-library so it would be best if i can continue to use that.That example looks cool. It seems though, that it does use an array for storing each "block" of the world. That will quickly become vast data, image the levels in mario world with lots of space to fly around in. But maybe each block only needs to keep track of what class it is and maybe health? And maybe i should store the blocks differently than an array, which need to look something like:myWorld.block[2][4]=BLOCK_BRICK; //this is a three block-wide platformmyWorld.block[3][4]=BLOCK_BRICK;myWorld.block[4][4]=BLOCK_BRICK;myWorld.block[4][5]=BLOCK_NOTHING; //this is airIs this a smart way to look at it at all?   ;  Try these tutorials. Flash based but it'll give you an idea of how it's done. Shows how to add slopes and moving platforms as well.Also take a look Mappy.   ;  Here are some good tutorials.Hope this helps,Svenjamin;  yeah at least that java stuff uses a world-array for the tiles (but thats only 30x30 tiles and im looking at at least 1000x200 tiles per level)And say i might have 100 levels (mario world has more). Thats around 160MB just to hold the chars that defines the tiles. Of course i can onload/load between levels it just seems like im doing something wrong:) This is PER layer on top of that. Im sure old nes games didnt store like this...Tile Studio seems nice. Im figuring out how to use the maps for my c++ game though....E[Edited by - suliman on January 22, 2008 9:05:21 AM];  After many years of failed tile type games I finally gave up on tiles altogether.  I just had a pile of knowledge of 3d maths and things of that nature and applied them to a 2d world.For years, those pixel artists have been trying to "hide the grid" with their art, and as a bonus, if you don't have a grid for them to work with.If you have the ground as a set of areas, or line segments or something, you only have to store what is going to be there.  Same with walls and things like that.  Most of the world is going to be open space anyway, well, the outdorsie type world.Collision maths is not much more difficult then the grid.  People do it in 3-space all of the time, and if you got some If you are thinking big... as in bigger then a couple of screens big, then I suggest that you go try that.  I went with lines/planes for grounds and walls because I too wanted the slopes to be there as well which was the bonus./meh... I ramble.   ;  Eh? Sorry Bacon but i understand very little of that post:)   ;Quote:Original post by sulimanAt first (looking at mario 1) i though about having the world consist of an 2dimention-array of terrain-blocks. That makes collision very easy. But what about slopes and moving platforms?Also any platformer need a nice level-editor.You don't need an editor, but once you're working on many - or large - maps, it surely comes in handy.Anyway, slopes can be seen as special cases - rather than checking against a tile to see if it's solid or not, you do some more precise checks against the slope geometry. For moving platforms, it's probably best to use simple axis-aligned boxes (AABB).As for storing level data per tile, that can be efficient, depending on the nature of the levels. Levels with lots of open space will cost less memory and less filesize, levels with relatively little open space will likely cost more. Collision detection might take some more time, though, because you have to traverse the whole list to see if you're hitting a tile. However, that can be dealt with by using some high-level optimizations, such as storing these tiles in a spatial structure (quadtree, grid, ...).However... since you've never done this sort of games before, I wouldn't start building a highly customized system that is meant to handle vast amounts of data. Write a simple game first. Start with small levels. Once you get more familiar with the substance, you'll get a better idea of how to handle a larger scaled project. Call your first approach a prototype or experiment if you want, but I'd recommend doing some investigation before starting something that may be too complex for now.Either way, good luck. :)   