Lovebird : A browser-based debug console

Showcase your libraries, tools and other projects that help your fellow love users.
rxi
Prole
Posts: 47
Joined: Sun Mar 02, 2014 10:22 pm

Lovebird : A browser-based debug console

Post by rxi » Wed Apr 16, 2014 8:16 pm

Lovebird is a browser-based debug console for LÖVE.

Image

Check out the README for instructions on how to get it set up.

The github repo is over here: https://github.com/rxi/lovebird

Once you have it running you can enter lua commands into the input box at the bottom, these will be run immediately. All print output will be printed to the output console.

At the right side of the page you can browse the globally accessible environment. This shows each variable name with its value next to it. If you click a variable's value its name will be inserted into the input box; this allows you to, for example, click a variable's value and type "= 10" to set that variable to 10.

Lovebird should work wherever LuaSocket is available -- this includes both LÖVE 0.8 and 0.9.
Last edited by rxi on Sat Jun 28, 2014 2:35 pm, edited 2 times in total.

User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: Lovebird : A browser-based debug console

Post by josefnpat » Wed Apr 16, 2014 8:24 pm

+1, I tried this out earlier, and it's fantastic.
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
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: Lovebird : A browser-based debug console

Post by Ranguna259 » Wed Apr 16, 2014 10:41 pm

This is actually really cool, modifying variables remotly :P
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.

rdlaitila
Prole
Posts: 8
Joined: Tue Nov 01, 2011 5:26 pm

Re: Lovebird : A browser-based debug console

Post by rdlaitila » Thu Apr 17, 2014 12:02 am

Holy ****

Nice work! Booted this up on one of my very complex projects that has a lot of nested tables and functions. Almost immediately I was able to find and fix temporary variables that were leaking into the global ENV just by exploring the right side nested variable explorer.

Well done. I would really like to see this project mature.

User avatar
Fenrir
Party member
Posts: 222
Joined: Wed Nov 27, 2013 9:44 am
Contact:

Re: Lovebird : A browser-based debug console

Post by Fenrir » Thu Apr 17, 2014 8:12 am

Well done, it's fantastic!

User avatar
Clavus
Prole
Posts: 28
Joined: Wed Jan 27, 2010 12:45 pm

Re: Lovebird : A browser-based debug console

Post by Clavus » Fri Apr 18, 2014 1:33 pm

This is pretty neat. One problem though. I notice that when running my game, the thread constantly stalls for a quarter of a second. I traced this down to the client:receive() call on line 540 here: https://github.com/rxi/lovebird/blob/ma ... vebird.lua

It might be worth making the lua socket calls asynchronous so it doesn't block the main thread?

Edit: setting the socket timeout to 0 seems to work well enough (line 577) for not making the socket block the thread.

rxi
Prole
Posts: 47
Joined: Sun Mar 02, 2014 10:22 pm

Re: Lovebird : A browser-based debug console

Post by rxi » Fri Apr 18, 2014 6:53 pm

Clavus wrote:[...] One problem though. I notice that when running my game, the thread constantly stalls for a quarter of a second. I traced this down to the client:receive() call on line 540 here: https://github.com/rxi/lovebird/blob/ma ... vebird.lua

It might be worth making the lua socket calls asynchronous so it doesn't block the main thread?

Edit: setting the socket timeout to 0 seems to work well enough (line 577) for not making the socket block the thread.
I intentionally wrote lovebird to use blocking sockets for the sake of simplicity, if I were to handle things asynchronously it would have unfortunately added unneeded complexity and potentially improved nothing. In my testing, unless you were doing something like displaying 10,000, variables in the env browser then any latency tended to be unnoticeable, and in the games I tested the framerate would stay at a good number -- I even timed how long the socket would block for during normal usage to be sure it wouldn't be an issue. Additionally, from the people who have tested it, with different browsers, operating systems and versions of love, I hadn't heard of the blocking sockets being an issue.

Given this, I suspect your particular setup may be doing something a out-of-the-ordinary. Be it your operating system, browser, or some kind of internet-security software or plugin you're running.

I wouldn't have expected setting the socket to a timeout of zero would have worked at all -- I assumed you meant that it began working after doing this? On my setup, if I do this, the calls to receive() timeout before I even get any data and so the page is never displayed, which is what I would expect. I also can't see any reason this would fix the issue, assuming everything is running correctly. The sockets should stop blocking as soon as they receive their expected data -- if you're connecting from your localhost, the socket should only block for milliseconds.

