Open Source Cross-Platform Game Programming
What is Crayon like?
How does Crayon work? Like...is it translated? Compiled?
What's the benefit of byte code vs a translated language?
What does Crayon code look like?
Why have you done this?
But aren't native apps still useful for certain cases?
Why no Android support?
Are there any text editors that support syntax highlighting for Crayon?
I found a bug. How do I get you to fix it?
I'm a PyGame user. Should I use Crayon instead?
I'm an HTML5/Canvas/JS user. Should I use Crayon instead?
I'm a Unity user. Should I use Crayon instead?
I've written a cool game in Crayon. How do I add it to the demos page?
Who are you?

What is Crayon like?

It's actually quite a bit like what Python would look like if:
  • ...if Python was a curly brace language but maintained roughly the same behaviors.
  • ...if the PyGame was a built-in library.
  • ...if it ran in a browser or iOS or in general without dependencies.

How does Crayon work? Like...is it translated? Compiled?

Your code is compiled into a byte code. The VM, which is actually written in Crayon itself, is translated into various languages and platforms and interprets your byte code on that platform. This ensures that your code will behave identically on all platforms.

What's the benefit of byte code vs a translated language?

A byte code language that is fully virtualized has a strong guarantee of behaving exactly the same no matter which platform you run your code on. This means there is low risk that your program will exhibit bugs on a different platform than the one you developed on. This means you can develop on Windows, but then export your project to the Web or iOS without worrying too much. It adds a level of certainty that when you use certain libraries and functions, it'll do exactly what you expect it to, always. For example, using the modulo of a negative number in a translated language may give you erroneous behavior if the target language returns a negative number of stays in the range of [0-n). (one specific example). Because quirks like this are managed by the VM, there's no need for extra workarounds or checks.

What does Crayon code look like?

Here's a simple open source game I wrote at a 2-day game jam where you play a tuna sandwich that's become sentient that needs to eat the other food in the fridge to grow big and escape. There are also plenty of examples on the Demos page, with links to the source repositories.

Why have you done this?

Asking a user to download your game as a zip file which includes either natively executable code or some other format that requires more downloads isn't as universally acceptable as it was many years ago. Most operating systems, browsers, or virus scanners, will rightfully think they're under attack when native code is downloaded and executed. Most app and game distribution occurs in some sort of app marketplace or via the web. Flash was the answer for web games from the late 90's for about 10 years, until HTML5 and Canvas became a viable platform for games and Flash continued to be plagued by security vulnerabilities.

Being able to quickly write games in a Python-like language that ran in the browser without a plugin but not prone to the brittle nature of JavaScript was the trigger that set this in motion.

But aren't native apps still useful for certain cases?

Yes. And you can still create native apps in Crayon using the C# export. One philosophy of Crayon is to not lock people into one particular platform.

Why no Android support?

I'm working on it! I promise!

Are there any text editors that support syntax highlighting for Crayon?

I have written a Notepad++ syntax highlighter definition. However, because Crayon is a basic curly brace language, associating the .cry file extension with your favorite text editor's C#, Java, JavaScript, or C++ syntax usually gives a fairly decent experience.

I found a bug. How do I get you to fix it?

Report it in the issue tracker on GitHub. If you don't have a GitHub account, send an email to the mailing list.

I'm a PyGame user. Should I use Crayon instead?

For most use-cases, yes. The number of features supported by PyGame that are not supported by Crayon is shrinking considerably with each release. If you already know Python and some other curly brace language, the learning curve is virtually non-existent. PyGame was the main inspiration behind most of the built-in Crayon game-related libraries.

I'm an HTML5/Canvas/JS user. Should I use Crayon instead?

Probably. It depends on how much you dislike JavaScript and how much of the canvas API you're making use of. If you're drawing geometric primitives and images, then you may find Crayon a bit more friendly than raw JavaScript. If your only motivation for using JavaScript to make games is to avoid requiring users to have specific browser plugins, then Crayon may be an ideal alternative to JavaScript, particularly if you are dissatisfied with JavaScript's prototype-based Object Oriented model and other various quirks. Browser quirks are handled at the VM and library levels, so there's no need to worry about cross-browser compatibility.

I'm a Unity user. Should I use Crayon instead?

Depends, but probably not, as the target use-cases are generally different. Crayon is currently 2D only and, while it supports many platforms, it doesn't target all of them, yet (although hopefully this will change). But if you're a Unity 2D user and are trying to make a game that you want people to be able to play in a browser and are tired of people downloading a plugin, then perhaps. Some of the benefits of Crayon over Unity are:
  • Always free. Even if you sell billions of copies of your game.
  • Very little magic infrastructure that you have to learn the quirks of. The Crayon API is very direct and deals mostly with graphical primitives. If you prefer raw code rather than the game-designer approach of making a game, this is probably an advantage of Crayon. If you prefer the game-designer approach of Unity, then it is a disadvantage.
  • Runs in the browser without a plugin.
  • Output is typically smaller. Much smaller.
  • Creating prototype games generally goes faster in loosely/duck typed languages, making it an ideal language for Game Jams.

I've written a cool game in Crayon. How do I add it to the demos page?

Feel free to reach out on the mailing list. Or tweet it to me. Or use the IRC channel. Several communication channels are listed on the community page.

Who are you?

My name is Blake. I like to make games.