SaxxonPike / roton

Cross-platform ZZT and Super ZZT clone in C#.
ISC License
23 stars 0 forks source link

#ZAP and #RESTORE on remote labels doesn't work correctly #52

Closed SaxxonPike closed 5 years ago

SaxxonPike commented 5 years ago

A number of failures in the Preposterous Machines ZZT world are caused by a little-known feature of #ZAP and #RESTORE - the ability to do so to external labels.

Examples:

This bug is unlikely to affect the vast majority of games, but Preposterous Machines uses it in almost every single board.

SaxxonPike commented 5 years ago

A failing integration test is created for this: ZappingRemoteLabels_ShouldProduceExpectedCode

hegyak commented 5 years ago

I am not sure if this is related: I am not sure what bug exactly is happening here. But I can explain what happens and what to do to recreate this bug. And the intended effect or result.

Playing Code Red version 1.1 I get the following Bug: The vacuum is supposed to explode, which happens. But after the vacuum explodes, your supposed to be able to search the object and get a key from the destroyed vacuum. Instead, I don't get that. The vacuum object still behaves as if it wasn't destroyed.

To recreate: Start the world codered1

Go to the dresser like object in your room. Touch the left point on the dresser. You should have clothes on now. Go to the double ~ mark on the same board. This will spawn the Vacuum object. Touch it. Touch Both U symbols on the same board. Generating two more Double ~ marks. With the Vacuum following you, touch those new objects you spawned. The game should ask "Do you want to clean this up?" Yes to both. Then go into the room below your bedroom (start area). Touch the Yen symbol. It should knock over the plant. With the Vacuum still following you, touch the plant and the new Brown blocks. If done correctly, the game will say, "I think I overloaded the Bag." and the Vacuum object will "Explode" Touch the Vacuum once more. It will tell you, "You found the garage key."

This also happens in Code Red 2.0 SE but it's more common to find 1.1 of this game.

The object's code has lines: "#restore touch" "#zap touch"

Is that what is happening here as well?

SaxxonPike commented 5 years ago

I went through a trace and in some cases, it's local #ZAP that doesn't seem to work correctly. I'm going to revisit the original game engine and try to figure out what is incorrect.

SaxxonPike commented 5 years ago

I have merged in changes that have fixed the sine renderer in Preposterous Machines. There may be other games that are fixed by this too. Further testing will be needed around label zap/restore, local and remote.

hegyak commented 5 years ago

Using https://github.com/SaxxonPike/roton/commit/db6770ec2f516fa6655e8d821027e0b336216346 fixed my Code Red bug I reported.

SaxxonPike commented 5 years ago

I played through Evil Sorcerer's Party (part 1) completely without issues, and got Knight's Tour in Preposterous Machines working as well. I'm going to guess by the resolution to Code Red that this bug is fixed all around.

Thanks for the confirmation, @hegyak!