Add speedrun ghost mode#3805
Open
Davi-Azeredo wants to merge 2 commits into
Open
Conversation
Add an optional speedrun mode where the player can race against a translucent replay of their best run in each level. The ghost follows the recorded movement and animations, but remains purely visual and does not interact with physics or world objects. The HUD timer also shows whether the player is ahead or behind the ghost during the run. Co-authored-by: Baltazar Reis <baltazar.reis@tecnico.ulisboa.pt>
tobbi
reviewed
May 29, 2026
| } // namespace | ||
|
|
||
| void | ||
| LevelTile::set_best_ghost_run(std::vector<GhostRunPoint> best_ghost_run) |
Member
There was a problem hiding this comment.
Can you pass this by reference, please?
tobbi
reviewed
May 29, 2026
|
|
||
| inline const std::vector<GhostRunPoint>& get_best_ghost_run() const { return m_best_ghost_run; } | ||
| inline bool has_best_ghost_run() const { return !m_best_ghost_run.empty(); } | ||
| void set_best_ghost_run(std::vector<GhostRunPoint> best_ghost_run); |
Member
There was a problem hiding this comment.
...and change the parameter type here as well.
tobbi
reviewed
May 30, 2026
| static const float TELEPORT_SPEEDUP = 3.18f; | ||
|
|
||
| GameSession::GameSession(Savegame* savegame, Statistics* statistics) : | ||
| GameSession::GameSession(Savegame* savegame, Statistics* statistics, std::vector<worldmap::LevelTile::GhostRunPoint> best_ghost_run) : |
Member
There was a problem hiding this comment.
I think this should pass the vector by reference as well.
Author
|
Sorry for the delay! I have now switched to reference instead of making new copies of the vector, which yeah I think is way cleaner. Thanks for the input! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add optional SpeedRun ghost mode
This PR adds an optional speedrun mode where the player can race against a translucent replay of their best completed run in each level.
When enabled, the game records the player’s run and saves the best replay per level. On later attempts, a translucent ghost replays that run, including movement, direction, bonus state, and sprite animations.
The ghost is purely cosmetic and does not interact with physics, enemies, tiles, or world objects.
The HUD timer now also gives live feedback while racing the ghost, showing whether the player is ahead or behind with a time delta. The best replay is updated automatically whenever the player finishes the level faster.