Start a hosting plan from $3.92/mo and get a free year on Tuts+ (normally $180)
Polycode is a free, open-source (licensed under the MIT license), and cross-platform "framework for creative coding". This term is seldom heard inside the game development community, but what it basically means is simple: Polycode provides you with tools to express your creativity through code, and although it is fully qualified to bear the "game engine" moniker, it prefers not to.The reason is simple: Polycode can be (and often is) used for projects that encompass more than interactive games, such as visualizations used for entertainment or in scientific purposes.
I have used Polycode for mostly small games but also for an out-of-the-ordinary zooming user interface and had equal, great success in developing all of the projects. Let's take a look at what Polycode can offer you, and hopefully get you interested in learning to work with this wonderful framework.
What Does Polycode Provide?
As this is not a promotional piece for the framework, I'll try to emphasize key features that may be of interest to game developers without going into excess detail.
- 2D and 3D graphics: The Polycode framework provides you with simple, effectively designed systems for drawing 2D and 3D graphics. It does not do so at the expense of speed, and it does not sacrifice features that advanced users require—a feat which many of today's popular rendering engines fail to pull off. At first, I suspected that Polycode would give me only basic 3D graphics capabilities, but I changed my mind when I saw how the pipeline was designed; it's as customizable as it gets, and it allows for implementation of methods such as light pre-pass or deferred shading without ever changing the framework code.
- Input handling: Polycode allows you to handle mouse, keyboard, joystick, and touch input via its uniform event-handling system. This feature is obviously essential for anything that comes close to calling itself a game engine.
- Networking support: The networking API doesn't look overly complicated and doesn't sacrifice features, either. I haven't it used a lot personally, but so far it has never presented any problems for me, and I know it's used extensively by the most acclaimed projects developed using the platform.
- Audio: With Polycode, you can play 2D and 3D positional audio, complete with features such as streaming (for long audio files such as music tracks). The feature set here is not spectacular, but it should be enough for the needs of most indie game developers out there.
- 2D and 3D physics: Realized via plugins to the core framework and using Box2D and Bullet—both leading libraries in their respective areas—Polycode's physics API is competent, well thought-out, and robust. It had also been a pleasure to use, much more than using the underlying libraries: while I didn't have problems using Bullet, I did find that that, for users entering the 3D physics field, there is too much and too sparsely documented material out there. With Polycode, the physics API is straightforward and you can almost just use your common sense while dealing with it, which is very encouraging for novices who may have trouble picking things up at the beginning.
- Dual Lua and C++ API: This is a unique one—Polycode offers you its API both from C++ and Lua programming languages. This lets it offer you one-click publishing if writing using Lua, as well as the possibility to use scripting in your games and, for example, give your level designer an easier way to code game logic inside their levels.
These are just the key features; I left out a lot of others, including skeletal animation, Unicode-ready TrueType font rendering, and Polycode IDE. A more complete (but still not exhaustive) list may be found on the official website.
Why another framework? Why should you even consider Polycode, let alone start working with it? I cannot persuade you; I can only give my own opinions and experiences and let you be the judge. Here are some key advantages of Polycode I've found during my time with it.
- Polycode is robust. With a sleek, minimal API, its concise way of exposing features, and a solid editor, Polycode really makes me feel comfortable and in control—and I'm the kind of person who likes to have everything possible at his fingertips, ready to be customized and tailored to my needs, so that's saying something.
- Polycode is strong. The broad range of features relevant both for small 2D platformers and sophisticated 3D games with a rich visual experience has helped me achieve what I've wanted to and polish it to perfection, never having to worry whether my game would grow too complex for the engine's capabilities.
- Polycode is easy. It has great documentation and its inherent ease-of-use has never, ever left me lost. Although it is young and there aren't a lot of resources on the Internet, I was often able to use just my intuition and common sense to derive how something works, which I have learned is far more important than it sounds like.
Although Polycode is very young, it has quite a few projects to pride itself on. Most of these aren't even games, but rather innovative uses of our familiar rendering, tactile, audio and physics simulation technologies. Here are some:
Music Video for "Heaven" by Depeche Mode
In the music video for the song "Heaven" by Depeche Mode, directed by Tim Saccenti, Polycode was used to render decorative projections on the wall behind the band:
U.S. Open IBM Data Wall
Five HD screens, managed by five computers, working in sync, all powered by Polycode. This data wall visualizes data from the 2012 U.S. Open, and features 3D physics simulation, touch feedback, overlaid 3D graphics, and networking to keep the computers displaying the data in sync. Developed by HUSH. More info can be found on the project page.
Built by Ivan Safrin, the same mastermind behind the Polycode project itself, Space Cruiser is a mind-blowing game designed specifically for projections inside a planetarium dome and collaborative play. It was premiered in the Hayden Planetarium at the American Museum of Natural History. Polycode fully powers this interactive game, rendering high dynamic range 3D graphics from six different computers, all synced up using the framework's networking capabilities. You can read about this exciting, surreal game on its project page.
What Previous Knowledge Do I Need?
You can use Polycode both from C++, from Lua, or from both at the same time, decoupling your game's core mechanisms (performance-intensive C++) and its logic (scripted, hot-swappable Lua). If you use only Lua, you don't need knowledge of the rather complex language C++, and you can start prototyping right away in the great Polycode IDE, an integrated editor that comes with the framework.
Once you decide you want more control over the inner workings, you will find yourself in need of C++. The choice is yours; I suggest you don't learn C++ if you don't already know it (especially if you don't have prior programming knowledge) right away. Lua is much lighter, newbie-friendly, and easier to learn, so that would be your best bet. On the other side, if you're an experienced game developer looking to use Polycode for complex, thought-through games, using C++ and Lua in tandem is the way to go.
For C++ tutorials, you can refer to cplusplus.com, the place where I learned almost everything I know about the language. As for Lua, you can refer to the exhaustive list of tutorials at the lua-users.org Tutorial Directory, or, if you prefer, you can buy the book Programming in Lua which will give you a rock-solid base and cover just about everything you need.
Having some knowledge of how games work is recommended, but not really required: you can figure it out on your own if you follow the great tutorials on Polycode.org, referred to below.
How Do I Get It Up and Running on My Machine?
Polycode is young software; in fact, as of writing, it still hasn't reached version 1.0.0. Most projects in this state don't give you precompiled binaries, and neither does Polycode; however, the official website provides you with everything needed to successfully get Polycode up and running on your machine.
Refer to the page on the Polycode wiki, pick your platform (Polycode works on Windows, Linux, and OS X, with Android and iOS support planned in the future, so stay tuned) and you can get going! The build process is straightforward; in fact, on my Arch Linux system I was able to build the framework using CMake without even reading any of the instructions.
How Do I Start Learning to Work With It?
We've skimmed through Polycode's advantages, features, notable projects, build process and now we can get our hands dirty and start actually doing something in it. The Polycode team has done a magnificent job in covering a lot of the key points an end-user needs to start creating great-looking games, visualizations and the like. The Polycode tutorials can be found on the tutorial page on the official website.
If you get stuck and need detailed documentation, you can always refer to the official documentation, which you can reach from the "learn" page of the website. If you are still stuck, you can always ask for help on the forums or join the IRC chat on
irc.freenode.net. The community is friendly and helpful, and the lead developer itself often answers questions by others, along with other members of the team. (I've chatted with Ivan a couple of times online, and he seems like a great guy.)
In this article, I've introduce to you a very young framework named Polycode. We've seen how Polycode can be used as a game engine as well as for a wide variety of project types; I described some of its key features, its unique advantages, and cool projects that use it, and I did my best to help you get into the learning process of this framework. Happy Polycoding!