ruffle-rs / ruffle

A Flash Player emulator written in Rust
https://ruffle.rs
Other
15.78k stars 822 forks source link

Pink Tac Toe: Game board doesn't reset properly #10382

Open waspennator opened 1 year ago

waspennator commented 1 year ago

Describe the bug

659226_game_pinktactoe.zip Game seems to work alright, but for some reason after winning or loosing a game of tic tac toe with pinkie, the X's and O's don't properly reset and instead stay on the board.

Ran it through the ruffle web demo and only saw this as a hint to what might be going on. "RemoveSprite: Source is not a display object"

Pink Tac Toe Ruffle

Expected behavior

The board should properly clear itself whenever you get a win, a loss, or a draw.

Affected platform

Browser's extension

Operating system

Windows 11

Browser

Edge 110

Additional information

No response

Herschel commented 1 year ago

Looks like the removeMovieClip call fails on the Xs and Os because they are on a timeline depth (<AVM_DEPTH_BIAS) in Ruffle when they shouldn't be. There is some swapDepths trickery that isn't functioning quite right.

Herschel commented 1 year ago

The issue is a bug in the goto-rewinding behavior. In FP, whenever you do a goto-rewind, the display list gets completely cleared of timeline instances, and then frames are fast-forwarded from frame 1.

Ruffle is incorrectly using the transformed_by_actionscript to determine which clips to remove when the rewind happens. Looks like Flash checks the depth value, removing anything at <AVM_DEPTH_BIAS.

Sample: test3.zip

The game uses ex.swapDepths(-2) to put the Xs and Os on a timeline depth, so they get removed by FP when it rewinds. (This means that the removeMovieClip calls in the game are pointless!)

waspennator commented 1 year ago

Still happening as of latest nightly.

waspennator commented 7 months ago

Still happening with latest nightly of 2024.