Development: Android and iOS, new game release "Darkest Before the Dawn", more

January 2, 2014
Screenshot from "Darkest Before the Dawn"
Screenshot from "Darkest Before the Dawn"
One of the first 2D programs to run with OpenGLES renderer - "isometric_game" from engine examples
One of the first 3D programs to run with OpenGLES renderer - "android_demo" from engine examples
Summary of new view3dscene AWSD controls
Tooltip with summary of new view3dscene AWSD controls

Hello everyone in 2014 :)

First of all, I would like to present a small game I did during a weekend "gamejam" at the end of November 2013:

Darkest Before the Dawn

The game is free to download for Android, Linux or Windows. Of course the game uses our Castle Game Engine for everything. The complete game code and data are available in our SVN repository.

Next, we have news about the engine development:

  1. Yes, you have heard right: the engine supports Android and iOS (iPhone, iPad).

    The rendering is done using an OpenGL ES 2.0 renderer. Most of the rendering features work (and the rest is in-progress :). Rendering 3D shapes with shaders, textures, lighting of course works. Note that mobile shaders use the Gouraud shading for speed. Rendering 2D images (TGLImage) is also done. Since TGLImage is used underneath by all our 2D controls — most of 2D GUI works (except fonts, for now...).

    You can compile the whole engine for OpenGLES (as opposed to normal desktop OpenGL) by defining symbol OpenGLES in base/castleconf.inc file. This symbol is defined automatically when we compile for Android or iOS, but you can also test OpenGLES renderer on normal systems like Windows and Linux (it's a nice way to test your mobile game on a desktop system).

    We can initialize OpenGLES context using the EGL library. This is useful to initialize OpenGLES on Android or Xlib (with glX+EGL) or Windows (with wgl+EGL).

    The Android port uses NativeActivity, available since Android 2.3. It requires FPC 2.7.1 to cross-compile code to Android ARM, see FPC wiki about Android. Integration with Android includes using Android's log facility (just use WritelnLog from CastleLog unit) and using Android's assets (URLs like assets:/my_texture.png are supported, and ApplicationData returns assets:/ to read data from apk).

    You can develop cross-target games (for Android, iOS, or standalone — normal OSes like Linux or Windows) using the engine. This means that a single source code can be used to compile multiple versions of the game. We also have plans to make a "build tool" for the engine to auto-generate the necessary files for the compilation on given target (although it's unsure if this will be ready for next release). See Planned: build tool wiki page, and drop a comment if you're interested!

  2. Engine can be compiled and used as a shared library (castleengine.dll on Windows, libcastleengine.so on Linux), with API accessible from C or C++. We provide a C header in src/library/castlelib.h for this purpose. See code in src/library/ and tests in examples/library/ .
  3. The default TWalkCamera inputs are now equal to TPlayer inputs, in particular they honour common AWSD combo.
    • You can move using AWSD by default (e.g. in view3dscene).
    • Space / c keys make jump / crouch. We no longer have separate inputs for jump / crouch (when gravity works) or flying up / down (when gravity doesn't work).
    • This avoids switching the meaning or left / right arrows in mouse look mode in view3dscene.
    • This makes keys in all our programs and games more consistent. And everyone knows AWSD, while previous shortcuts for strafing (comma and dot) were quite uncommon.
    • Of course, all TWalkCamera inputs remain configurable. So, if you really liked previous key shortcuts, you can restore them for your application.
  4. TextureBackground support, making it possible to use MovieTexture as skybox sides. The rendering of Background and TextureBackground uses new simplified code, that can utilize our texture cache and works on OpenGLES too.
  5. Notes about transformation hierarchy added to the documentation.
  6. Context resource sharing (so that many windows/controls work OK, sharing textures and fonts and such) implemented for CastleWindow Xlib+GLX and GTK backends.
  7. Support for png and gz formats without any external libraries (using FpRead/WritePng and PasZlib underneath). This is particularly useful for Android and iOS, where linking with external libraries is not so easy.
  8. CastleEnumerateFiles API much changed and renamed to CastleFindFiles. It supports searching for files inside Android assets too (although, unfortunately, not recursive — because of NDK API limitations).
  9. --hide-menu option implemented for view3dscene. Useful e.g. for fullscreen presentations, where you may want to hide all UI.