News:

Don't forget to visit the main site! There's lots of helpful docs, patches, and more!

Main Menu

World Collision - ALttP Engine Basics

Started by mdtaUK, September 04, 2012, 04:13:50 PM

Previous topic - Next topic

mdtaUK

So where to start.  I understand the map is made up of 8x8 tiles, which are combined into 16x16 and 32x32 tiles.  For my own maps/areas I would use objects of varying size, and build the layers with 16x16 tiles probably.  But I would have a layer for collision, and a layer for the player and the enemies and the interactive objects like bushes, grass, buttons etc.

Anyway, The collision layer is the most intricate and difficult thing to code and figure out with the non interactive bits, so how is it done in the game?  There are 45° edges to walls, which affect how the player moves, then there are subtle collision bits which allow the players head to appear above colliding tiles, and some which allow the body to appear behind slightly.

Now this is probably a bad idea, and I have no idea how I would code the reactions to intercepting these collision tiles, but here is a quick analysis of a screen, and a list of collision types I am anticipating needing...



gbromios

#1
I know this is an old thread, but I found this image really helpful in my considering LTTP collision implementation, so thanks! Like you said, this is the trickiest part of writing the engine.

Ultimately I think I've decided to simplify the whole thing to 8x8 tiles... Even though it quadruples collisions that need checked/tiles that need drawn, that overhead on modern hardware is pretty trivial... definitely worth it IMO considering you get off with 12 fewer cases to write (or 48 if you have to figure out for every direction separately like I might have to).

I'm still not sure if I've figured out a good way to do it, but if I get something implemented, I'll be sure to post details.

edit: also, I actually haven't considered the 30 degree collisions at all... where do they appear in the game?

mdtaUK

This is an old thread.  :grin:  I think I saw 30° angles used in Super Metroid to give more subtle curves and slopes.  I was just speculating how you might write a collision system which is flexible and gives you plenty of options.

I have since realised that this kind of programming is way beyond my basic limited skills.

But I would still be interested in hearing about how it is actually done in ALttP.

MathOnNapkins

I don't think thsis game actually has 30° or 60° collision detection. I could check, but I doubt it. Anyway, I guess I should clarify that even on the overworld, all collision detection still breaks down to 8x8 tiles. The overworld maps are ostensibly composed of 16x16 meta tiles, but each one of these meta tiles has a well defined composition into 4 8x8 tiles, and that is ultimately what is used for most calculations.

The only places where the actual value of 16x16 tiles (often known as map16 tiles in rom hack jargon) are used are for things like shoveling, lifting up bushes / sign posts / rocks / etc. There are other corner cases, but if I had to list them all I might get angry at how kludgy the whole thing is.

mdtaUK

Quote from: MathOnNapkins on March 03, 2014, 07:03:37 AM
I don't think thsis game actually has 30° or 60° collision detection. I could check, but I doubt it. Anyway, I guess I should clarify that even on the overworld, all collision detection still breaks down to 8x8 tiles. The overworld maps are ostensibly composed of 16x16 meta tiles, but each one of these meta tiles has a well defined composition into 4 8x8 tiles, and that is ultimately what is used for most calculations.

The only places where the actual value of 16x16 tiles (often known as map16 tiles in rom hack jargon) are used are for things like shoveling, lifting up bushes / sign posts / rocks / etc. There are other corner cases, but if I had to list them all I might get angry at how kludgy the whole thing is.
LOL  It is pretty much a discussion for making new engines.  I am guessing that BlackMagic won't require you to lay down collision separately to the other tiles.  And the map16 "objects" will handle their own collision in a hardcoded style.