2D Levels

BlitzPlus Forums/BlitzPlus Beginners Area/2D Levels

IKG(Posted 2006) [#1]
I know this is a very basic question, but I'm just confirming. Do 2D games, like Mario, load up an entire image and use it like a tilemap?


Grey Alien(Posted 2006) [#2]
no. mario will load a set of tiles and then draw thoses tiles on-screen (depending onthe player's position on the level) based on a map datafile.


IKG(Posted 2006) [#3]
Yikes; any suggestions then?


Robert Cummings(Posted 2006) [#4]
Yeah - use big chunks of images and make an editor which uses big chunks.

This is not only faster, but better for pcs. Where memory is at a premium, or storage space at a premium, tilemaps are used.

Pcs do not need tile maps for most games. If you have a HUGE area then you will need tile maps.

Proof is in platypus - a great shootemup by antony flack. No tilemaps there... runs well even on crippled pcs.


IKG(Posted 2006) [#5]
Could you please make a "stupid" version of what you just said lol? I'm a beginner to this whole 2D scene...


Alaric(Posted 2006) [#6]
He means that you need to create many smaller images (likely in the form of squares). Then, you will use those images on a grid to make up a bigger picture. Have you ever noticed how 2D games such as RPGs use the same image for paths and trees all the way through the level? I'll leave you my RPG engine, though i doubt that it will help much as it is nowhere near completion and will NOT run w/o a level map and images. Level editor not included.



CS_TBL(Posted 2006) [#7]
A 2d map is like a 2d array.

If your map has -say- max 256 tiles it can use then each tile has a unique number, 0..255.

So what you store in the 2d array are these numbers.

If your map is bigger than what can be seen on screen (like RPG's or Gradius-style shooters) then you need offsetx and offsety variables.
The other set of variables you need is mapx and mapy (or camerax and cameray etc.). To show a piece of the map:
dim map(159,159)
for y=0 to displayheight-1
  for x=0 to displaywidth-1
    tile=map(mapx+offsetx+x,mapy+ofsety+y)
    ; now you know which tile to show, and you could show it like this:
    DrawImage mapgfx,x*tilewidth,y*tileheight,tile ; assumingly you loaded such a gfx file as animimage, so each tile has its own number
  next
next



IKG(Posted 2006) [#8]
Yikes. Well what about games like Metal Slug and Street Fighter? One big tileimage?


CS_TBL(Posted 2006) [#9]
If there are structural repetitions in the image, an image that's also large than a screen, one can assume it's tiled. For stills behind sprites (a big planet behind space invaders), one could put a normal picture there.


Nicstt(Posted 2006) [#10]
If you are trying to get your head round 'stuff' (it sounds like you are). Look at the samples and sample games and programs that came with b+

they help with seeing what can be done, and many of the basic skills you need to progress. The time you spend wont be wasted.:D

How other games were done is in some respects irrelavent, there is often more than one way to reach a gaol.

Go with what you prefer, experience will give you an idea of whats more efficient - to program - to draw - or in system resources.


IKG(Posted 2006) [#11]
I don't have blitzplus. I have blitz3d. I only post here for 2D advice since there are much more 2D threads than there are in the 3D section.

I would like to start off with the basic 2D style that Metal Slug uses. Do I just load 1 big animated image, or do I load seperate big images?


CS_TBL(Posted 2006) [#12]
If your gametiles are all equal in size (16x16 32x32 etc.), use animimage.. keeps things much more managable after all. You could also consider multiple layers where each layer has its own tilesize.


Grey Alien(Posted 2006) [#13]
I totally overlooked animimage when making a tile based platformer, I loaded in one giant image and grabbed the images I needed into an array of images.


CS_TBL(Posted 2006) [#14]
Well I prefer drawimagerect with a big image actually, too bad it's broken in bmax. Advantage is that you don't need to know the tilesize in advance then..


Alaric(Posted 2006) [#15]
To answer the question you asked, yes you do use many images rather than one big one.