Golden Sun Hacking Community

Golden Sun Games => Golden Sun: The Lost Age => Topic started by: Salanewt on 17, January, 2017, 12:29:16 AM

Title: Object Collision: Height?
Post by: Salanewt on 17, January, 2017, 12:29:16 AM
Hey! So, I have a long running goal where I want to make player effects more dynamic, and this includes allowing the player to push or Move objects diagonally. The problem with this is that Move pillars and other obstacles work in a way where manipulating them through the proper methods directly modifies the map collision data rather than having heights assigned to the objects. This effectively means that I can use Move to push a pillar diagonally but the sprite will only partially overlap with the collision, and looking at the actual code responsible for modifying a map's collision data didn't help.

However, I also noticed that the leaf platforms in Gaia Rock and the icebergs in E Tundaria seem to function differently. The platforms are not solid underneath, even when falling onto the lower level and trying to walk into them. I can also move freely between connected platforms, whereas movement is mostly restricted while they are moving (with exceptions where I can move very slightly should the game detect but be unable to execute a valid hop between platforms, or if I use the debug cheat for unrestricted movement while holding L). The icebergs seem to be similar minus the connecting part, as the one spot where a platform does connect with something else uses a script to make you walk all the way onto or off of the iceberg. I'm still researching these but am afraid of hitting a roadblock.

I was wondering if anyone had any insight on how these objects can have what seems to be object-based collision (unless they are actually map-based and are just hiding it really well). Additionally, I was wondering if this or some other method could be used to assign a height to something like a Move pillar while being able to stand on top of it without it being map-based and locked to a grid/whatever collision data is available. Ideally I can do it without having to rely on map initialization.

Thanks for reading!

Title: Re: Object Collision: Height?
Post by: Daddy Poi's Oily Gorillas on 17, January, 2017, 01:59:27 AM
Umm... I dunno...


I did just look at the leaf platforms, though... and found something interesting...
The tilemap is using the hop flag for tiles you can hop from/to.... but that also includes tiles that are touching as well.... interesting, eh?
If you turn off the hop flags, though... you can't hop between the objects... but if the objects are directly next to each other, you can still continue on.

Quote02010000 = Tilemap (Including graphics, event indexes, heightmap, etc.)(32-bit a tile)
000007FF = Graphic tile
00000800 = Unused? (MSB of graphic tile in GS1)
00003000 = If stepped on, heightmap index of PC (/NPC?) will change. (0=Does nothing? 1-3 are heightmaps 0-2.)
0000C000 = Priority? (Whether the graphic tile appears in front or not.) - TODO: See if this is 2-bit.
00FF0000 = Event Connector? (For doors as well.) (FF=Wall, FE=Gap for hopping?)
FF000000 = GS1: Height data; GS2: Special tilescript flags.
01000000 = ? (Used where bridges are.)
02000000 = ? (Seen used in Jupiter Lighthouse near Hover pads/slopes. No idea what it could be. EDIT: I think my research a long time ago is that this was connected with above flag for changing the collision layer index of object.)
04000000 = Determines whether to use the first or second encounters index.
08000000 = Hit/damage inducing.
10000000 = ? (Not sure if used or not?)
20000000 = Slope down.
40000000 = Climbable (Ladder/Vine) (Use same value on tile above or below to activate.)
80000000 = Hop. (Can hop from this tile.)


How are we going to hop without relying on tilemap?
Title: Re: Object Collision: Height?
Post by: Salanewt on 17, January, 2017, 02:13:03 AM
You have a good point there. Although: It's also worth noting that there is a segment of code that can be modified/deleted in the hopping code, and doing so allows you to hop from the leaf platforms as they are moving (or from icebergs as they are moving, or pillars from any direction, etc.). I'll play around with that and see if it would be a viable solution but it may need something more.

Thanks for reminding me of that!


Edit: Removing the three instructions at #080D4F00 allows for what I mentioned, for reference. I still want to study the code further to see if more can be done for certain tilemap checks but for now this should work for testing.

Edit 2: Just wondering, would it be possible to mimic a tilemap tile that allows hopping through object/event scripting?
Title: Re: Object Collision: Height?
Post by: Daddy Poi's Oily Gorillas on 17, January, 2017, 02:58:56 AM
I was thinking about a separate Hop thing... (Assuming there was any logical reason why they even do Hop flags?) ... But yes, that works too...

---

Now that we're talking about objects... this jas led me to become very curious how all that data works (~020322EC... etc.)
For Felix... when you are on a moving platform, it sees that the last 32-bit number... is a pointing to the object you are on.

Object data
+00 = Movement Script pointer
+04 = Relative poisition in movement script
+06 = Direction facing
+08 = Current X
+0C = Current Z
+10 = Current Y
+14 = Z of floor
+18 = X dimension related?
+1C = Y dimension related?

+22 = Collision layer index

+38 = Destination X
+3C = Destination Z
+40 = Destination Y

+50 = Pointer... (I think it is sprite related stuff.)

+68 = Home X
+6A = Home Y

+7C = Pointer to object you're on top of?



---
So no height info?
Title: Re: Object Collision: Height?
Post by: Salanewt on 17, January, 2017, 03:14:37 AM
A separate hop would make more sense, lol.

That's also very interesting. It doesn't seem to be the same for stationary objects, but it looks like almost any moving object will have a pointer; just tested with a floating block in Jupiter Lighthouse. Makes me wonder if stuff at any of the Rocks will do it too...


Aw.