FreeGameDev Planet - Development

Also check out the games planet.

March 24, 2017


New tutorial: Using message and file dialogs

This outlines how to integrate tinyfiledialogs which allows using the native file and message dialogs from the operating system in an Orx application.

by Wayne Johnson ( at March 24, 2017 12:29 AM


Proving Non-Existence of Monoid Symmetric Paths

This post is about a recent result from the research on path semantics. I will give a short introduction, since most people do not know what it is.

Path semantics is an extension of type theory that grounds meaning (semantics) using functions.

For example, a list of length 2 has the type x: list but also the sub type x: [len] 2. It means that there exists some input x to a function len which returns 2. Another common notation for binary operators is x: (> 2) which means “x is bigger than 2”. You can combine them, e.g. [len] (> 2) means “a list with length larger than 2”.

In dependently type theory, you can write x: list 2, by storing extra information in the type. Path semantics deals with this information outside the type, using arbitray functions. This forms a natural abstract space, called “path semantical space”, which describes how functions are identified by each other.

When a function is connected to another function using functions, it is called a “path”.

A symmetric path has the following axiom:

f[g](g(x)) ?= g(f(x))

It says that for a function f and a property defined by g, there sometimes exists a function f[g] that predicts the property of the output for function f.

Symmetric paths occur in many beautiful equations, for example in De Morgan’s laws:

and[not] <=> or
or[not] <=> and

Here are some other examples:

concat(list, list) -> list
concat[len] <=> add
concat[sum] <=> add

even(nat) -> bool
odd(nat) -> bool
add[even] <=> eq
add[odd] <=> xor
eq[not] <=> xor
xor[not] <=> eq

This notation has algebraic rules, such that we can do things like this:

concat[len] <=> add
concat[len][even] <=> add[even]
add[even] <=> eq
concat[len][even] <=> eq

The holy grail of path semantics is to create an algorithm that finds paths automatically, with as little input from humans as possible.

You might wonder why this is interesting: Since paths are everything you can predict about functions, it means that a such algorithm would be extremely useful for everything that can be modelled as functions.

So far I have algorithm that extracts both symmetric and asymmetric paths, but it requires test data and human intuition to narrow down the search space.

Today I am getting a step closer to this dream, by stumbling over this golden nugget:

∃ i, j { ( g(x[i]) = g(x[j]) ) ∧ ( g(f(x[i])) ¬= g(f(x[j])) ) } => ¬∃ f[g]

It says that you can prove the non-existence of a symmetric path to functions in the monoid category from as little as 2 objects. In comparison, the current algorithms requires checking an infinite number of functions!

With some creativity, this can be used to prove things about other functions as well, e.g. binary operators by binding one argument to a constant.

For example, I used this to prove:

¬∃ add((> 0))[is_prime]

It says there is no way to predict a prime by adding a positive number.


  1. The primes 2 is even and 3 is odd
  2. When you add any positive number to both of them, at least one is even.
  3. Because all prime numbers above 2 are odd, then at least one number is not a prime.

To explain the second part, we can write one argument as a set:

add([even] x, {[even] true, [even] false}) = {[even] (x = true), [even] (x = false)}

So, at least one element in the set is [even] true.

2 + (> 0) = (> 2)

All primes (> 2) are [even] false.

Therefore, at least one element is [is_prime] false. Since you can add something to a prime to get another prime, there exists two objects that are not equal by g(f(x[i])) ¬= g(f(x[j])).

For example, is_prime(add(2, 2)) ¬= is_prime(add(2, 3)).

Therefore, there is no symmetric path for add((> 0))[is_prime]. It is no prime prediction function to learn from addition.

March 24, 2017 12:00 AM

March 22, 2017

Castle Game Engine

Castle Game Engine 6.0.2 release!

We’re happy to announce Castle Game Engine 6.0.2 release!

Download it from our webpage.

This is a small, mostly-bugfix release. So we only have 6 new features:)

New features:

  1. sprite-sheet-to-x3d tool: The animations duration is now calculated looking at the number of animation frames and the FramesPerSecond value. FramesPerSecond is by default 4, but it can be changed by the –fps= command-line option.
  2. New test_local_characters testcase (inside examples/fonts/test_local_characters/), testing reading and rendering of international characters (Chinese, Russian, Greek…).
  3. LoadAnimatedGifs, see an example GIF player🙂 It requires having ffmpeg installed, though, for now.
  4. Better API around TextureProperties X3D node.
  5. Automatic gzip extension recognition for URLReadXML / URLWriteXML (by Eugene Loza, thanks!).
  6. Unix manpages for utilities can be generated (see doc/man/man1/ in sources). All utilities support now –help and –version options.


  1. OpenGLES (mobile) fixes for Color and ColorRGBA nodes handling.
  2. Removed the proprietary Chartboost and Heyzap jar files from the distribution. They were packaged by accident in our zip and tar.gz archives. Users should download them on their own, following links from Android components page.
  3. Fix reading X3D files with IMPORT.
  4. Fix UI in examples/fonts/html_text.lpr.
  5. Various fixes for switching font at runtime. The test_local_characters demo shows that now everything works.
  6. Remove the warnings from FPC 3.x around WideString convertions when dealing with XML units (by Eugene Loza).

Please check the downloaded file correctness!

Downloading the files from SourceForge may be unreliable now, in my tests. After downloading, please double-check the correctness of the downloaded file:

  • the size should be precisely 126164527 ,
  • the md5sum should be 7f6ccd3f4d6a2547299ea4dc9ef0ad15 .

I’m talking with SourceForge to have it fixed. Eventually, we may move our downloads to another server.

by michalis at March 22, 2017 02:18 AM