Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon

27. September 2012


The author contacted me a few weeks up with a heads up that he had a Moai friendly Lua IDE in development and I said I would look into it… and well, I didn’t.  Things came up, then something else and something else and frankly it got pushed into the back of my mind.  In the end, that was a good thing too, as since that point in time the author has added auto-completion… a critical feature.


As of writing though, this feature is only available from the github sources.  So long as you have cygwin configured ( assuming you are working with Moai, you should already ), and git installed, the process is fairly simple:


cd /cygdrive/c/folder/to/install/to

git clone


This will create a folder ZeroBraneStudio with all the appropriate files. 

EDIT (29/09/2012): Author made update, should no longer need to set permissions described below

There is another catch, git mangles the executable permissions on Windows.  The long answer is well… long, the hackishly easy answer is to run:

chmod a+x –R ZeroBraneStudio


There is one last catch, you need to set the MOAI_BIN environment variable to point to your MOAI host folder, either that or add it to your PATH variable.  ( I suggest the former ).  To set the MOAI_BIN path, simply open a command prompt and type:

setx MOAI_BIN c:/path/to/moai/host


You can of course set the environment variables using the System control panel, but this will require you to reboot your computer for the change to take effect.  SetX simply requires you close the console to take effect.


Now you should be able to run the Studio, just double click zbstudio.exe to start it.  Hopefully the author will have a new release soon, that prevents all of this ( except the MOAI_BIN environment variable that is ).  Finally run ZeroBrane and this is what you see:





So then… why?  What does ZeroBraneStudio bring to the table that SublimeText or IntelliJ don’t have?


That’s an easy one.  I mentioned the first one earlier:




Auto-completion!  After years of using Visual Studio, this one is a gigantic must for me.  Granted as I covered earlier, IntelliJ can be configured to supported auto completion.  But ZeroBrane Studio has a massive head up on IntelliJ, watch this!




This you cannot do with IntelliJ, and it is a gigantic advantage.  But auto-completion isn’t the only thing ZB brings to the table, ZeroBrane Studio has the ability to debug running code!  You can set breakpoints, step in/over and out, set watches and do dynamic expression evaluations, pretty much most of what you expect to see in a debugger. Oddly enough, this needed a Windows Firewall exception.


To debug your code, select a line of text to set a breakpoint then hit F9 to create a breakpoint ( a red stop sign will appear in the margin ).  Then select Project->Start Debugging Server.  Then select Project->Start Debugging or hit F5 to run your code and voila:



Code execution stops at your breakpoint.  Use F10, Ctrl+F10 and Shift+F10 enable you to navigate through your code. You can hover your mouse over a variable to inspect it’s value.  You can also right-click a variable and create a watch window like this:


Unfortunately you can’t drill down into an individual Lua table, but hopefully this feature gets added soon!


Perhaps coolest of all, ZeroBrane Studio enables REPL interaction.  You can open the console and interact with your code directly:



As you can see, you can interact with your values in real time, and here are the results in the output:



It also has the ability to analyze your code, and show you the plethora of stupid mistakes you are making:



Not everything is perfect.  As mentioned earlier, watch expressions cant drill down into Lua tables, hopefully something that will change soon.  Additionally, it would be nice if the Moai host could be added using a configuration setting instead of using MOAI_BIN, as it makes it difficult to change between runtimes ( moai, moai-untz, release, debug, etc… ), but this is a minor point.  It would also be nice to be able to control more via context menu’s ( add breakpoint, step over/in, etc ). The code syntax highlighting could be improved a bit as well.  Of course, as a straight code editor, it isn’t going to give IntelliJ or SublimeText a run for it’s money just yet.



That said, this is an absolutely invaluable tool for people working with Moai or LOVE, the debugger and full auto-completion guarantee that this is going to be a stable part of my toolset going forward.  Hopefully the author is able to add more detailed debugging information soon.  If you are working in Moai or LOVE, you owe it to yourself to check out ZeroBrane Studio.


Speaking of which, you can get more information here.  Keep in mind, MOAI auto-completion is currently only available in the source distribution, at least as of version 0.32.  Hopefully the new release is bundled soon.



I have spoken with the author, and it appears a few of my issues aren’t issues after all.

