A Programming Language for Games: Demo [video]
youtube.com
youtube.com
This dude nearly single-handedly made Braid, and is now working on a really cool 3D title that's well into its development.
At about 10 USD it's a bit steeply priced, but I found it well worthwhile: http://buy.indiegamethemovie.com/
In the demo he shows the basic running of the language. Then he shows it's realistic to write games in the language by running a space invaders like game. He then also shows the power of using the language as the pre-processor (very lisp like) in that he is able to run arbitrary code during the compilation process, such as checking that your printf statements have the proper number of arguments, or having it so you need kill so many space invaders or your compile fails. He also showed that it runs on linux as well as windows.
#run can run anything, if you don't trust the codebase you have to check everything for malicious calls. ( #run format c: as a joke :-/ when you compile )
check functions seem to have limited use. They can't check for input that isn't hardcoded( or can they? ). A runtime check might be more valuable.
I don't remember if it was mentioned; I think having C like implicit conversions is a bad idea. If types don't match exactly, cast or give an error.
defer is interesting, do you get an error if you try to return an object which is also defered getting deleted?
To clarify the probable mindset of the language designer: For games, runtime checks are pretty much useless - at runtime, the game is released and it's too late to do anything (ideally, discounting patches). So you want to catch everything you can at compile time. At the same time, performance is crucial. You need to be able to do everything the game needs to do within a 16ms time window. This means hardcoding / compiling in as many calculations as possible. Hence the focus on being able to do a lot at compile time.
That was just the first reaction I got, wow this can run anything.
That weakness already exists today in any project that relies on a build system (GNU Make, Autoconf, Ant/Maven, whatever), which is pretty much most of them.
> Do you really want a white paper?
* classes are reference types to avoid slicing (but may still be stack allocated)
* classes are reference counted
* arrays are sized
* semicolons are optional
* tuples are first class types. (essentially acting as anonymous structs)
* basic one-way compatibility for importing C headers
The compiler can be found here: https://github.com/bsurmanski/wlc
currently it compiles for both Linux and Windows, requiring LLVM as a dependency.
a game written in OWL for Ludum Dare 30 can be found here: https://github.com/bsurmanski/ld30
The work Jonathon has put in to his language in such a short time is super-impressive, and the ideas and their implementation seems solid, but I think he's really underestimating the time frames required to get something like this up from the pioneering stage to production ... remember that C++ was compiling to C in 1983. There are other interesting languages taking this approach even today. Vala and Nimrod both spring to mind. At the end of this third video he talks about modern pioneering spririt versus those from the heyday of the space race... well here we are 50 years later, and it turns out that space travel is still hard. I don't think programming is any different.
[0] https://www.youtube.com/watch?v=TH9VCN6UkyQ&list=UUCuoqzrsHl...
But closures have different semantics to functions, both in representation and in execution. The semantics of his language becomes even more confusing when he says that items at the top level are position independent, where as it seems that those in a function scope are, and yet they share the same syntax. There is a simple fix though. Just keep a uniform syntax for position independent items, but allow them to be declared at any scope. That is exactly what Rust does.
Personally, I'm all for having different syntax for different semantics.
http://www.reddit.com/r/rust/comments/2gwi11/jonathan_blow_i...
He specifically says that Rust "cares too much about safety" and that satisfying its safety guarantees adds too much friction to development. Some of the Rust programmers in the thread acknowledge that the safety/friction trade-off for games may be different from, say, OS kernels or web browsers.
He also notes that Rust is new and still needs to prove itself, which I don't think anyone will disagree with.
That's true, but I don't think making a new language avoids that problem.
- Module system
- Optionally avoiding complex build systems (rdmd or dub)
- Fast build times
- Type inference
- Nested block comments
- Owned memory (Unique, Scoped, RefCounted)
- All variables initialized by default
- Anonymous or strong enums
- Specify enum type (inferred by default)
- Order independent symbols
- Scope guard statements (more powerful in D though)
- Locally defined functions
- Built-in dynamic arrays
- Parameterized types (doesn't work in his language yet but he says it's coming)
- Compile time function evaluation (only side-effect free code though so no playable space invaders at compile time)
- Complex checks using compile time function evaluation
- Generate code at compile time and mix it into the program itself
I like where his language is headed but I'm not convinced we aren't already there. I guess I should go back and listen to his other talks to see why he's unsatisfied with Rust or D.
One aspect of familiarity, incidentally, is being able to hire junior devs. I see that as being a problem with Go -- and, in the future, Rust -- not to mention rocket-scientist languages like Haskell, Ocaml or even Scala, or indeed C++. Go is "simple", but not really that simple, not compared to Ruby or Python. (Of course, this might not be an issue for Blow, whose company is already using C++.)
While Blow was originally talking about safety not being a paramount issue, I believe he has mentioned ownership-lifecycle management, possibly something like Rust's borrowing, as being on his mind.
I assume it creates a stack of calls to execute just before exiting scope. Personally I find it a cool little syntactic sugar.
with_file(fun file ->
use_file(file)
)
I wonder if there is a way to code something similar that works with "defer". This would free you from needing to "remember" to add the defer and would have the advantage of allowing you to use `return` and `break` statements which don't work if you wrap them inside an inner function.The only thing I can think of is Python's with statement. Since its language syntax it allows for `return` and `break` but I wonder if there is a way to play nice with defer instead of requiring you to use another "block level" syntax construct for every file you use.
Anyway, I still much prefer RAII for this - not only for guarding against your own forgetfulness, but also to make sure a rogue refactor or patch doesn't break anything.
lycos1: you are shadowbanned and have been for the last 3 or so years.
If it stops the compilation when a test breaks, that forces you to fix it, but it also would irritate the crap out of me, since I'd want to test the code changes before refactoring the tests (I'm not a fan of TDD, at least when it comes to fixing bugs in code; let me fix the bug, then figure out what, if any, test broke (if none, add a test for that bug). I can't imagine it's particularly useful in game development either, when there can be a huge disconnect between something seeming correct at the program logic level, but massively broken visually; writing a test to make sure that that animation is smooth isn't easily doable).
If it doesn't stop the compilation on breaking the tests...it's not really any different than any other continuous integration style tool (or even a make script that adds a call to test after compiling), except that the tests are being run as the code is compiled, forcing you to wait the extra time even when experimenting. And it's unclear what code is intended for tests, versus other uses of the facility (such as DSLs and language extensions).
1) He's used to the atrociously poor error recovery of typical C++ compilers. You almost always get different errors after you've fixed the first error.
2) His language's semantics enforce sequential compilation, such that it's not reasonably possible to continue evaluating in the face of many or most errors.
#1 is a consequence of not designing for error recovery from the beginning. He's going to run in to a problem when people want squiggly red underlines in their IDE.
As projects grow in size, #2 is going to breakdown quickly without a good separate compilation unit story.
It is trivial to make your test routine log the error but return true so that the compiler doesn't stop.
However, I wasn't talking just about your compile time asserts for #1. There's also syntax errors, undefined identifiers, missing or extra arguments, etc, etc. That stuff is hard to get right if you want to report many independent errors. It gets much easier if you can change your language, so don't wait too long to take a swing at it.
He is not a messiah, it's already happening, people are using C#, Scala, Python, Haxe, Elm, Rust, D, Haskell to move game programming forward. E.g. Minecraft was built in Java, not C++. Game programming of today are those thousands of small indie developers experimenting, not the several hundred of bigger traditional C++ projects making big bucks.
Besides, there is not much focus on parallelism and concurrency for a performance-oriented language. By the time it hits it's first stable release the 8-core smartphones will probably be quite common.
Parallelism is a complicated topic and he will probably dedicate a video to that later.
That's a lot of negativity towards a guy who's said from the beginning he's just building a language that he wants to use himself. I don't think he's presented himself as "a messiah" in any way. He laid out some things that irk him in C/C++, and then he set out do make something that suits him better. These may not be the same things that are important to you (as demonstrated by your parallelism and concurrency criticism), but that's absolutely fine. People use different languages for different purposes and different tastes.
It worries me how makers are attacked here. "oh, we don't need that, X did the same thing ages ago" "why even bother if it doesn't do X" "oh dear, please not yet another X, people should just stop" "nobody needs X when we have Y1, Y2, Y3..."
That's some seriously bad attitude.
But he is quite smart, so some arrogance could be forgiven. He is also not afraid to say some fair and true things out loud:
> "...the web is a giant pile, I don't want anything to do with it, it's all horrible; it's not an exaggeration, anything to do with web is like so broken and it's so nasty and it's so hard to do good things...".
Maybe it's a correct attitude if we ever want to get rid of legacy crud like JavaScript and HTML...
That's what he said, isn't it? He also actively encouraged people to write their own languages which address what they care about.
> nobody is doing anything worth looking at, garbage collection is a no go, too much safety is bad and it's a first initiative ever just like the moon landing (which was kinda secondary to actually going to space first time anyway)
Those are his views, he needs those in order to make the new language. It's similar but not equal to your judgement of JavaScript and HTML. Those things are not bad per definition, they are just something you don't happen to like. The bigger theme here is that working with things that you don't like makes you unproductive.
So yeah, it does bother me a little when he says these things so emphatically, but they're still well distinguishable from global blanket judgements because they are expressed within the context of designing the new language.
And just to make sure I deserve all the ire I might get: we already have a language for making games and I don't even need to write what it is because you already know :) (and that's why you know it's true)
Its not a language only for games, but it is a general purpose language where the main feature set is chosen to benefit professional game development.
2. From what I've been taking away, all he is looking for is a way to remove some of the redundant parts of his day to day C++ code/process. Nothing more. Thats why, while I get that it is a full compiler, very intentionally (I think), a lot of the time it just seems like very nice syntax sugar (maybe "program sugar") for C++.
I don't know what he has planned for his language, but if I hear about a language that's specific for programming games, then entity-component systems would be the use-case I would have in mind.