Hot reloading code at runtime?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
ddabrahim
Party member
Posts: 201
Joined: Mon May 17, 2021 8:05 pm
Contact:

Hot reloading code at runtime?

Post by ddabrahim »

Hi all!

I've been playing with the idea to integrate a code editor in to my system and being able to code my game in-game kinda.
I did get as far to being able to code and run the code and then quit the game, change code and run the game again.

However it would be more practical and more interesting if I didn't have to quit the game to change the code, instead hot reload the code.
Would anyone have any recommendations how to go about this?

One thing I have considered is to simply, save the state of the game with the new parameters, reload with the new parameters and load the state. So it is not really hot reloading anything, only make it looks like it does. But in reality I only restart the game with new parameters.

An other approach I think could possibly be using threads. I did play around with threads but my problem is that it would require me to refactor my entire system in to threads and I am not ready to do that. But maybe I should.

I would appreciate any recommendations you have.
Thank you.
User avatar
dusoft
Party member
Posts: 635
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: Hot reloading code at runtime?

Post by dusoft »

Check: https://github.com/usysrc/LICK
or this: https://github.com/clofresh/love-module

But as I understand you would rather take a snapshot (object state dump) and then reload that dump with the new code. Anyway, these two libs can help.
User avatar
Nikki
Citizen
Posts: 86
Joined: Wed Jan 25, 2017 5:42 pm

Re: Hot reloading code at runtime?

Post by Nikki »

I've had some success with :
https://github.com/rxi/lurker
User avatar
ddabrahim
Party member
Posts: 201
Joined: Mon May 17, 2021 8:05 pm
Contact:

Re: Hot reloading code at runtime?

Post by ddabrahim »

Thanks a lot. I'm going to have a look at these libs.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 5 guests