The system will check for Moai executable in your PATH environment
variable. You can also set "path.moai = 'd:/lua/moai/moai'" in
cfg/user.lua (see cfg/user-sample.lua for example).



ZeroBrane actually can drill down details into a Lua table, in my relative Lua newbishness, I made a pair of mistakes.  First off, it only works on local variables.  Second, Moai does not return tables, it returns Userdata, which ZeroBrane currently can’t parse ( fingers crossed he figures out a way! ).




Here is the behaviour I was expecting to see, and exactly what I got once I defined the table as a local.

General, Programming , , ,

blog comments powered by Disqus

Month List

Popular Comments

New Year, New Project! Or perhaps more accurately, a very old delayed project
Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon

Home > >

7. January 2014


So a new year is upon us; happy belated New Year everyone!



I figure now is as good of a time as any to get off my arse and work on something I have long been delaying… a complete game.  If you go wayyyyyy back in the annals of history, you will find this post.  My original intention with was to document, well… creating a game from scratch!  Somewhere along the way I sort of wandered off course into writing tutorials and books about game programming in general.  Don’t get me wrong, I absolutely loved the adventure and will continue to create future tutorial series ( and probably books ) as I go forward, but I also intend to go ahead and create that game I was talking about!


Funny enough, of the thousands and thousands of game ideas in my head, nearly three years later it’s still the same game that interests me.  I will flesh it out in a bit more detail in later posts.


What does this mean for


Well, first the negatives…  there probably won’t be any massive tutorial series like the C++, LibGDX, MOAI or Blender ones, at least for the next few months.  Truth of the matter is, each of these series when put into page form are about equivalent to a 200+ page book!  In fact, I am in the process of turning one of those series into a book and these page count is pushing 300 once converted.  Creating these series represents a massive investment of time and that time won’t be available while working on a game title.


That said, I will still continue to do smaller ( say… one to four part ) tutorials on a variety of subjects, it’s just the massive series that I won’t be undertaking.  I will also continue to do in-depth reviews/previews of shiny new gaming technologies like I have in the past.  Of course, I will also be cherry picking the news I think will be of most interest to indie developers.  There are a couple of new site ideas I have as well that hopefully you will find interesting. So, at the end of the day, things won’t be all that different around these here parts.


Now the good change, from this point on you are going to have access to a developer blog that goes MUCH MUCH MUCH deeper than almost any I can think of on the net.  I am ultimately creating a product I intend to sell at the end, so I am not going to be working completely open source ( at least, not before release… may open up source code and assets after the fact ).  I am however going to be as open as I possibly can be.  In fact, I’d like to keep a HTML5 playable version of the game available here as I develop!  ( If HTML doesn’t end up being a complete pain in the ass that is…  big if that! ).  So, what’s keeping people from just ripping off my ideas, code, art style etc… and essentially cloning my game?  Nothing I suppose, except karma.  Should your house be visited by a plague of locusts… totally wasn’t me!


Along the way, I intend to show behind the curtain for just about everything…  share the more interesting code I develop, show the design process, works in progress, etc…  I will also be documenting all the business process behind the game too, the stuff most of us ignore ( and possibly hate! ).  Things like submitting to the app stores, setting up servers, promoting the product through various means ( ewwwwww ) maybe even topics like dealing with DLC or hosting ads.


In many ways, it will be a lot like the site currently is.  The major difference is, the topics I will be focused on in my writing are going to be topics I am actually facing in the real world.  The other big difference is going to be the depth of coverage.  For example, one immediate problem I am going to have to work on is rendering 3D models in realtime for a 2.5D game.  I intend to share the code for how I accomplish this and maybe even a bit of an explanation.  It will not however be a tutorial, so I won’t be going into detail about how I do things… of course, the comments are always available should you have a question.


If I pull this off, hopefully it will result in a very clear, detailed, hopefully interesting insight into the entire game development process, from concept to shipping ( hopefully money making! ) product!  Oh and hopefully it will result in one damned fun game too.


Hope you enjoy the ride.  Oh, and if there are any shorter tutorial series you are interested in, please let me know!

blog comments powered by Disqus

Month List

Popular Comments