In this blog I'll post on everything thats going on with my games, I'm developing. There may be some more things, but thats the main topic.
A project I've worked on is for example WorldOfCube, download here:

21st March 2014

Photo with 1 note

Interactive Seperating Axis Theorem Visualization

Just take a look at this:

It took quite some time to write (~160 equations), because you don’t have things like vectors on, but it was really nice to play around on this editor and finding out how to do things.

I hope the tutorial makes sense and helps understanding how SAT works, but personally I think the best thing with this is the ability to interact with it :)

Interactive Seperating Axis Theorem Visualization

Just take a look at this:

It took quite some time to write (~160 equations), because you don’t have things like vectors on, but it was really nice to play around on this editor and finding out how to do things.

I hope the tutorial makes sense and helps understanding how SAT works, but personally I think the best thing with this is the ability to interact with it :)

18th January 2014

Post with 2 notes

Sharing Links

So, just a pretty cool video I’d like to share with you from the beginning ;) (It’s about simulating bipedal creatures realistically with muscles. These creatures learn walking with a neuronal system and without any motion captures)

Bret Victor (

You really have to check out Bret Victor’s Website. He has done so much awesome research!

Ladder of Abstraction & Learnable Programming

Look at his essays the ladder of abstraction or learnable programming to get an idea of what he is doing, and how he is trying to revolutionize UI’s and PC User interaction.

Inventing on Principle

I also highly recommend his talks, especially the talk “Inventing on Principle”, which is about how game editors should look like (or better: How IDE’s should look like in general), in terms of helping the user understand what is going on, when writing code, building up the connection between glyphs and letters and the graphical stuff they magically create.

Drawing Dynamic Visualizations

Also recommended is “Drawing Dynamic Visualizations”, which is about a tool that helps abstracting away the input of data when drawing graphs. Basically, when you want to create a diagramm, you have 3 options:

  • Adobe Illustrator: It’s possible to use it for drawing graphs, that can be very outstanding, but they only work for one data input.
  • Excel: Using Excel or similar is also not an option, because you can have dynamic input on the one hand, but can’t have outstanding, ‘different’ graphs on the other hand (that means: Only bar charts, pie charts and other common stuff). You can’t visualize data in a way, that might be very specific to the type of data you want to visualize.
  • Writing code: The third option would be writing code (using d3, for example), but that’s not much of an option, because when writing code you need to be a programmer. You need to go through complicated vector math stuff (sometimes), you need to go through the API docs of the library you use. And if you finally wrote all that code to create your very special chart that works with different input sets of the same type, you’ve spent a lot of time writing that code, and while writing you were blind.

I really recommend all of the talks Bret Victor gave, but these are my Top 2. He has inspired many people to create cool stuff, for example:

Light Table

Have you seen this already? It’s a really good idea, and the creator said he was inspired by one of Bret Victor’s talks.

LightTable’s website

(If you want to take a look on what the idea is and how it looks, see the demonstration video)

About me

I haven’t wrote a Blog Post for a long time now… But I’ve been programming a lot recently. I don’t know how up-to-date you are, but I’ve been learning and programming a lot of haskell recently (It’s a purely-functional programming language).

Also, I now have “computer science” lessons at school (it’s called “Informatik Kurs” in germany…), which means I’m now also programming in school, not only at home ;). Basically we’ve learned about websites and webservers and html and php. After half a year of those lessons, we (the guys going to those lessons) were supposed to got together in little groups / teams, who develop a simple WWW solution for a problem. Our idea was a website where you could register and upload files, that are automatically encrypted (client side). You could specify what other accounts you want to share your file with or specify a group of accounts. If a file was sent to you, then you can download the file and decrypt it (on the client side), if the other user gave you the key for decrypting.

You can see our (we’re a team of 4 students) progress on our github repository (beware, it’s german ;) ).

It was already a really nice experience since we started writing. In the beginning I said I wanted to do synchronization between us using git and github. That was new to the others and a challenge for me, because we are also programming at school, and at school we are trapped inside the intra-net of the school together with a couple of entry points to the internet. That means we couldn’t directly push our code to github, but we found a solution, which works very well (I won’t describe our solution here, though).

Other Webserver Technologies

And since, after writing ~2000 lines of php code, I got really tired of a really badly designed language (see php, a fractal of bad design), I wanted to try out some alternatives :)


I’ve tried out NodeJs, but it feld kind of much more lower-level that what I was used to before. I should have - maybe - used Jade, but I’ve heard of it just after writing my test project

But all in all I felt it was much nicer being in a language like Javascript, but the weak typing was still bugging me, sooo…

Happstack (haskell)

…I tried out Happstack (see especially the page “why”). It’s written in haskell and you use it by writing haskell. Basically it’s a webserver library written in haskell.

