gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > Newb with a few questions...

#70795 - douglasking - Wed Feb 08, 2006 8:25 pm

Long time reader, but this is my first post. I hope my questions do not seem annoying, but I seem to have problems piecing all the information out there.

Using tutorials I have found mentioned here, I am able to compile various demos and customize them. I also have been able to test them using VBA, a GBA SP and a NDS. I also use a M3 SD adapter with a 1GB memory stick to move the GBA file around when I want to test on actual hardware. Its really great to see something "come to life" on the LCD screen of the GBA.

My goal is to create a side scrolling platform game - I'm imagining something like the old NES game "Rygar".

Here are my questions. I don't expect long replies, but links to a tutorial or a short blurb would be more than enough.

1) I am comfortable creating backgrounds, but how do I layer them and scroll them at different speeds? I thinking of using mode 3, do you suggest a different mode?

2) The ground and platforms, would these be a tile based background? How would I go about placing the various tiles to create a map?

3) How to I get my main sprite to interact with the enviroment? Jumping onto a platform, running along the ground, etc without moving through enviroment as though it wasn't there.

Thanks!

#70797 - poslundc - Wed Feb 08, 2006 8:36 pm

douglasking wrote:
1) I am comfortable creating backgrounds, but how do I layer them and scroll them at different speeds?


This is called parallax scrolling (try googling it for more info). The short of it is that you use fixed-point values to keep track of where each background layer is scrolled to, and give each layer a different velocity to move at whenever the main BG moves.

Quote:
I thinking of using mode 3, do you suggest a different mode?


YES! The bitmap modes are rarely practical to begin with, but for multiple-layer backgrounds you'll most definitely want to use one of the tile modes, which allows you to have up to 4 separate layers handled by the hardware, rather than you trying to combine every pixel on the screen manually.

Quote:
2) The ground and platforms, would these be a tile based background? How would I go about placing the various tiles to create a map?


Read TONC on tiled backgrounds. You can only use tiled backgrounds in one of the tiled modes.

Quote:
3) How to I get my main sprite to interact with the enviroment? Jumping onto a platform, running along the ground, etc without moving through enviroment as though it wasn't there.


I'm going to suggest you try searching the forum for keyword combinations like "collision detection" and "background collision". (Be sure to set the search to AND mode - it defaults to OR). It's a broad topic and without a more specific question the best advice I can give is to read up on what's already been said on the subject.

Dan.

#70904 - deltree - Thu Feb 09, 2006 1:35 pm

Quote:
I thinking of using mode 3, do you suggest a different mode?

you CAN'T have multiple background on mode 3.
actually, I think mode 3 can be cool if you plan to make a nice game with some static backgrounds:
It will allow you 16 bits color,much more than other mode, much nicer.
but no scrolling, no multiple layer.

Quote:
2) The ground and platforms, would these be a tile based background? How would I go about placing the various tiles to create a map?

If you want to have parallax scrolling, or just having a scrolling and not static background again, then you'll have to have a tile based background, yes.

Quote:
3) How to I get my main sprite to interact with the enviroment? Jumping onto a platform, running along the ground, etc without moving through enviroment as though it wasn't there.

there are multiple ways to solve these problems. it's the basic of every game, it defines the gameplay, and it's different for every kind of game (plateform, 3D, scrolling, not scrolling,...)
The easiest would be to check the color.
For example, you have a plateform game:
What is the color of the pixel under your character feet?
If the color is 0x0000, it means the transparent pixel, then the character fall, because there is nothing under his feet.
If the color is different, then the character don't fall. That's just it , basically.
of course, it's the general scheme, read carefully the tutorials about collsion detections, that's what you are asking for actually. there are many twists and tricks about it. for a 3D game, it's completely diferrent for example, and much more complicated.

#70926 - Palamon - Thu Feb 09, 2006 4:12 pm

deltree wrote:
The easiest would be to check the color.
For example, you have a plateform game:
What is the color of the pixel under your character feet?
If the color is 0x0000, it means the transparent pixel, then the character fall, because there is nothing under his feet.
If the color is different, then the character don't fall. That's just it , basically.


Or for the tile-based bg version like in mode 0, you could just check the background tile map and see if it references to your transparent tile. If transparent, then you can move through it, otherwise not.

But when you want the same tiles to have different properties (ie some fake plateforms or hidden ones that go poof when you shoot them), I map a small map that corresponds to the background tile map, and put the properties on that and have my collision system look at that map.

I don't have much my experience with that solution in platforming, but I'm soon going to find out with my own game.

#70933 - gauauu - Thu Feb 09, 2006 4:24 pm

Or, similarly, have properties of different tiles. Every tile between 0 and 10 is a collisioned tile (platform/wall). Every tile above 10 is open. or something like that. (probably should actually be more flexible than that).

But then, just check the index of the tile. For things like fake walls, I tend to reduplicate some graphics into different tiles....so it looks the same, but has different properties.

#70935 - deltree - Thu Feb 09, 2006 4:30 pm

of course, there are so many ways of detecting a collision , depending on the kind of game.
generally speaking: before moving the character in a location, check the location first:
is there enought room for your character to stand on it?
is there a dangerous thing on it ? (enemy, lava, slime)

How does the character react when there is an obstacle?
If the obstacle is a solid wall in front of him, then DONT allow the character to move forward...or even, push him backward (x=x-1) etc...

Because there are so many possible gameplays, there are different ways of doing this. it's the way you treat this part that will make your game enjoyable ..... or not.

#70947 - douglasking - Thu Feb 09, 2006 5:16 pm

Alright, a tile based game using multiple scrolling backgrounds would best be using mode 4? Is this correct?

Just wanted to firm this up before I start down a path of development and learning. Thanks.

#70970 - Cearn - Thu Feb 09, 2006 8:35 pm

Mode 4 is also a bitmap mode. Mode 0 would be best. Also, take it one step at a time. Get acquainted with the hardware first before doing anything big. Learn about the bitmap modes, GBA limitations, interrupts on smaller demos before trying it in something big. Otherwise you might notice that you have to start all over again when you find that something you had planned is not feasible.

#70989 - douglasking - Thu Feb 09, 2006 9:52 pm

Thanks Cearn,

Later today I was reading TONC. During reading I realized that most likely Mode 0 would be best. I felt like kicking myself in the pants. :)

My general plan as to outline my project into the elements needs to create my game. Using those elements, I wanted to l read every tutorial (doing every exercise) on that topic and create concept demos of that until I know the particular topic like the back of my hand.

<example>

Background - Using mode 0 create a scrolling parallax background.

</example>

I see now my initial post was a bit ambitious, sorry about that. My future posts will be more specific. Thanks again for all the replies.