Make the outcome of raise tapping more predictable

Open
#663 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
lua
Domain
game-dev

Research direction

The issue names no files or tests; start by locating the simulation code for passive and manual raise and how it updates displacement and the rise timer. Check issue #554 first, since this issue is blocked by it. Add test cases for consecutive taps and a single tap that reaches a new row; done means the tests establish predictable raise behavior and the manual-raise logic no longer relies on a deferred passive raise.

Written by the indexing model from the issue text.

Description

blocked bug Cleanup engine needs repro Pending-engine-update priority: 1 - middle

Blocked by #554

Raising is generally implemented for tap style use: One tap on raise and the game will raise to the next full row.

There are however two use cases that seem subtly broken for every day use with a tap approach:

Raise inputs are blocked for 1 frame right before completing the manual raise

There is a weird implementation detail that causes the manual raise to just stop on the last frame before the row has fully risen and sets the rise timer to 1 so that the actual completion of the raise is performed by passive raise at the start of the next frame and blocks a manual raise on that frame.
This means that when tapping raise twice in a row with the intention of raising by 2 rows, if the second tap lands on that blocked frame you will only get one row even though you tapped twice.

A single raise input may raise more than 1 row

This is mostly the same implementation detail as the other one: A manual raise is considered "complete" on the frame before the next row rises where manual raise is blocked. That means when a manual raise results in displacement 0 and a new row being generated, the manual_raise field is not cleared after that first new row and instead a second one is being raised.
It is not quite as critical as the assumption that a player wants a second row in that situation is not too far off (on most levels they'd have to wait a few frames for the row to raise passively after all) but I feel it might be more correct to clear the on-going raise and just immediately reapply it if the player is still holding raise.

Implementation details

Passive and manual raise are mutually exclusive. Their results on the stack are generally the same besides two differences:

Rise timer

A finished raise through passive raise sets the rise timer to its new value according to the Stack's speed. A manual raise does not - but only because because all manual raising ends with a passive raise at the moment so this is very fixable.

Order of operations

The order of operation within the simulation is the following:

  1. Passive raise
  2. Panel updates
  3. Manual raise

The interesting thing here regarding exclusivity is the following:
When starting a manual raise on a frame that would have naturally resulted in a new row with the next passive raise the generation of the new row is delayed by a frame for the purpose of panel physics (e.g. ghost matches happen 1 frame later) because passive raise sits in front and is cancelled but manual raise sits behind panel updates.

In case no ghost match happens this is then compensated at the end of the manual raise where the final decrement of displacement is deferred to the next passive raise instead of manual raise:
At displacement 2 we get a panel update, then displacement first reduces to 1 due to the manual raise logic and then to displacement 0 due to the passive raise before the next panel update happens.

Why I think this is wrong

The main reason why I think this is incorrect behaviour however is that the stack is reacting differently to inputs with the same timing in relation to the displacement depending on whether there was a previous raise or not and that while doing so it does not distinguish between a held raise and tapped raise:
Tapping at displacement 0 and then at displacement 1 results in 1 row being raised because the second tap is ignored.
But tapping at displacement 1 also results in 1 row because it is not being ignored.

I believe in the case of tapping it would be most reasonable to interpret two disconnected raise taps as individual raise inputs and not ignore the second based on the presence of the first. In a case with holding raise instead, the current behaviour could be considered as an interpretation that is not incorrect but I believe in the tap scenario it should absolutely chain right into a second row being raised.

In consideration of #39 it would also be imaginable to generally queue up another raise when a new raise tap is detected, even while a raise is still in an earlier state of the process to require a bit less accuracy on the player end and tap twice for two rows without careful timing.

Fixing manual raise

Create test cases verifying the assumed behaviour

Remove "needs repro" label once done.

Resolving order of operations

The displacement accelerating/stuttering on the transitions between manual/passive raise in some cases would easily be resolved by placing passive and manual raise together within the simulation.
While the phenomenon itself is not problematic right now, in combination with e.g. #437 it could lead to subtle bugs where in some scenarios pressing raise together with a swap while topped out would allow you to queue up another swap that you would not have gotten under usual circumstances.

Having manual raises finish without deferring to passive raise

Once the order of operation has been resolved, there is no longer a good reason for manual raise to not just finish up rather than deferring; the deferrence was only necessary to compensate the initial delay after all.
This should simplify the logic quite a bit as the use-cases of passive and manual raise become truly disconnected from each other besides the exclusivity.

Cleanup

The code for manual raise across multiple frames is one hot mess so a good opportunity to clean that up.

Dominant language
Lua
Stars
30
Forks
20
Avg merge
3d 15h
Merged PRs (30d)
17

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from panel-attack/panel-game

All issues in panel-attack/panel-game

Similar issues

More Lua issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.