Monday, May 22, 2017

Thursday, May 18, 2017

Creating games on Linux

I will only write about game engines in this post. To be more specific I will only write about game engines that support Linux and are royalty free. This post will not cover any tools for game asset creation. With game assets I refer to Music, Sound effects, Textures, 2D sprites, 3D models etc.


I started to do some game programming on Linux about 3 years ago (nothing published, just for fun). It all started when I backed the port of the game engine Leadwerks to Linux. I liked the idea of helping this particular engine getting ported to Linux because the port also included all the tools (map editor etc.). The engine is not open source but it is not expensive if you compare with other engines. You buy the engine from Steam and the standard version gives you Lua as script language and the Pro version gives you a C++ API and the Lua script language. The engine has good performance and the APIs are quite easy to wrap your head around.The tutorials and documentation on Leadwerks home page are good and you can find good tutorial videos on YouTube. There is also a nice and helpful community (forum) around Leadwerks. The engine and tools also run in Windows (and maybe Mac in the future). I have had a lot of fun with this engine and it is quite easy to use if have programming experience. Here is a list of the features that Leadwerks have for the time of this writing:

  • Instantaneous asset reload
  • Visual interface for every task
  • Drag and drop import of models and textures
  • CSG primitives and compound shapes
  • Smooth groups
  • Carve and hollow
  • Save any object as a prefab
  • Automatic texture mapping
  • Auto-generate materials and normal maps
  • Built-in script and shader editor and debugger
  • Hardware-accelarated terrain painting tools
  • Paint vegetation onto your landscapes
  • OpenGL 4.X Renderer
  • Entity System
  • Environment Probes
  • Hardware skinning with up to 256 bones
  • Hardware Occlusion Culling
  • Terrain and Vegetation System
  • Customizable Post-Effects System
  • Fast and Accurate Physics
  • Physics
  • Navigation AI
  • Visual Flowgraph
  • Integrated IDE and Lua Debugger
  • VR - HTC Vive, Oculus and OSVR
  • Game Launcher - Free Self-Publishing to Steam Workshop

The only shortcoming Leadwerks has, that I can think of, is that there is very rudimentary support in the engine it self for game UI things like buttons, text fields etc. You need to write it your self or find a third party solution.


Lately I have started to play around with Godot engine which is a free open source game engine. It is a quite feature packed engine that is well maintained and has a large and friendly community. It is worth taking a look at even if you are prepared to pay money for an engine. The engine works good both for 2D and 3D games, it has it own python(ish) scripting language and it has a very nice Animation system. Another rely nice feature is that it has a very mature game UI system that with buttons, text fields, list boxes etc. and if you miss a UI component you can easily write it you self. Godot organizes has something called scenes and sub scenes. For example a player character could be a scene and all enemy characters could be scenes and all these scenes can then be instantiated as sub scenes to a level scenes. Scenes are awesome when you get used to them and they provide a rely simple and effective work flow in the end. Even if I only have spent about 40 hours with the engine (at the time of this writing) I rely like it. Godot 2.1.X has the following nice features:

  • Visual editor, full of mature tools.
  • Uncluttered UI, with context-sensitive editors.
  • Scene system, supporting instancing and inheritance.
  • Friendly content creation interfaces for artists, level designers, animators
  • Visual shader editing for 2D and 3D.
  • Persistent live editing (changes are not lost after stopping the game).
  • Fully dedicated 2D engine, no hacks.
  • Work in pixels as your units, but scale to any screen size and ratio.
  • Custom 2D physics engine that works in pixel coordinates.
  • Flexible kinematic controller for collision without physics.
  • Blit 3D models as sprites into 2D.
  • Import 3D models from 3DS Max, Maya, Blender, and more with full animation.
  • Skeleton deforms and blend shapes.
  • Several light types, with shadow mapping.
  • Render with HDR, anti-aliasing and linear color modes.
  • Post-process fog, glow, bloom, color adjustment, …
  • Support for Physically-Based Rendering planned for the end of 2016.
  • Animate 2D or 3D. Visual animation editor with timeline.
  • Frame-based or cut-out animation for sprites and rigs.
  • Any property of any object can be animated, even function calls.
  • Use custom transition curves and tweens.
  • Helpers to animate 2D rigs, with skeletons and IK.
  • Efficient optimizer to pack imported 3D animations.
  • Animation Tree support for fluid character animation.
  • Python-like scripting language.
  • Built-in editor with syntax highlighting, real-time parser and code completion.
  • Powerful integrated debugger and profilers. Can debug a game running on mobile devices.
  • Integrated class documentation browser.
  • C++ API to optimize parts of the game or extend any part of the engine.
  • Godot works on Windows, OS X, Linux, FreeBSD, OpenBSD and Haiku. Editor runs in 32-bit and 64-bit, in all platforms.
  • Small download (around 20 MB), and you are ready to go.
  • Very easy to compile yourself in any platform (no dependency hell).
  • Filesystem usage is friendly to popular version control systems (Git, Subversion, Mercurial, PlasticSCM, Perforce, …).
  • Scene instancing makes teamwork a breeze, every team member can focus on their own scene. Be it a character, stage, … Edit without stepping on each other's toes.
  • Text-based descriptive and optimal scene format.
  • Script syntax supported by GitHub.