If your work-around works for you then you may have to just stick with zeroing the timeout whenver you update the module. If other people encounter the same issue as you've described I'll try looking into it further, but as it is I don't think it'll be worth the difficulty to try and work out the issue, given its an issue I cannot recreate. If you want to you can try using a different browser or computer to see if you still get the same issue, then report back; this may give me a clue to what is going on.

User avatar
Lap
Party member
Posts: 256
Joined: Fri Apr 30, 2010 3:46 pm

Re: Lovebird : A browser-based debug console

Post by Lap » Fri Apr 18, 2014 7:52 pm

First off, nice choice of name...very fitting.

Secondly, I have been looking for something that would let me easily explore and change variables for years. There's a few other programs and IDE's that already exist but none of them do as good a job as Lovebird does. It's extremely easy to set up, it shows everything I could possibly need and it does so cleanly and quickly. A lot of other implementations are a huge pain to set up (and break from love version to love version), are harder to navigate the variables, or bring the FPS down to a crawl.

rxi, you are awesome.

User avatar
Clavus
Prole
Posts: 28
Joined: Wed Jan 27, 2010 12:45 pm

Re: Lovebird : A browser-based debug console

Post by Clavus » Fri Apr 18, 2014 9:21 pm

rxi wrote:I intentionally wrote lovebird to use blocking sockets for the sake of simplicity, if I were to handle things asynchronously it would have unfortunately added unneeded complexity and potentially improved nothing. In my testing, unless you were doing something like displaying 10,000, variables in the env browser then any latency tended to be unnoticeable, and in the games I tested the framerate would stay at a good number -- I even timed how long the socket would block for during normal usage to be sure it wouldn't be an issue. Additionally, from the people who have tested it, with different browsers, operating systems and versions of love, I hadn't heard of the blocking sockets being an issue.

Given this, I suspect your particular setup may be doing something a out-of-the-ordinary. Be it your operating system, browser, or some kind of internet-security software or plugin you're running.

I wouldn't have expected setting the socket to a timeout of zero would have worked at all -- I assumed you meant that it began working after doing this? On my setup, if I do this, the calls to receive() timeout before I even get any data and so the page is never displayed, which is what I would expect. I also can't see any reason this would fix the issue, assuming everything is running correctly. The sockets should stop blocking as soon as they receive their expected data -- if you're connecting from your localhost, the socket should only block for milliseconds.

If your work-around works for you then you may have to just stick with zeroing the timeout whenver you update the module. If other people encounter the same issue as you've described I'll try looking into it further, but as it is I don't think it'll be worth the difficulty to try and work out the issue, given its an issue I cannot recreate. If you want to you can try using a different browser or computer to see if you still get the same issue, then report back; this may give me a clue to what is going on.
I have no idea why it works like it does. But my benchmarks were pretty clear that it hung for about 200 milliseconds on the socket receive() call, every few seconds. Setting the timeout to 0 seems to work for me, as lovebird is still displaying everything I print.

As for my project I'm using it in, I'm building a framework that I plan to use during Ludum Dare next week. There's no game yet. The global environment has about 80 references in it, so that shouldn't really be the issue.

I also tested it in Internet Explorer to see if Chrome is the problem, but the same thing happened. As for the rest: Windows 8. Using LÖVE 0.9.1 x86.

Also, now that it's working for me, I've got to say that this is a great tool. Thanks for all the effort :)

rxi
Prole
Posts: 47
Joined: Sun Mar 02, 2014 10:22 pm

Re: Lovebird : A browser-based debug console

Post by rxi » Fri Apr 18, 2014 9:43 pm

Lap wrote:First off, nice choice of name...very fitting.

Secondly, I have been looking for something that would let me easily explore and change variables for years. There's a few other programs and IDE's that already exist but none of them do as good a job as Lovebird does. It's extremely easy to set up, it shows everything I could possibly need and it does so cleanly and quickly. A lot of other implementations are a huge pain to set up (and break from love version to love version), are harder to navigate the variables, or bring the FPS down to a crawl.

rxi, you are awesome.
Thanks! It's good to see people are finding it useful.

Clavus wrote:[...]
As for my project I'm using it in, I'm building a framework that I plan to use during Ludum Dare next week. There's no game yet. The global environment has about 80 references in it, so that shouldn't really be the issue.

I also tested it in Internet Explorer to see if Chrome is the problem, but the same thing happened. As for the rest: Windows 8. Using LÖVE 0.9.1 x86.

Also, now that it's working for me, I've got to say that this is a great tool. Thanks for all the effort :)
I'm glad your work around has managed to get it to work for you, though it is a shame that it isn't a fix I could add to the project. I wonder if anyone else using Windows 8 and LÖVE 0.9.1 is experiencing the same behaviour.

Good luck with the Ludum Dare! I'm planning on participating too.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests