Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)
You are not logged in.
Hello people of the forum, I am trying to develop simple background collision using gbdk. I believe I can either run a loop on the main character to detect background objects, or I can make the background objects detect the player on every cycle.
Which one would be the better practice, and why? If I'm not explaining what I mean correctly please tell me and I'll try to elaborate.
Offline
Depends on the amount of objects. Game boy is rather limited system, so it is recommended to reduce the amount of computations.
More common way is to detect collisions with a collision map - rectangle array in memory, that shows which tiles are collidable. In simple cases background tile map may be a collision map.
But it is not recommended to read from vram, which may seem an obvious solution.
Last edited by toxa (2021-04-28 04:47:49)
Offline
toxa wrote:
Depends on the amount of objects. Game boy is rather limited system, so it is recommended to reduce the amount of computations.
More common way is to detect collisions with a collision map - rectangle array in memory, that shows which tiles are collidable. In simple cases background tile map may be a collision map.
But it is not recommended to read from vram, which may seem an obvious solution.
Thanks! Is there a resource on making a collision map or can you refer me to an example?
Edit: What I have been doing is storing background objects in 4 variable structs, x, width, y, height, kind of like treating them like entities. Is what I am doing wrong?
Last edited by LegolandoBloom (2021-04-28 08:09:07)
Offline
LegolandoBloom wrote:
Edit: What I have been doing is storing background objects in 4 variable structs, x, width, y, height, kind of like treating them like entities. Is what I am doing wrong?
you were not doing anything wrong, especially if you want some complex pixel-based collisions. the problem is to implement fast checking: iterate as little objects as possible. or else it won't work with reasonable speed on the game boy.
Offline
toxa wrote:
LegolandoBloom wrote:
Edit: What I have been doing is storing background objects in 4 variable structs, x, width, y, height, kind of like treating them like entities. Is what I am doing wrong?
you were not doing anything wrong, especially if you want some complex pixel-based collisions. the problem is to implement fast checking: iterate as little objects as possible. or else it won't work with reasonable speed on the game boy.
Thanks toxa, I was getting anxiety that I was approaching it the wrong way, you helped me with that
Offline