Golden Sun Hacking Community

Golden Sun Games => Golden Sun: The Lost Age => Topic started by: Plexa on 07, December, 2015, 01:00:46 AM

Title: Mars Lighthouse Torch Despawn Glitch
Post by: Plexa on 07, December, 2015, 01:00:46 AM
I've known about this glitch where you can unload one of the flame torches in Mars Lighthouse but never been able to replicate it until today.

(http://i.imgur.com/WmxHChj.jpg)

Here's how its done; http://www.twitch.tv/tl_plexa/v/28696965

Essentially you get an encounter approximately on the same frame as when the torch gets lit, and then after the encounter the torch is missing. I don't think this is usable anywhere else but I'm posting it here in case somewhere here is interested in why it happens and if there's any potential for further abuse.
Title: Re: Mars Lighthouse Torch Despawn Glitch
Post by: leaf on 07, December, 2015, 01:29:40 AM
I keep going over in my brain how they could have coded this for that to happen, and absolutely nothing makes sense. I'm guessing that the unlit torch and the lit torch are different objects in memory, and that for whatever reason the destroy function is called before the battle function, but the instantiation function is called afterward. That's the part that doesn't make sense. I could understand doing a physics check -> battle -> psynergy, but why isn't it just instantiating the new object as the very next call after destroying the old one lol

As for other places this could be useful... I can't think of any. AFAIK you can't get an encounter and cast psynergy on the same frame, so there's very little way to force this to happen outside of rare cases like this where an object in the environment is acting as a psynergy. If there's any other timed events in the game, you might get a similar result. Maybe you could do something with some of the moai in the rocks?
Title: Re: Mars Lighthouse Torch Despawn Glitch
Post by: Daddy Poi's Oily Gorillas on 07, December, 2015, 02:44:02 AM
Two separate objects... No init/de-init going on, I don't think?
020323EC = Lit object.
0203246C = Unlit object.

Basically, the unlit object is in its place, and the lit one is at (0,0), when lit, the unlit one goes to (0,0), and the lit one takes its original place....
That doesn't fully explain why battles can be executed between both, but I haven't looked at that part yet....
(I could probably figure it out quickly if I looked at the code. - Maybe later. - Before looking, I have a hunch that each object has its own code for their thing, so wouldn't be surprised if object order meant something... I'm thinking the first frame all object code is executed.... the unlit one disappears... and then all object code is executed, and the lit one appears?)
Title: Re: Mars Lighthouse Torch Despawn Glitch
Post by: leaf on 07, December, 2015, 05:53:59 AM
Oh, I think I see what's happening. If you watch the video (start around 2:25), it actually does light the torch during the battle init. The battle init saves the state of the room so that it can return to it after the battle, so it probably saves the position of the "lit" torch before the "unlit" torch, which happens the next frame. It makes sense that an object at 0,0 would have its state saved before another arbitrary point, but my explanation isn't quite convincing in that this process shouldn't be spanning multiple frames.