I am confused by the fact that this blog post seems to link to all the competing frameworks he discusses, but never links to LÖVE itself. Seems an odd choice given that the word is going to produce a bunch of unrelated google search results...
Sorry about that. I was clearly so proud of myself for getting my keyboard to do the two dot thing on top of the Ö that I forgot the most basic link of all. Updated now.
cool, thanks, didn't know that :) Unfortunately I'm stuck on 10.6 here as this machine's too old to upgrade. Tested it and everything before I replied, just in case I was wrong.
Does Lua have "crappy scoping"? My understanding is that it has full lexical scoping. And somebody normally liking Python is in no position to complain about bad scoping rules!
I haven't used Lua myself, but I'm impressed by the design: it seems like an elegant version of JavaScript minus most of the really obnoxious JavaScript warts.
The tables and metatables seem particularly great: they look like a simple, elegant version of prototype-based inheritance without some of the problems JavaScript suffers. It's certainly simpler and more expressive than a class-based system.
Also, Lua is well known for having coroutines that are done correctly. That's probably not immediately useful for complete beginners, but it's certainly a nice feature when you get to it.
Basically, I personally take issue with the way Python handles global variables and, until Python 3, completely fails to handle non-local variables.
Let's take a trivial example that would work in JavaScript or Scheme. Often, I want to keep track of how many times a particular function gets called (usually for debugging). I would expect to be able to do something like this:
counter = 0
def foo(bar, baz):
counter += 1
...
This does not work in Python. You could use the global keyword to work around this:
This is something of an ugly hack in the language design. Moreover, this falls apart if counter is not in the global scope itself--for example, if foo is defined inside another function. Python 3 introduces the nonlocal keyword to deal with this.
Fundamentally, this problem stems from the fact that Python conflates two fundamentally different operations: defining a variable and mutating it. I personally really like how Scheme handles this: defining and setting are two different actions, and trying to set a variable that has not been defined is an error. This makes the intentions of the programmer much clearer.
A very common pattern in Scheme and JavaScript (as well as other languages I don't use, no doubt) is to use closures to encapsulate state. Thanks to Python's scoping model, this is at best a pain and certainly unnatural.
There are also some minor annoyances. One that gave me problems recently (although it has been fixed in Python 3, I believe), was with list comprehensions:
[i * i for i in range(1, 10)]
print i # gives you 9!
> A very common pattern in Scheme and JavaScript (...) is to use closures to encapsulate state. Thanks to Python's scoping model, this is at best a pain and certainly unnatural.
It is also unnecessary. Python has normal classes, so you can contain your state within objects rather than stackframes.
I don't like either of your examples. Your first example should have been a generator and used a yield rather than a global counter. Your second example is simply bad practice (what do you even expect to happen? It's ambiguous, but i having the value 9 seems to make a reasonable amount of sense).
In my second example, I expect i to not be in the scope. The variable i only makes sense inside the list comprehension and should not be randomly introduced into the outer scope.
For the first example, I don't see how you could replace it with yield, especially if the function foo has to normally return a value when it's used. The core idea is to count how many times foo is called without altering the call site at all. Also, this is an entirely trivial example to illustrate the scoping issue; in practice, there are more complicated reasons to want to set non-local variables, especially from things like helper functions.
The examples don't have to be idiomatic Python to demonstrate Python's weaknesses. In fact, one would expect mature idiomatic forms to skirt language limitations more-or-less by design.
Not a python expert, but python3 has had to add unlocal to let you create a non local variable. Lua requires explicit local, else things are global (which has different problems but seems a more logical choice).
Lua also makes all loop indexes local to the loop which is very clean. Python has difficulty with this.
Another area where Lua excels is interacting with C code. It's very easy to bind, and it runs really fast to boot, making it perfect for a scripting language in an engine that uses C for the heavy lifting.
For the folks who struggle with Lua's language design: try thinking of it like Crockford's Good Parts of Javascript with a slightly different syntax (and arrays/objects rolled into one, the table). Generally speaking, once you've moved past the default indexing from 1, that analogy works out pretty well -- even down to how to set up more object oriented designs (js prototypes and Lua metatables/metamethods are rather closely related ideas).
LÖVE is a very fun engine, much easier than PyGame to get going - in both setup and development terms.
Indexing from 1 and 0 seem to me to reflect two different equally valid viewpoints. Offsets against a base address in memory (the C family) versus labels for boxes (Lua and friends). Naturally, stating from a base address, the offset is 0. Equally naturally, if you're labelling boxes with numbers, you number the first one "1". For Lua, given the tables are also at the same time hashes (with explicit labels), treating them as numbered boxes makes sense.
I think also the construction of the for loop makes it more natural. Lua is "for i = i, n" vs the more complex and off-by-1 prone "for (i = 1; i < n; i++)" where you need the less than vs an equality.
Though I would assume most library authors are not necessarily attempting to be offensive, not the greatest culture to construct around your toolset regardless.
As biased as I am (very), I'm not sure how this applies, none of the library names I know suggest anything sexist, or otherwise offensive.
Now, as for whether naming libraries after sex acts, and possibly body parts, is a good idea, well, does it matter? Worst case it makes your conversations more fun.
Asking a co-worker about the AnAl library could elicit a chuckle, or it could be an example of what alienates female programmers from the game industry. It isn't inherently a big deal, but in the hands of the immature and can easily go from funny to uncomfortable.
If the sexual funniness stems from the library the team is using, then the awkwardness can be addressed in a team meeting well in advance. Perhaps resulting in a only-one-joke-a-day policy or changed pronunciation (e.g. AnAl like "analgesic").
among other examples - what counts as acceptable behavior in the gaming community is a pretty hot topic right now. there is a strong argument to be made that anything that isn't acceptable in the business community should be discouraged in gaming.
"fair enough" is something you say when someone you initially disagreed with makes a point. I don't see any disagreement here. http://en.wiktionary.org/wiki/fair_enough
In Australia the context is different and implies that you agree that someone is making a point which is fair enough to be valid, in other words that you agree with it.
Come on, they're basically just tongue-in-cheek names to evoke a chuckle or two.
'HardonCollider' collision system, 'Lube' networking library etc, I can hardly see anyone being offended unless they _really_ want to be.
Apart from that I fully agree, despite doing lots of coding in Python, I, just like the author find löve a better choice than pygame for quickly developing/prototyping games, YMMV and all that.
"Offended" may be too harsh a word, but "annoyed" would certainly apply to me and "uncomfortable" to a number of professional software developers I know. I don't know many shrinking violets, but that doesn't mean you want to be hit over the head with (stupid) sexual metaphors when you're working just because the library developers are incapable of reining in childishness.
Like, by itself, not a gamebreaker or anything (for me that would be a weakly typed language--though I've encouraged my little brother to play with Moai, another Lua environment, in the past), but given the choice I'd probably go with tools with a culture that encourages a bit better judgment.
Except, the original article is talking about finding a framework suitable for 7- and 10-year-old boys. Which might change the context of the jokes for some people :o
When I was 8, I insisted on buying a little book containing a collection of toilet stall graffiti sayings. I didn't get half of them, yet merrily recited them.
And look where I am now, happily employed software developer with >=1000 karma.
> I had seen this about 6 months ago but dismissed it because the programming language, Lua, looked weird and I’d never heard of it.
This what surprised me most about the post. Lua is not especially strange, by any means, and also fairly well known. Obviously, its hard to compare my experience with his experience, but nonetheless I was quite surprised he said something like that.
It is not alas that well known, although much more so in the last few years. It has reached number 20 on github though now. A lot of people use it but do not really talk about it much, eg in game development.
Probably doesn't help that most of the code is tied up in scripts for games, and public development is hosted in places like curseforge and wowinterface.
This isn't directly related to the blog post as it's about stuff available on OS X, but if you're on Windows I can very much recommend checking out Construct 2 by Scirra[1]. They have a pretty fantastic HTML5 game engine and an editor (and the whole "no programming required" is really just marketing - even though it uses a "visual" event system you still need to understand programming concepts like loops, conditions and such in order to make effective use of it). They have a feature-limited (no other limits though) free edition available for it too.
My 12 year old (going on 13) also started with Mindstorm. Then we dabbled in MIT battlecode (Java). I taught him some Python and he did Udacity Python intro class on his own. Then he discovered Ogre (C++) and has been obsessed with it ever since. I remember giving him an 20 minutes intro to HTML a couple of years ago and that was all he needed to start playing with web pages. A young mind seems particularly adept at absorb ing artificial languages. Don't underestimate your children.
It's too bad he doesn't do a thorough comparison, I'd love to hear what he likes so much about Pythonista, for instance.
With regards to the "crappy scoping", I can only assume he didn't read up properly, especially since both the globals and locals mentioned right after do exist.
One of the great benefits of Love, in my opinion, and something that sets it apart from a lot of comparable game frameworks, is the open source and free nature. It really encourages sharing and open (not obfuscated) code by having the default packaging for your games just a zip file of the source and assets.
Moai, compared, is probably a richer framework but seems fairly closed. I'm also slightly confused by the paid for cloud component. Is this necessary for making games? What part, or how much of Moai is free or open?
The cloud is an additional service, which you are not required to use - but is there if you do need it. Its one small point of confusion in the MOAI world, that people think that MOAI Cloud is MOAI itself, but thats not the case. Its just an additional service that can be utilized by users of the MOAI SDK, if they want it ..
Thanks for information. Yes, the Moai is slightly confusing, it's not obvious to me that there is a full SDK available and usable without paying for the cloud component. I might check it out in fact, I have been looking for a cross platform game toolkit, I skipped over Moai before because I thought I would have to pay to use it.
his comment on gosu made me sad. as a big ruby fan, i run into the "framework looks wonderful, but due to installation issues i cannot in good conscience recommend it to a beginner" far too often. the one-click installer projects for windows and osx are going a long way towards fixing this, though.
I found out about LÖVE about 2 weeks ago. It looks a bit like "flash done right". I haven't done anything with it yet, but it looks cool for interactive multimedia content.
For reference: https://love2d.org/