It felt muuuuch nicer to work with it.

The biggest thing I hated, was that documentation is rare. Blog posts with examples aren’t a common thing, when it comes to haskell. Finding examples for happstack coding was not the problem. Happstack has kind of it’s own philosophy of how you need to write your code, and they don’t seem to think that SQL is a good solution for saving data. Therefore they created happstack-state, which was recently deprecated in favour of acid-state. Now the problem is, that even though a couple of blog post examples exist for happstack-state, almost none exist for acid-state, and finding example code was not easy …

But well, I got it working! :) Again, see my Test Project, written using (only) haskell, happstack-lite and acid-state.

What I really liked both about happstack and node.js, was that ‘setting up’ a webserver was muuuuch easier. In haskell you’d do:

runhaskell Main.hs (where Main.hs is your file with the Main module, starting the webserver, simply by calling serve serverConfig webpages)

And in node.js it’d be pretty similar:

node server.js

Both starts up a server at a port, given in code. I had to juggle around with 3 to 4 different config files when using lampp and not everything was working in the end (phpMyAdmin doesn’t work for me anymore :/ ), even though I only wanted to move the htdocs directory into my home directory…

If you’d want to move your webserver files on your server, you’d simply copy your directory to somewhere else, cd there and start the server with node / runhaskell.

All in all, I’ve had a lot of fun in 2013 and am having a lot of fun in 2014 currently, too :) (Also, the minecraftmonkeys (beware, it’s german again :P ) have started making youtube videos, too, which makes me really happy)

(I am sorry for this long, and not-well-structured and not-having-a-specific-topic blog post…)

15th January 2014

Link with 1 note

A Worst Case for Functional Programming? →

3rd January 2014


gef4k asked: Hi Matheus ! Thanks for comments and reblogging. I will post explanations on how rendering works, I also can give the sourcecode, but my 4k sourcecode is organized for final compression, so there are fews illogical stuffs in it !

Very cool! :)

I can’t wait to see how it works, your game is very inspiring and impressive!

25th December 2013

Video reblogged from Gef4K with 6 notes


Just to see it in action : In The Dark 4K - First level - Gameplay


Wow. Amazing voxel effect!

Have you released the source code / plan to do so? Are you maybe planning to create a library that allows rendering such things? Especially the lighting / raycasting is interesting to me. Would be cool to see something like that in OpenGL, too :)

Keep up that awesome work! :)

2nd December 2013


Crazy Haskell Type Signature!

pSwitch :: Functor col
        => (forall sf. (in -> col sf -> col (ext, sf)))
        -> col (SF ext out)
        -> SF (in, col out) (Event mng)
        -> (col (SF ext out) -> mng -> SF in (col out))
        -> SF in (col out)

From: FRP.Yampa.pSwitch

27th September 2013


Are buffer-overflows solved yet? A historical tale. →

5th September 2013

Post with 2 notes

Scala Units Of Measure with Value Classes

Today I’m going to talk a little about Value Classes in scala. The SIP was accepted, you can see it here:

It’s very useful since it allows unboxed units of measure and therefore type-checking your units while still running fast.

But fist, I’m going to explain one of the most relevant use cases to me, as a game developer.

The Viewport

Let’s assume you’re writing a game. In most cases today, you will have a world that is actually larger than what can be displayed on the user’s/player’s screen. So what you’re going to do is have a camera that pans around in the game world, and as soon as the player walks other parts of the actual game world will be viewed. That’s what most people call a Viewport (not talking about the gl viewport!). You can imagine a Viewport to be kind of a camera that views only a portion of the actual world.

A Viewport basically only stores the panning values (the x and y offset from the world origin) and, when rendering, moves everything to the right place. So when you have a character placed at position (100, 100) in the game world and your Viewport is offset at (20, 20), then the character is going to appear at (80, 80) on the screen.

Coordinate Spaces

So what we have now is two so called ‘spaces’ in which numbers occur. We have the ‘World space’-coordinates and the ‘Screen space’-coordinates.

The only problem that usually occurs is that when you sometimes directly supply the World-Space coordinates to the renderer, so your entity doesn’t get rendered properly. There is nobody and nothing that warns you from doing that. And you probably already wondered “What has that now to do with our value classes!?”, but that’s, finally what we use our value class for.

Using Value Classes for solving problems

(And reduce error likeliness)

What we do is, we create a value class for the type Float. You mark a normal class as a value class by extending AnyVal. You’ll see what effect that has in a moment:

class PixelsWorld(val u: Float) extends AnyVal
class PixelsScreen(val u: Float) extends AnyVal

Now that we have those, let’s define some game stuff that uses those classes:

class Entity(var x: PixelsWorld, var y: PixelsWorld)

