Store partially compressed game inputs for reconcatenation

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

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
30/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
lua
Domain
backend

Research direction

Start by tracing where the server stores player inputs and handles a spectator request, then inspect how inputs are concatenated and compressed. Keep the compressed portion available for later spectator requests and verify that appending newly compressed inputs produces a valid replay without recompressing prior inputs.

Written by the indexing model from the issue text.

Description

enhancement priority: 2 - low Server-side

Currently the server holds the player inputs in a table.
When a player requests spectate, the server concatenates all inputs so far, compresses them and puts them in a partial replay that is sent to the new spectator.
The result of the concatenation is discarded.
This discard is unnecessary with the way compression is used.

Assume the following inputs when the spectator requests first:
AAAAggggAABBFE
This compresses to A4g4A2B2F1E1
Later another spectator joins and the full inputs are now:
AAAAggggAABBFEEEABBBBBFlkkkkggggggggiiiiigggggiiiiigggggiiiiiiigg
the only new inputs are
EEABBBBBFlkkkkggggggggiiiiigggggiiiiigggggiiiiiiigg and would compress to E2A1B5F1I1k4g8i5g5i7g2 on its own

The concatenation of two sections of inputs concatenate to the valid compressed string
A4g4A2B2F1E1E2A1B5F1I1k4g8i5g5i7g2
Every single concatenation for a new spectator can be expected to only add 2-3 character worth of string but avoids redoing previous work.

This is probably not really important with the current state of things but it makes things slightly easier for the server when people join as spectators on long matches.

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.