Hot Reload

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
racarate
Prole
Posts: 34
Joined: Wed May 02, 2012 12:37 pm

Hot Reload

Post by racarate »

Hey everybody!

I just watched this video:

http://vimeo.com/36579366

and I also re-watched a little bit of Notch's Ludum Dare 22 live stream, and both environments seem to rely on code updating without restarting the program.

I imagine this is possible with LOVE2D -- has anybody tried it?


-Nick
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Hot Reload

Post by Robin »

I haven't tried it, but I think it should be possible if you have a scaffolding in your main.lua, and the actual game is located in a subdirectory or something.

It would probably be a good idea to reload the code once focus has been returned to the game:

Code: Select all

function love.focus(f)
    if f then
        -- reload code
    end
    fakelove.focus(f) -- this calls the love.focus in the game
end
Help us help you: attach a .love.
User avatar
Petunien
Party member
Posts: 191
Joined: Fri Feb 03, 2012 8:02 pm
Location: South Tyrol (Italy)

Re: Hot Reload

Post by Petunien »

There's a library called LICK: https://github.com/headchant/lick
It enables live coding for LÖVE.

But it doesn't work that well on all projects, respectively on advanced ones.
"Docendo discimus" - Lucius Annaeus Seneca
User avatar
Inny
Party member
Posts: 652
Joined: Fri Jan 30, 2009 3:41 am
Location: New York

Re: Hot Reload

Post by Inny »

I had a thread about this recently (it's on page 2, link), and the summary of it is basically use LICK, or use the love.load version that accepts an arg table parameter, and read out an option that'll move you to the level you wanted to test. I think I like the second option better.

live-coding still sounds sweet though, if you figure out anything, let us know.
paulclinger
Party member
Posts: 227
Joined: Thu Jun 28, 2012 8:46 pm

Re: Hot Reload

Post by paulclinger »

I have live coding in the IDE I've been working on ZeroBraneStudio and did a screencast based on Bret Victor's presentation about three months ago (http://notebook.kulchenko.com/zerobrane ... ctor-style). The IDE also provides Löve integration and the same live coding can be used with Löve too, as shown in this screencast: http://notebook.kulchenko.com/zerobrane ... -with-love.

The mechanism is different from Lick as the application doesn't have any Löve specific logic and runs under a "normal" debugger, which has its own advantages and disadvantages. The main disadvantage is that I can't intercept run-time errors at the moment (which is something I'm working on). All the compilation errors are intercepted and reported in the IDE.
Last edited by paulclinger on Fri Sep 21, 2012 2:51 am, edited 1 time in total.
User avatar
racarate
Prole
Posts: 34
Joined: Wed May 02, 2012 12:37 pm

Re: Hot Reload

Post by racarate »

Thanks for all the replies! Looks like I have a lot of reading to do...
User avatar
dusoft
Party member
Posts: 687
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: Hot Reload

Post by dusoft »

racarate wrote:Thanks for all the replies! Looks like I have a lot of reading to do...
This enables hot reload:
package.loaded[state]=false
require(state)

state = e.g. "main"
User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: Hot Reload

Post by josefnpat »

I'm surprised no one mentioned RXI's Lurker project

https://github.com/rxi/lurker
Missing Sentinel Software | Twitter

FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
User avatar
dusoft
Party member
Posts: 687
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: Hot Reload

Post by dusoft »

josefnpat wrote:I'm surprised no one mentioned RXI's Lurker project

https://github.com/rxi/lurker
very nice, josefnpat! basically same idea as mine, just somebody spent more time on prototyping it for actual debugging :-)
User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: Hot Reload

Post by Ranguna259 »

LICK is outdated, LoveDebug uses LICK's (updated) code for hotswapping.
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 14 guests