Skip to content

[ENHANCEMENT] Rework how hot reloading behaves - #7921

Open
nykwono wants to merge 1 commit into
FunkinCrew:preview/public-playtestfrom
nykwono:hot-reloading-behaviour-rework
Open

[ENHANCEMENT] Rework how hot reloading behaves#7921
nykwono wants to merge 1 commit into
FunkinCrew:preview/public-playtestfrom
nykwono:hot-reloading-behaviour-rework

Conversation

@nykwono

@nykwono nykwono commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Fixes issues:
Funkin#7915

Right now hot-reloading behaves really finicky as it simply just loads the state's constructor.
Because of this, there are a couple bugs like:

  • Hot-reloading in PlayState doesn't update the song script (This is because after hot-reloading, PlayState updates its params but it isn't accounted for now.)
  • You aren't really able to playtest charts anymore in the Chart Editor.

This PR reworks how hot-reloading is handled, attempting to give states more control of its behavior by:

  • HotReloadState is now initialized given a HotReloadStateParams object containing:
    • onComplete callback for after hot-reloading is finished.
    • targetState for the state to go to after finishing (Defaults to the state's constructor).

If targetState is null, it'll first assume that onComplete is the one handling state switching, else it fallbacks to going back to the TitleState.

  • States now have functions onPreHotReload(), onPostHotReload(), & getHotReloadParams
    • onPreHotReload() is called right before hot-reloading begins, allowing states to save any necessary information needed.
    • onPostHotReload() is called right after hot-reloading is finished and create() is called when the state is initialized.
    • getHotReloadParams() is a function that states can override incase they have a specific way they want to hot-reload (For ex. PlayState doesn't use targetState to hot-reload and instead utilizes onComplete() to switch back.)

With this rework, the above issues are fixed and you're now able to go into a chart and playtest it with it saving.

Courtesy of @ComedyLost for helping with fixing this issue!

Co-Authored-By: ComedyLost <106041578+ComedyLost@users.noreply.github.com>
@github-actions github-actions Bot added status: pending triage Awaiting review. size: large A large pull request with more than 100 changes. pr: haxe PR modifies game code. and removed size: large A large pull request with more than 100 changes. labels Aug 12, 2026
@NotHyper-474 NotHyper-474 added type: enhancement Involves an enhancement or new feature. size: large A large pull request with more than 100 changes. labels Aug 12, 2026
@realvirtu

Copy link
Copy Markdown
Contributor

ENHANCMENET

@nykwono nykwono changed the title [ENHANCMENET] Rework how hot reloading behaves [ENHANCEMENT] Rework how hot reloading behaves Aug 12, 2026
@nykwono

nykwono commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

ENHANCMENET

it was 3am when i made this PR I call this harassment 🥀 🥀 🥀 🥀 🥀 🥀

@EliteMasterEric

Copy link
Copy Markdown
Member

I'll review this more thoroughly later but it seems well thought out

@Hundrec Hundrec linked an issue Aug 19, 2026 that may be closed by this pull request
4 tasks
@AbnormalPoof
AbnormalPoof force-pushed the preview/public-playtest branch from 401b06b to 2e7f104 Compare August 20, 2026 03:25
@Hundrec
Hundrec force-pushed the preview/public-playtest branch from fff3525 to 25ad66b Compare August 21, 2026 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: haxe PR modifies game code. size: large A large pull request with more than 100 changes. status: pending triage Awaiting review. type: enhancement Involves an enhancement or new feature.

Development

Successfully merging this pull request may close these issues.

Bug Report: Song scripts do not reload correctly while in PlayState

4 participants