Skip to content

[game] Process more than one action per frame - #315

Open
modawan wants to merge 1 commit into
masterfrom
execute-actions
Open

[game] Process more than one action per frame#315
modawan wants to merge 1 commit into
masterfrom
execute-actions

Conversation

@modawan

@modawan modawan commented Aug 22, 2026

Copy link
Copy Markdown
Owner

We used to execute up to 1 action per frame. With a high dt
multiplier, a single frame takes ~100ms (virtual time, 8x dt). For a
busy queue of multiple actions (script continuations, for example), it
is possible that processing actions one by one will take much longer
than for a queue of a single action.

With DelayCommand actions, it is crucial that they execute in the same
relative order, even when pushed to different queues. With the "1
action per frame" limitation, it is possible that commands in a busy
queue can be delayed for so long, they effectively execute
out-of-order relative to a command in a single action queue, for
example.

This happens with k_pebn_pophawk and k_pebo_carthtlk when running
with 8x dt multiplier:

  • k_pebn_pophawk spawns Carth with a 0.5s delay (module queue).
  • k_pebo_carthtlk starts a dialogue with 1.0s delay (trigger queue).

The module queue contains other delayed commands, so it takes a few
frames to process them. The trigger queue only has 1 action, so it can
execute before the module queue actually gets to execute the spawn
command.

We used to execute up to 1 action per frame. With a high dt
multiplier, a single frame takes ~100ms (virtual time, 8x dt). For a
busy queue of multiple actions (script continuations, for example), it
is possible that processing actions one by one will take much longer
than for a queue of a single action.

With DelayCommand actions, it is crucial that they execute in the same
relative order, even when pushed to different queues. With the "1
action per frame" limitation, it is possible that commands in a busy
queue can be delayed for so long, they effectively execute
out-of-order relative to a command in a single action queue, for
example.

This happens with `k_pebn_pophawk` and `k_pebo_carthtlk` when running
with 8x dt multiplier:

  - `k_pebn_pophawk` spawns Carth with a 0.5s delay (module queue).
  - `k_pebo_carthtlk` starts a dialogue with 1.0s delay (trigger queue).

The module queue contains other delayed commands, so it takes a few
frames to process them. The trigger queue only has 1 action, so it can
execute before the module queue actually gets to execute the spawn
command.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant