What is the equivalent of FlxState in Heaps.io ?

The Heaps.io library is a great gamedev tool for both 2d and 3d projects, however, the documentation is severely lacking at the time of writing this blogpost. It took me a while to find the answer to the question in the title, so I wanted to share this with you here, in the hope to help some other people who are searching for how to manage state in Heaps.io like in Haxeflixel on the Internet.

In HaxeFlixel there is the FlxState class which you can use to control the state and scene of your game. There is something in similar in Heaps.io.

import flixel.FlxState;
import flixel.FlxG;

class StartState extends FlxState
{
    override public function create():Void
    {
        super.create();

        // Go to menu state
        FlxG.switchState(new MenuState());
    }

    override public function update( elapsed:Float ):Void 
    {
        super.update(elapsed);
    }
}

Below you can see how you would achieve more or less the same in Heaps.io. Please note that the two game engines are different, so there are differences in the features provided by each class.

// Extend hxd.App instead of FlxState.
class StartApp extends hxd.App 
{
    // Use init() instead of create().
    override public function init() 
    {
        super.init();

        // You can switch 'App' like you would switch a FlxState.
        new MenuApp().setCurrent();
    }

    // The update function works the same.
    override public function update( elapsed:Float ) 
    {
        super.update(elapsed);
    }
}

There is this post in the Heaps.io community forum which gives some insight as well into several other properties of FlxState that work differently in Heaps.io, but it does not state explicitely that hxd.App works similar to FlxState.

Gold Bar Maze

A short maze game where the goal is to find the gold bars in the dungeon hidden somewhere in the forest.

This game was designed for the Linux Game Jam 2019 on itch.io. It was developed using open source tools: Haxe, HaxeFlixel, Lime, Tiled, Gimp, and Vim. The game ended up on the 25th place out of a total of 33 submission. You can download the Linux version of the game at kcnh.itch.io/gold-bar-maze .

It has been a while since I have released a game. The purpose of creating this game was to experience participating in a game jam. In addition, I have never actually released a non Flash game, so this was a first in that respect as well. The hardest part was creating a game from scratch within a week. Unfortunately I did not have a lot of time to spend on this due to other obligations in my life. I’ll keep an eye out for other game jams to join, since I did like the challenge.

Website update

The website has been updated, as well as the blog theme. The comment section broke during an upgrade to a new WordPress version, and I was unable to fix the old theme. The theme you are viewing now is the default WordPress 2019 theme. Both the website and the blog are now responsive, meaning that you will be able to view them easily on your phone as well. The goal of the update is to give a better overview of the games, as well as a timeline and any awards that were rewarded to the games. I have added a screenshot of the before and after to this post for archival purposes.

Above, the new website layout, and below the old one which was used from April 2013 up until now.

You can view screenshots of the old layouts in this post: https://www.kcnhgames.com/blog/?p=1220

Letter for Mimi 3 – wip #9

The video shows some work I have done to make Letter for Mimi 3 into a strategy roleplaying game. Currently you can take two actions: wait, and attack. The former does nothing and the latter will damage the target of the attack. An enemy creature can also surrender as an action. A lot more work needs to be done to make this a full game.

Strategy game

As another side project I’ve been working on: a small strategy game. You can select the characters by dragging the mouse and then order them to walk somewhere. There are two types of buildings you can place, but they don’t do anything yet. The idea is to chop wood and mine gold and stone and then use that to create an army to crush the opposing team, but that is all a long way coming. The art comes from Kenney.

Voronoi lag

As a short break from working on Letter for Mimi 3, I’ve restarted the voronoi game (but this time with version control). The engine has been ported for as far as was possible to HaxeFlixel, this should allow the game to run native on Linux, Windows and Mac. At the moment I’ve only tested native on Linux, and some performance tests have shown that it runs about 4 times faster than the Neko target.

The game generates a set of points (settlements) and then calculates the Voronoi cells (provinces) with as centroids the settlements. This works well for large amounts of points (e.g. 512). However, when it attempted to create a FlxSprite and a polygon representing the province it crashed when there are more than about 100 settlements.

voronoi 2017-03-05

As far as I know Flixel should not render sprites which are off-screen, and I assume this also applies for HaxeFlixel. So the number of sprites should not be an issue. The polygons are drawn on top of an empty graphic the size of the game world. This is what caused the lag, as it might thus generate more than 100 sprites sized 3840 by 2160. As these sprites need to be unique so they can be manipulated later, they are all stored in memory separately, this is way too much even for a computer with 8 GB of RAM. I ended up solving this problem by drawing the polygons on a graphic with the size of the maximum polygon size and moving the graphic from the origin to the place where the origin of the polygon is.

Letter for Mimi 3 – wip #8



The video above shows smooth resizing of the arcana and health bars. The text now also has an optional typewriter effect. A health potion is used on one of the monsters and you can see the health bar increasing afterwards. The smoothing thus works both ways. The number of experience points earned are now also shown after an enemy monster has been defeated. The level up sequence now also has an option to select which stat to upgrade of the monster: agility, arcana or stamina.

Letter for Mimi 3 – wip #7

First of all, I would like to wish everyone a happy 2017! Second, I’ve recently managed to get some more work done on Letter for Mimi 3, and was able to capture this in a short 1080p video.

The video above shows the monster tubes in the battle layout and the changes made to the width of the menu’s, as well as the addition of the monster’s level to the info bar. When a monster is fainted its name will be greyed-out in both the menu and its monster tube. The video also shows a new star-like monster I’ve created, named ‘Star’. At the end you can see part of the level up dialogue that I haven’t finished yet.

Letter for Mimi 3 – wip #6

This video might seem a bit different than the previous one because I have restarted the project in HaxeFlixel instead of Phaser. The choice was made because it should be easy to target both the web and native platforms using HaxeFlixel instead of Phaser, which is only focused on the web. Haxe(Flixel) uses a syntax much like Actionscript 3, so I got used to it quite fast.

For now I will focus on getting a battle engine running once again. As can be seen in the video, there is still a long way to go but the basics are there.