2022 June 15 - 19:02 Super Adventure Hand!

My latest project, Super Adventure Hand is now public. It is still early in development though, but coming along nicely. More at: http://devmgames.com/superadventurehand/


2021 March 11 - 17:31 Debug vs release builds

I was using a “lazy” property (similar to Wheel1) in the hot path for a project, and when running on [POPULAR GAMING CONSOLE] the game was spending over a millisecond on just the null check according to the profiler. So decided to test how expensive the Unity null check really is.

TLDR: it’s not really a problem on release builds, using the Unity profiler for profiling scripts can be really misleading.

The properties tested:

WheelCollider Wheel0 => wheelPreCached;

WheelCollider Wheel1
        if (wheelLazyCached == null)
            wheelLazyCached = GetComponent<WheelCollider>();
        return wheelLazyCached;

WheelCollider Wheel2 => GetComponent<WheelCollider>();

WheelCollider Wheel3
        TryGetComponent(out WheelCollider wheel3);
        return wheel3;

The test results (10,000 iterations, times in milliseconds):

- Mac Editor

Wheel0: 0.1976
Wheel1: 0.5487
Wheel2: 0.6233
Wheel3: 1.3072

- [Popular console] Debug build (15-30x slower than the editor!! (very different hardware however) )

Wheel0: 3.1968
Wheel1: 16.0642 (null check is almost as slow as running GetComponent every time!)
Wheel2: 18.3008
Wheel3: 21.2258

- [Popular console] Release with "Explicit Null Checks"

Wheel0: 0.0015
Wheel1: 0.3846 (cost of null check is now tiny)
Wheel2: 4.2519
Wheel3: 5.1337

- [Popular console] Release without "Explicit Null Checks"

Wheel0: 0.0008
Wheel1: 0.3860
Wheel2: 4.9095
Wheel3: 6.1096

- Windows Release

Wheel0: 0.0030
Wheel1: 0.0692
Wheel2: 0.6131
Wheel3: 0.8053


2020 December 16 - 18:52 Angry rant about a bug

Angry and tired rant incoming!

At the end of a project a really nasty bug appeared, using a popular game engine and only reproducible on release builds for one of the main game consoles. To make it worse it required several hours of active gameplay to reproduce. And would go away if trying to reproduce on a debug build.

Day 1.
The symptoms of the bug is that you can suddenly, either on level load or mid level, no longer grab items or slap items and other players. Reloading the scene/level does not help, only way to solve is to completely restart the game.
First I assume this was due to some exception or other error happening but being hidden since it only happens on release builds with no debug. But after adding in-engine on-screen debug prints it became apparent that capsule/sphere-casts from the physics engine always return 0 hits once the bug is activated.

Normal raycasts seem to work though, since you can still jump and raycasting is being used to judge if the mover is grounded, will soon be grounded or was very recently grounded.
Since capsule/sphere-cast are only used at a few places, the first action was to replace capsule/sphere-casts with a bunch of normal raycasts, both methods that return multiple hits and as a fallback the method that just does a single hit.

Day 2.
Another day of testing and the results are that the new raycasts also stop working after a couple of hours.
But an interesting discovery is that slapping the mailboxes still work, also both grabbing and slapping things works normally in the two tutorial levels. And in one level slapping and grabbing actually works on one of the objects as long as it’s underwater.
Tutorial levels didn’t give me much of a clue, but the mailboxes are on another physics layer than the other items/players. So next step is to remove the layer masks and just filter the results when going through the hits, if there are any.
Water is using a trigger collider to detect objects and add buoyancy, so I tried adding an empty trigger collider covering the player as the maybe raycast only work if they start inside a trigger collider?

Day 3.
After one more day of testing the results are that while removing the layer masks didn’t solve the issue, the raycasts now start generating hits, but only on static colliders, seems raycasting only works against colliders that do not have a rigidbody attached to it. Which explains why the jumping still works as the majority of the ground is just static colliders. Same with the mailboxes, they are static objects.
Another new clue is that on levels with multiple floors the raycasting mostly works like it should on the top floors, but as soon as the mover comes down to the ground floor it stops working again.
The fact that it seems limited to the vertical axis and rigidbodies made me start thinking about the broadphase of the physics engine. While I don’t have the source for the engine, it seems likely that rigibodies would have a different broadphase test and for some reason after a few hours of playing on release builds the broadphase AABB testing would break down.
Using the standard broadphase type there’s no way to manually rebuild the broadphase data structure but when changing to multibox pruning there is. Calling this to rebuild the broadphase regions on each level load seems like a good thing to try.

Day 4-5.
After extensive testing over 2 days the bug can no longer be reproduced, seems changing the broadphase type and/or forcing a rebuild of the broadphase regions fixed it.
Everyone is happy, birds are singing, sun is shining (well, no, not in Stockholm). But damn these kinds of bugs sucks, especially on consoles.
Having source access to the engine might have helped, but finding and fixing a bug like this on a big engine would probably not have gone any faster than finding this workaround.

TLRD: on console release builds sometimes the broadphase on the physics engine of the popular game engine will stop working properly. Changing broadphase method and force a rebuild of the broadphase regions on each level load solved it.


