Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timing Bug: Wait commands and event movement off by 1 frame #1623

Closed
fmatthew5876 opened this issue Feb 7, 2019 · 4 comments

Comments

@fmatthew5876
Copy link
Contributor

commented Feb 7, 2019

Create a map event with trigger = parallel and anim_type = continuous

Set this code

WAIT
OpenSaveMenu

Chunks of the event with different WAIT's at the time you save

WAIT RPG_RT stop count Player stop count RPG_RT anim_count Player anim_count RPG_RT anim frame Player anim frame
1 1 1 1 1 1
0.0s 2 1 2 1 1 1
0.0s, 0.0s 3 2 3 1 2 1
0.1s 7 6 1 2 0 2
1.0s 61 60 1 3 0 3

So there is an off by 1 error somewhere as shown in stop_count and anim_count. Either we're really waiting -1 frames or the order of updates with when the wait starts/ends is wrong somehow.

The anim_count results were taken with #1601 as master has these completely wrong to begin with.

@Ghabry Ghabry added the Move Routes label Feb 12, 2019

@fmatthew5876 fmatthew5876 referenced this issue Feb 16, 2019
112 of 113 tasks complete
@fmatthew5876

This comment has been minimized.

Copy link
Contributor Author

commented Feb 17, 2019

This bug looks like it only happens when the first thing you do in the event code is wait.

For example, the below code works correctly

OpenSaveMenu
WAIT
OpenSaveMenu

I put some logs of the wait count and the frame count

Debug: SETUP WAIT 60 50
Debug: WAIT FOR WAIT WAIT 59 50
Debug: WAIT FOR WAIT WAIT 58 50  ❗️ 
Debug: WAIT FOR WAIT WAIT 57 51 

So we run the interpreter twice in the same frame here somehow.

@fmatthew5876

This comment has been minimized.

Copy link
Contributor Author

commented Feb 17, 2019

For further investigation, I made a test with the code

  1. Make this code
Show Picture
Loop: 
  Wait
Event Type Result
Parallel Map Event Picture appears before transition in
Autostart Map Event Picture appears after transition in
Common parallel Picture appears before transition in
Autostart common Picture appears after transition in
  1. Now put a vehicle on the map and change the code to this:
OpenSaveMenu
Event Type Player stop count Vehicle stop count Event stop count
Parallel Map Event 0 0 1
Autostart Map Event 1 1 1
Common parallel 0 0 1
Autostart common 1 1 2
  1. Now I change the code to this:
SetMoveRoute: Event, Move Right
OpenSaveMenu
Event Type stop count max stop count remaining step
Parallel Map Event 0 64 240
Autostart Map Event 65535 64 0
Common parallel 0 64 240
Autostart common 65535 64 0
Action Map Event 65535 64 0
Touch Map Event 65535 64 0
Collission Map Event 65535 64 0
  1. Now I change the code to this:
Wait 0.0s
SetMoveRoute: Event, Move Right
OpenSaveMenu
Event Type stop count max stop count remaining step
Parallel Map Event 0 64 240
Autostart Map Event 65535 64 0
Common parallel 0 64 240
Autostart common 65535 64 0
Action Map Event 65535 64 0
Touch Map Event 65535 64 0
Collission Map Event 65535 64 0

Hypothesis

  1. There is one special frame that is run before transition in
  • Player movement is not processed
  • Vehicle movement is not processed
  • Event movement is processed
  • Foreground events do not run
  • Background events do run
  1. Parallel events run before event movement is updated

This can be seen with the move routes being animated for a single frame

  1. Autostart map events "get into the foreground" before that event's movement starts

This can be seen in test case (2) where its the 2nd frame (Player stop_count is 1) but event stop count did not tick from 1 to 2.

  1. Autostart event code runs after event movement

This can be seen in the move routes. We setup the move route (stop_count=65535) but we have not animated a frame of movement like we did for parallel.

@fmatthew5876

This comment has been minimized.

Copy link
Contributor Author

commented Feb 17, 2019

Multiple events:

Here is a more revealing test:

  1. Create 2 events with code
OpenSaveMenu
Loop:
  wait
EV1 Trigger EV2 Trigger EV1 stop count EV2 stop count EV1 anim count EV2 anim count EV1 running EV2 running
autorun 2 1 2 2 0 0
parallel 1 1 1 1 0 0
autorun 1 2 2 2 0 0
parallel 1 1 1 1 0 0
parallel parallel 1 1 1 1 0 0
autostart parallel 1 1 1 1 0 0
parallel autostart 1 1 1 1 0 0
autostart autostart 1 1 2 2 0 1
  1. Change the code to this
SetMoveRoute: Other event, Move Right
OpenSaveMenu
Loop:
  wait
EV1 Trigger EV2 Trigger EV1 stop count EV2 stop count EV1 anim count EV2 anim count
autorun 65535 1 2 2
autorun 1 65535 2 2
autorun autorun 1 65535 2 2
  1. Now put the player on a different map

Add a parallel event with

TransferPlayer: Previous Map

For the collision cases, change the teleport to drop the player onto the event.

EV1 Trigger EV2 Trigger EV1 stop count EV2 stop count EV1 anim count EV2 anim count
autorun 65535 1 2 2
autorun 1 65535 2 2
autorun autorun 1 65535 2 2
collision 65535 1 2 2
collision 1 65535 2 2
@fmatthew5876

This comment has been minimized.

Copy link
Contributor Author

commented Mar 13, 2019

This is fixed by #1628, except the very last test case. But thats more than covered by #1606 cases so I consider this fixed when #1628 is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.