Store off-screen chain garbage more efficiently

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

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Stale
Tech stack
lua

Research direction

Start by tracing regular panel updates and how rollback data stores panel state; the issue does not name specific files or tests. Check how off-screen chain garbage is represented and how panels are generated when the top row is full. Done means off-screen garbage beyond stack height + 4 is stored as an integer, required panels are generated with the propagatesFalling flag, and the omitted garbage count is included in rollback data.

Written by the indexing model from the issue text.

Description

engine enhancement priority: 2 - low

Currently off-screen garbage panels are stored with the full level of detail and the same is true for rollback data.
This can lead to significant memory allocations when players chain-tennis to chain lengths beyond x1000.

Based on the pessimistic pooling strategy for rollback memory that is meant to prevent negative performance effects from rollback, when this happens online or in a replay, all the memory allocated for rollback is fed back into the pool which can make PA take (relatively) big amounts of memory: orangetriangle reported near 4GB after watching a replay with a x1264 chain.

The memory lingering after is not even so terrible but it indicates that on weaker machines with little RAM the game could simply run out of memory and start hitting the swap which would likely result in an unplayable experience. Which - again - should only be relevant for online play as rollback isn't active in local play.

A solution could make it so that regular panel updates only run to stack height + 4 and extra lines of off-screen chain garbage beyond that are expressed as only an integer. The corresponding panels would need to be generated whenever the top row is full with empty panels with the propagatesFalling flag after panels have been updated for that frame.
The field for storing the omitted off-screen garbage would need to be added to rollback data.

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.