2020 December 9 - 16:49 Moving Out!

Ok I’m not going to start with excuses about not updating this page.

Moving Out was released for Switch/Playstation/Xbox/PC on April 28th. And did really well both in sales and critical reception!
Metacritic (Switch) – https://www.metacritic.com/game/switch/moving-out

Here’s some images from PAX and some of the promotion:


2019 December 12 - 01:42 Moving Out

Wow can’t believe I have not updated this for over a year.

The latest game, Moving Out is almost finished now, and is coming out next year, on Nintendo Switch, Playstation 4, Xbox One and Steam.

I’ll try to write some more info about this project soon, there’s a lot to say. I started working on in 3 years ago!


2018 August 30 - 16:11 LateUpdate()

Damn keep forgetting to update this.
Cubor was released in February and has performed very well, with nice feature spots in the AppStore and a long continuing stream of downloads still going on.

Desert Worms has seen a massive increase in daily downloads, passed 3 million and is now close to 4 million downloads.

The big project is progressing nicely and will be officially announced soon™.


2018 January 21 - 15:14 Cubor

Silly Sailing has set sail and is now getting played by people all over the world.
More info at it’s minisite.

I’m working on a puzzle game, Cubor, it’s a total remake of an old flash game. I’m also adding new features and lots of new levels.
One interesting feature I’m working on right now is a level generator that can generate almost infinite amount of levels, great after you played through all the handmade ones.
See Cubor on it’s minisite.


2017 November 2 - 19:43 Silly Sailing

Silly Sailing is progressing nicely, I’ve put out a placeholder mini-site for it.

Also I made a pretty nice tool for generating/editing islands for it.


2017 September 27 - 19:45 Lots of stuff

Ops, forgotten to update this in quite a while.

Soo…. Desert Worms has gone pretty good on Google Play, about 1,2 million downloads and an avg rating of 4.2.

I spent a lot of time working on a the multiplayer PC+console game, it’s going to be really great. But release is still far in the future. More on that in some future post, since this arcade games has become really popular, but other Casino games like baccarat online are pretty popular among gamblers as well.

I’ve done a couple of prototypes, a city racing game, a snowmobile game, a traffic strategy game, and a forklift prototype. But none of them really worked out.

My latest game is a sailing game, named Silly Sailing, it’s looking really promising. I’m hoping it will be a quick project and should be released before the end of the year at least.
Here’s a gif of the first prototype, just 2-3 days into development.


2017 February 23 - 00:48 Desert Worms

Desert Worms was released in November, didn’t do too well on iOS but has been getting quite a lot of users on Google Play. Closing in on 600,000 downloads now.

During November I made two mobile game prototypes, but decided to discontinue both of them and instead focus on a larger game for PC and consoles.
Been working on that since December and it’s looking very promising. But it will take longer than I usually spend on a game.


2016 September 5 - 20:26 Next

About 70% done on the next game.


2016 September 5 - 20:23 Forky2 on Steam

Extreme Forklifting 2 is out on Steam since the 5th of August. And it’s actually doing really great.
Very much recommend playing it with a controller or racing wheel.


2016 May 19 - 19:09 Extreme Forklifting 2 is out!

Bom! Extreme Forklifting 2 is now available for iOS and Android!
Get lifting!


2016 March 25 - 23:23 Custom forklift controller

I felt like doing something new with my Arduino, so I made a custom controller for Extreme Forklifting 2. I had already bought a bunch of potentiometers for another project so it was a fairly quick thing to do. Communicating with Unity over the serial port.
And I’m using a circular neopixels set for the lights.


C# source:

Arduino source:


2015 December 27 - 13:34 Forklifting 2

Since I’ve been working full time as developer and co-founder with a new company since September, work on Extreme Forklifting 2 has gone very slowly, did manage to get some work done during x-mas.
I’m only putting in a few hours a week on this game, so it will take time before it’s finished.


2015 September 5 - 01:30 Updated font importer for Unity

Made an update to my font importer for Unity, lots of improvements. Still having to use deprecated properties however since there are no replacements in Unity5 (yet?).

Want bitmap fonts with an outline in Unity? Not as easy as it might seem since the built in feature for creating bitmap fonts packs the characters so tight that you can’t add any shadow or outline. And no setting to add padding.

So I made this little editor extension that makes it possible to import fonts created with tools like AngelCode Bitmap Font Generator or Glyph Designer. Anything that creates a .fnt-xml-file.

Here: FontImporter.cs


2015 August 27 - 19:34 Extreme Forklifting 2 under way

Work is progressing nicely with Extreme(er?) Forklifting 2.
Getting some really nice feedback from the people att reddit.


2015 July 10 - 02:58 Extreme Wheelchairing reviews

I’ve updated the Extreme Wheelchairing mini-site with some reviews and links to media coverage.
Extreme Wheelchairing


2015 July 10 - 02:56 Wall Bouncing released!

Released Wall Bouncing a couple of weeks ago.
Wall Bouncing


2015 June 12 - 14:20 Wall Bouncing!

I got a new game in the works, this is a pretty small and simple one, but quite fun,
Should be completed in the next few days.