// You need that layer of abstraction. It doesn't change
// anything, it just forces the "PixelsScreen" type
def draw(x: PixelsScreen, y: PixelsScreen) {
    drawActualImplementation(x.u, y.u);

def drawActualImplementation(x: Float, y: Float) = 
    println("Drawing at (" + x + ", " + y + ")")

And when we now try to call draw() with the wrong type, that means using PixelsWorld instead of PixelsScreen, the compiler will give us an error:

// You can easily feed it Float's and it'll accept them as PixelsWorld:
val entity = new Entity(10f, 10f)

// There doesn't seem to be anything wrong with this
// on the first glance, right?
draw(entity.x, entity.y)
:38: error: type mismatch;
 found   : PixelsWorld
 required: PixelsScreen
              draw(entity.x, entity.y)


Whenever we try to do dumb stuff, we actually get warned! We can’t compile then.

What we now have to do is convert our PixelsWorld into PixelsScreen somehow… That’s where our Viewport comes into play. We’ll define a method called ‘convert’ in the Viewport, that produces the right PixelsScreen positions when we give it the PixelsWorld position.

// The viewport itself has a position in the world:
class Viewport(var x: PixelsWorld, var y: PixelsWorld) {
  // (x, y) => (x, y)
  def convert(x: PixelsWorld, y: PixelsWorld): (PixelsScreen, PixelsScreen) =
    (new PixelsScreen(x.u-this.x.u), new PixelsScreen(y.u-this.y.u))

One little thing I’d like to add is an implicit value class (explaining it would be out of scope, though), which let’s us define the space with less code:

implicit class PixelsWorldFloat(val f: Float) extends AnyVal {
  // creates a PixelsWorld instance, 
  // by simply calling this method on floats:
  def pxWorld = new PixelsWorld(f)

val myPxWorld: PixelsWorld = 10f.pxWorld

(The exact same pattern applies to PixelsScreen)

This class, due to value classes, has no runtime overhead at all, too.

Now we have our complete, type-checking, unit-checking code:

val entity = new Entity(100f.pxWorld, 100f.pxWorld)
val view = new Viewport(20f.pxWorld, 20f.pxWorld)

val (drawx, drawy) = view.convert(entity.x, entity.y)
draw(drawx, drawy)

Other uses

Box2D Units

You have probably already heard, that Box2D doesn’t represent Body positions in pixels, but in meters. And usually you don’t want 1 pixel to be 1 meter, so you have to have some kind of conversion method there too. With units you could create the MetersWorld, the PixelsWorld and the PixelsScreen with conversion methods between all of those.

LibGDX Camera

The way I have set this system up in my game code that uses LibGDX’s OthogonalCamera is like this:

class Viewport(x: PixelsWorld, y: PixelsWorld, screenSize: ListenableProperty[Size]) {

  private val cam = new OrthographicCamera()
  val size = screenSize()
  cam.viewportWidth = size.width
  cam.viewportHeight = size.height

  def convert(x: PixelsWorld, y: PixelsWorld): (PixelsScreen, PixelsScreen) = {
    val vec3 = new Vector3(x.u, y.u, 0)
    (vec3.x.pxScreen, vec3.y.pxScreen)

  def convert(x: PixelsScreen, y: PixelsScreen): (PixelsWorld, PixelsWorld) = {
    val vec3 = new Vector3(x.u, y.u, 0)
    (vec3.x.pxWorld, vec3.y.pxWorld)

  // ...



You could create Units like Length, Time, Mass and then create more complex Units out of those: Area(Length, Length), Volume(Length, Length) or even more advanced like Newtons(Mass, Length, Time).

Though those might not be as ‘cool’ as the Measure type system in F#, where it would automatically know the type Length * Length * Length, without you creating a new Unit specifically for that usage.

Read more

SIP 15 - Value Classes Value Class Introduction

Another approach - macros:

Units of Measure -

Tagged: scalaprogrammingunits of measurementgame programming

2nd September 2013


All ways for foreach

Here are all syntactic ways of making a valid for-each in scala.

They all work.

val list = "abcdefghi".split("")

for (i <- list) {

list.foreach { i =>

list.foreach((i) => {

list.foreach((i) => Console.print(i))


I think it might even be very helpful to anyone learning scala, so they understand all that new syntax in scala (in comparison to java).

In the end I think every way of writing it has a specific purpose (I use every version except for the 3rd and 4th) and they make writing scala much easier.

You can put it straight into the repl to try it out :)

EDIT: This is also possible:


Tagged: scalaprogrammingloopscode

31st August 2013

Post with 1 note

You are probably better off using LibGDX and exporting to HTML5 than hurting your brain with Javascript. As for PHP, it does not even deserve my comment…

Yeah, but it’s not like I’m trying to be productive or something, I’m just trying out some other languages, and that’s fun! :)

Tagged: javascriptprogramminghtml5libGdx