polygonal labs

Tips, tools and techniques for making games with Haxe

Reassembling the polygonal library

I’ve just finished restructuring my library into smaller parts – this was necessary because the previous monolithic approach has become really hard to maintain. Now, I can push updates more frequently and adding new stuff should be also much easier. The various parts of the library are now hosted on github: https://github.com/polygonal. I apologize for …

Using sprintf with Haxe

In contrast to ActionScript, Haxe allows you to customize the trace() function to better fit your requirements. For example, you can format or delegate the input to your favorite logger, resulting in less verbose code. My library supports the sprintf syntax, so let’s take a look on how to use it seamlessly with trace(). First, …

A fast notification system for event-driven design

Back in 2009 I started to work on a custom solution for dispatching and listening to events. At this time I switched to the Haxe language, and so my main motivation was to write a cross-platform system. I also never really liked the event dispatcher in Flash – too java-ish and boilerplate heavy for my taste. I guess this is why other …

Introduction to ds

“Introduction to ds” is a slide presentation/manual about ds which I started last year. I never had enough time to finish it quickly so I wrote it now and then and just recently finished it. The presentation explains the concepts and design decisions behind ds, provides short code examples to demonstrate basic usage and covers …

Linked list performance

It’s a fact that haXe creates swf files running faster compared to mxmlc. Amazingly, haXe is also faster at compile time. But to which extent are haXe generated swf files faster? Optimizing code especially pays off for “low-level stuff” like data structures, the building blocks of many algorithms. With this in mind, I picked the doubly linked …

A* pathfinding with ds

I recently did a complete rewrite of my graph-based A* pathfinder example because I received a lot of questions on how to implement path-finding using the new ds library. So here is an updated demo that works with ds 1.32: Interactive demo: A* pathfinding with ds I’m transforming the point cloud with delaunay triangulation into …

Heaps and Priority Queues in ds 1.31

I recently revised and improved the Heap and PriorityQueue classes, mainly because the difference between both has always been somewhat blurry. The new implementations are included in ds 1.31, so let’s talk a bit about the changes. The Heap class By definition, a heap is a dense binary tree for which every parent node has …

Yo, Ho! Welcome on deck, deque!

The newly released ds library (version 1.3) now includes an efficient deque implementation. What is a deque? A deque is a double-ended queue and pronounced “deck”. In contrast to a queue, which allows insertions at one end and removals at the opposite end, a deque allows insertions and removals at both ends. The new Deque …

Simple 2D Molehill Example

Here is a minimalistic FlashDevelop AS3 project that demonstrates how to use the Molehill API to draw a single 2D sprite on the screen. You can get the project here: fdproject-mole2d.zip. Assuming you have followed the instructions below the result should look like this: Flash: Simple 2D Molehill Example To compile the example you need …

Fast hash tables

The Dictionary class – a dead end for other targets Recently I started to adjust my code with the C++ and JavaScript haXe target in mind. I have to say it’s really amazing to see your code running on different platforms. This offers an incredible amount of flexibility! While almost everything worked out of the …

Get Adobe Flash player