#11892 - zazery - Thu Oct 23, 2003 4:48 am
Even though I'm fairly new to GBA programming I was wondering what algorithms are useful on the GBA. I have heard of the A* algorithm but I was wondering which other ones were suited for the GBA.
#11896 - Sweex - Thu Oct 23, 2003 9:38 am
Algorithms are completely independent of the hardware. In most cases they're not even limited to a programming language. It's a general (good) solution to a certain problem.
So to answer your question; all algorithms are suitable for use on the GBA. Some of them though, might need some adaption to limit processing time.
The A* algorithm is used for pathfinding.
_________________
If everything fails, read the manual: If even that fails, post on forum!
#11918 - zazery - Fri Oct 24, 2003 1:20 am
Thanks for the reply. I now understand that you can use most algoritms for even programming smaller and less powerful. Would it be possible if you could name a few that are commonly used in GBA programming? I do know some that might be useful but not all of them. I've always wondered what algorithms they used in commercial games for the computer and the GBA.
If anyone has a link to explinations of algorithms that would be much appreciated.
Thanks again.
#11922 - sajiimori - Fri Oct 24, 2003 5:23 am
An algorithm is just a series of steps to follow to accomplish something...anything at all. "Lather, rinse, repeat" is an algorithm. The steps for tying your shoes is an algorithm.
With that in mind, you'll probably see that asking what algorithms there are doesn't make much sense.
I suggest you find something you want to do before you try to figure out how to do it.
#11947 - zazery - Fri Oct 24, 2003 7:23 pm
Yeah I guess I should look into what I want to do. I've got then 2 questions regarding what should I look up to do the folowing.
1)I want to create a dynamically loading map. What I mean is like it keeps loading the map fast enough that there is no restriction to the map size.
2)How do I check for collision of a sprite to a background? I would like to do this in the tile modes. In the past I've done it by comparing the next tile to a list of tiles that a player can walk on. However Lets say I have a round tower spread over mulitple titles and I want to allow my character's feet to walk up to the curve.
Thanks for the reply
#11948 - sajiimori - Fri Oct 24, 2003 7:49 pm
For dynamically loading maps, you can copy in a new strip of tiles each time the background scrolls past a tile border.
If you already know how to do collisions between sprites and square tiles, you can modify that method to support slopes of various degrees (such as 1/4, 1/2, and 3/4 angles) and line them up to approximate a curve.
For solid square tiles, collisions occur anywhere inside the square. For partially solid tiles (like slopes), collisions only occur in the solid part. For instance, the solid part of a 1/2 slope that covers the bottom left corner is any point where y > x, where (x,y) is the distance from the top-left of the tile.
If you must have real curves, you would probably either create a lookup table of the height of the curve at each column of the tile, or do pixel collision by checking the shape of the image (i.e. a collision occurs when the pixel of the tile is not transparent).
#11949 - zazery - Fri Oct 24, 2003 7:57 pm
Would the transparent part of the tile be still visible to the player or would you have to put a tile behind that on another layer?
Where would you load the new tiles of the map in?
Thanks for the explination i'm understanding collision and dynakie:loading maps much better.
#11952 - sajiimori - Fri Oct 24, 2003 9:01 pm
Quote: |
Would the transparent part of the tile be still visible to the player or would you have to put a tile behind that on another layer?
|
Well, if it's transparent it's obviously not visible. ;-) If you want to use the pixel collision method, but you also want to have a detailed background (i.e. not a solid color), then you'd probably put it on another layer.
Quote: |
Where would you load the new tiles of the map in?
|
What do you mean by "where"? If you mean where to copy the tiles to, you would copy them to the strip just off the side of the screen. If you mean where you should put the code (i.e. when to perform the copy), you would probably copy the tiles over just before you scroll over a tile border.
#11955 - zazery - Fri Oct 24, 2003 10:13 pm
OK thank you very much that explains pretty much all my questions.
Now all thats left is to try some of these concept in my code. My current goal is to create a demo where a guy can move around a scrolling background and check collision with tiles.
#11959 - yaustar - Sat Oct 25, 2003 1:16 am
To get a better idea how the scrolling thing works, play a game (sum of all fears is a good example) and watch the map in Visual Boy Advance's Map viewer. You should be able to see what happens when you move around the map.
Good luck in your demo :)
_________________
[Blog] [Portfolio]