Compared to Leadwerks it has more features but Godots scripting language (GDScript) is has less performance than Leadwerks LUA script. However in the upcoming Godot 3.0 there will be performance improvements to GDScript and there will support for (kind of) importing C++ libs in to Godot in a very straight forward way called GDNative.


Both engines are good, so it is only a matter of taste, what are your need and what shortcomings can you live with. This is a very short post about two game engines but I hope this was enough for you to go and try them out.

Wednesday, February 15, 2017


I found GLyphy a couple of years ago: (original finding was in this slashdot article). GLyphy is a text renderer that are using actual vectors submitted to the GPU instead of rendering to bitmaps. The benefit with doing the rendering with vectors is the superb quality of the rendered text, the disadvantage is a much higher runtime cost. However, maybe the cost is worth it at the time of this writing. Today we have virtual reality headsets for example. In virtual reality, low quality rendering of text might destroy the whole experience in a VR UI.

Well, it has been laying around in the back of my head for a long time and out of curiosity I started to look for serious projects using it in the wild. I did not find any bigger project using it ... sadness. In the end I added an request/issue to the Godot engine about them to start using GLyphy: github issue.

If anyone know about some project using GLyphy, please post a comment about it.

Thursday, February 9, 2017

Learning OpenGL

A while ago I started to play with OpenGL and OpenGL shaders again. I thought that it would be nice to write down some good tips about good sources and tools for your learning process. I think that learning OpenGl 4 (the latest major version at time of writing) is more useful to learn than earlier versions because when you are done learning OpenGL 4 basics it is probably what most hardware will support.

If you have no knowledge at all about OpenGL I think this is a good starting point: Render hell. It is probably the best (and the most fun) overview you can find for a render beginner.

After reading that short but colorful introduction you should buy your self these OpenGL books:

The first two are about OpenGL 4 and how to use OpenGL in broad terms and are the de facto standard reference literature in the subject and the last one is handy OpenGL Shading Language cookbook. There are plenty of tutorials also available on the internet if you do not want to buy the books above. However, the books above will probably take you further than any online tutorial.

To learn OpenGl yo need to code. Most of what you need is covered in the books above or in many of the online tutorials you can find. However if you are mostly interested in programming in the OpenGL shading language then there are two tools that can be of interest: Shadertoy and ShaderTool.

During my play I have found a very useful sandbox called Shadertoy. Shadertoy is a webpage where you can write WebGL pixel/fragment shader code and see the result directly so it is a perfect tool for learning and play around with pixel (fragment) shader code. WebGL is based o OpenGL ES 2.0 and OpenGL ES is a subset of OpenGL. It is pure joy! So go there and have fun:

ShaderTool is a desktop application only available for Windows at the time of this writing (will be available for Windows, Mac and Linux in the future). It supports writing Vertex, Control (Hull), Evaluation (Domain), Geometry and Pixel shaders. So ShaderTool is much more powerful tool than Shadertoy, but it costs money. Here is a list of some features ripped directly from the developer:

  • Write shaders and view results instantly
  • Support of HLSL and GLSL (DirectX and OpenGL)
  • Latest shader models fully supported
  • Code editor with syntax highlighting, warning and error output
  • Easy-to-use node-based render pipeline
  • Import models, textures, audio files and other resources per drag'n drop
  • Export your shaders and share them with others
  • Create template projects for more efficient shader development
  • Direct use of shaders in DirectX or OpenGL applications
  • Oculus Rift DK 2 fully supported (Direct Acces Mode)
  • Use audio streams for shader input to create stunning effects
  • Post-Effects fully supported
  • Create multiple render-pipelines and combine them to create AAA shaders used in games