Hot reload / live coding?

is this possible? (this is a killer feature to me! :smiley: )

1 Like

Yes, it is working!! And it is a killer feature, you can use it (as far as I can see right now) to modify your update loop.

(…and change your game rules :open_mouth:, that really is a killer feature, I’m currently wondering why I’m not using it more often :thinking: ).

So, but just as depicted in the article, no class field refactoring etc.

I’m pondering how can you inject some code to be only executed once, since you can only hot-reload what is inside of update (I guess? :thinking: )

(btw welcome back, rahil :wink: :sun_with_face: )

1 Like

Oh this is an idea how you can inject code only once I guess

class HotReload01 extends hxd.App {
    var hotreload_version : Int = 0;
    static function main() { new HotReload01(); }
    override function init() {}
    override function update(dt:Float) {

        if( hotreload_version == 0 ) // for every new hot-reload increase 0 by one here (by hand)

        // your game rules here ...
    function callOnce() {
        // some code here ... (to only be executed once)
        // like e.g.: player.lifepoints = 1000
        trace('Hot-reload is now version = $hotreload_version');

after every recompile you just change this line of code by hand to
if( hotreload_version == 1 )
if( hotreload_version == 2 )
if( hotreload_version == 3 )

1 Like

Ahhhhh @AlienBuchner !!! <3 <3

Yes… it’s been a few lifetimes. I had to move country post-pandemic. Life happens. It’s all so stupid. I’m still not settled!

But recently, I was playing an old game “Tetris Attack” (Puzzle League series) emulated through a physical arcade cabinet; It re-ignited my love for games. I thought about quickly re-making it in Haxe/Heaps but i discovered it was already remade in love2d/lua: Anyway, it’s got me in the mood for making and perfecting some old forgotten classic multiplayer competitive games. :smiley:

That’s such great news about hot reloading!!! You must be a pro game maker by now! Wow. :smiley:

Glad to hear from you!