LOVEConsole

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
Catlinman
Prole
Posts: 3
Joined: Tue Feb 17, 2015 7:42 pm
Location: Germany
Contact:

LOVEConsole

Post by Catlinman »

Hey there,
I recently wrote a little console system for LÖVE2D which allows for easier debugging and game management during the developing process of LÖVE2D applications. Since I mainly intended to use it for my own personal projects but still made it open source, as I do with most of my work (got to spread the love you know), I decided that some of you here might also find some kind of use for this system at some point.

Here's what the console looks like when you run it from the main.lua included in the project's GitHub repository and execute the help command:

Image

Anyway, if you don't know what a console is - if you've ever played a game based on the Source Engine for instance you should know that there is something similar to a command line that allows you to edit variables and generally debug as well as edit the game in question. This is pretty much what LOVEConsole does. The entire console is completely editable and can be customized to death so to say. This means that if you feel hipster enough you could even replace the console's main font with say Comic Sans - yes someone already did that. Other than that the console allows you to execute native Lua commands as well as commands specifically prepared to be used in LOVEConsole. Additionally, the console also displays an optional but by default enabled widget that shows the number of warnings and errors that have been printed to the console so you can keep track of events even when the console is closed. This is especially useful when working or running a game in fullscreen since it removes the need to constantly alt-tab to the default LÖVE output console for information on game events.

If you're interested in trying it out you can grab it from GitHub

On the GitHub page you will also find some more advanced documentation and a guide to getting the system started if you are a newcomer to LÖVE2D and don't really know right off the bat what to do.

I hope you find some good use in this!
User avatar
SuperZazu
Citizen
Posts: 56
Joined: Sun Jun 10, 2012 2:06 pm
Location: France
Contact:

Re: LOVEConsole

Post by SuperZazu »

I like it :-)

But, why did you choose the make the module globally available ?

Also, you could make your code shorter using things like:

Code: Select all

consoleActive = not consoleActive
instead of...

Code: Select all

if consoleActive == false then
	consoleActive = true
else
	consoleActive = false
end
User avatar
Catlinman
Prole
Posts: 3
Joined: Tue Feb 17, 2015 7:42 pm
Location: Germany
Contact:

Re: LOVEConsole

Post by Catlinman »

SuperZazu wrote: But, why did you choose the make the module globally available ?
I'm not sure what you mean with making the module globally available. Thanks for that code snippet though. I tend to forget the simple things. Well not really - I just forgot that you can do that particular assignment in Lua so thanks for reminding me :)
User avatar
rmcode
Party member
Posts: 454
Joined: Tue Jul 15, 2014 12:04 pm
Location: Germany
Contact:

Re: LOVEConsole

Post by rmcode »

Nice work Catlinman! Going to try this out when I get back home.

I think what SuperZazu meant was returning a local table, instead of having your console live in a global variable. It usually doesn't take much to change this.

Code: Select all

-- Localised Module.
local foo = {};

function foo.bar()
    -- ...
end

return foo;

-- Require module in other file.
local Console = require('Console');
User avatar
Catlinman
Prole
Posts: 3
Joined: Tue Feb 17, 2015 7:42 pm
Location: Germany
Contact:

Re: LOVEConsole

Post by Catlinman »

Alright I see what you two are talking about. I'll get to that as soon as I can so keep an eye out for a new commit to the GitHub repository.

The main reason I didn't do that is that I usually declare most of my game systems and libraries in the global scope since I usually know exactly how I am going to interact with them and what variables I reserve for them. You have a good point though since this is a system that should be extendable and I put a lot of emphasis on that fact so neglecting the option of actually specifying the console variable is pretty silly.

Anyway, will get to it as soon as possible. Thanks for the feedback.
Post Reply

Who is online

Users browsing this forum: No registered users and 87 guests