24.5.23

huntsman: language agnostic data-driven code analyzer

Motivation for this project has been the vast amount of multiplatform code at work and a desire to visualize how each class and project depends on one another.

This code at work is written in transpileable java code and up to 5 other native languages, all mixed together.
The idea was to write a source code analyzer able to parse all different languages used, extract some common features and then visualize it as a graph.

overview
source code: https://github.com/ScrambledRK/huntsman

2.7.16

Gradle/Intellij: unsupported major.minor version 52.0

Just spent way too many hours figuring out why all of a sudden Intellij complains about not having the correct JDK set. I do have the correct JDK installed, all my environment variable paths are correct. Why is it complaining?

Turns out I was suddenly starting Intellij in 32bit instead of 64bit, but my JDK is a 64bit version. Starting idea64.exe and everything works fine again.

The more you know ...

2.7.14

Orthogonal Polygon Partitioning

I got a request to implement an algorithm which divides a polygon into rectangles. The polygon only consists of right angles and no holes. The least amount of rectangular shaped partitions is desired. And oh boy was it fun!

The source-code for Haxe, PHP and JS as well as a Flash-AS3 demo can be found on my Git-Hub.

input, divide, extract, result
  1. traverse the polygon clockwise and find vertices with counterclockwise rotation
  2. split the graph from those vertices to any direction
  3. pick a vertex and traverse the adjusted graph clockwise to build your rectangles

11.3.14

The Banner Saga

I recently played The Banner Saga, a role playing game set in an viking legends inspired fantasy universe telling an epic adventure about survival and an inescapable upcoming war. Its core game play mechanics are dialog decisions and turn based strategy fights. The gripping story, slow pacing, dire atmosphere and beautiful art direction are outstanding.


It is a well crafted creative game experience that captured me emotionally and left me in awe. In this article I'd like to describe why it has been such an great adventure for me opposed to an objective professional criticism or analysis.

7.12.13

Unit-Tests via mUnit

Nearly a year ago I started to experiment with 3D in Haxe targeting Flash/AS3. I had no prior experience with it and I also had no idea how complicated and terrible interrelated a rendering engine can be. I downloaded all kinds of Engines and tried to reverse engineer their approach and supplemented it with a book about real time rendering. At the end I managed to render a static model with one direct light and a virtual camera. (the link works, it just takes forever)

Now a year later I'm trying to refactor the whole mess. I already had a GitHub project and forked it for the refactoring but somehow managed to lose it. or well ... fuck the repository up so much that it felt easier to just create a new one and used the opportunity to try a few new things out:
  • Build automation via Jenkins
  • Unit-Tests  via mUnit

21.11.13

Setup Jenkins and connect with GitHub

I just setup the build server Jenkins (locally) and successfully connected it to my GitHub projects.
It is actually pretty easy but there are ofc. always things you need to put your Google-search skills to use.


Here are some issues I had to deal with and how I solved them:

  • I changed the default global security settings of Jenkins and while at it also checked the "prevent cross site request forgery exploits". Turns out that's a bad Idea if you want to use the GitHub service hook.
  • When trying to run my build-script, Jenkins couldn't find the haxe-command to compile although I could run the script and Jenkins was running on the same machine. I checked Jenkins "System Informations" and found out that my environment variables where not set for the system-user of my OS Jenkins uses but only for the one I was logged on. Apparently there is a difference. 
  •  Submodules are not cloned correctly by default and I had to add an additional build step to update the submodules. In order for them to work I had to change the submodule-url from git@ to https:// 
  • PSExec is a useful tool to test your batch calls with the System-User Jenkins uses.

Terrible short and I guess no one will ever know what was going on, but I guess I rather post something than nothing at all. Maybe it will save myself some trouble sometime in the future. x)

21.2.13

Lazy Evaluation

If you've ever worked with Flex Components you will know by heart what lazy evaluation is, as it is a big dogma streching across all components. But lazy evaluation is pretty common and usefull in all kinds of applications. The idea is to delay calculations/operations till the moment you actually need them done.

A simple example is instantiating when accessing the object:
public function myObject():Object
{
 if ( this.myObject == null ) this.myObject= new Object();
 return this.myObject;
}

Output as Argument

Considere a simple mathematical function like add() or multiply() for a simple 2D point object. How would you implement it in case you cannot overload operators?

Do you manipulate the values of the caller with those from the argument, like a += b?
Do you make it a static methode and require 2 argumets? Do you instantiate and return a new object?

3.11.12

Voxel Performance

In my previous post about the voxel prototype  performance was not a concern but this time I'd like to share a brief explaination about the two basic optimizations I did to boost performance significantly:
  • y-buffer: only draw visible pixels
  • setPixels and direct memory access

31.10.12

Image Partitioning

Image compression and compression in general is a really interessting topic and although the algorithm I'd like to talk about goes into that direction the algorithm is not meant to be a compression in terms of memory but has been born out of the idea to reduce drawing calls by drawing as big rectangles as possible instead of each pixel on its own.

The problem to find as big same colored rectangles as possible in an image quickly became so interessting, that I decided to try it, even though I didn't know whether it would be faster or not.

result, heuristic and source

30.10.12

Isometric Voxel Terrain Prototype

I'm currently prototyping a voxel based isometric renderer (for terrain) and it was suprisingly painless to get some neat looking results but it is far from fast and scaleable. But the performance issues are topic for another post and would require further investigations and coding sessions. For now I'd just like to share the results and give and explain a bit how I've done it.

voxel and normalmapping rendering results with different lightning and maps

The renderer works just like a combination of displacement and normal mapping but 2D.
It takes a grayscaled heightmap and uses it to look up how much each pixel needs to be moved up. It also uses a normalmap to calculate the intensity for each pixel based on the current light-direction.

20.10.12

"Fullscreen" for HTML

In my previous post I wrote about how I encountered a few issues implementing a very basic stage setup for my Haxe library and explained how I solved a particular type error. In this post I'm going to show how I made a "fullscreen" HTML application, using the normal compile process NME provides.

The NME compiler uses a *.nmml document for various target settings, including the window size of your applications. So my first guess to make my HTML programm fill the entire browser was to specify the width and height in the application.nmml to 100% like I would do in CSS/HTML.
<window width="600" height="480" if="flash" />
<window width="???" height="???" if="html5" /> <!-- how 100%? only INT allowed ... -->
But using the % character causes errors when compiling for HTML. Another way would be to simply change the generated index.html but although the index might not need to be generated, it will be every time you compile and replaces any change you might have made. Not so cool :|
<div id="haxe:jeash" 
     style="background-color: #FFFFFF; width: 100%; height: 100%" 
     data-framerate="60">
</div>
Maybe there is a way to prevent the compiler from replacing your index.html but ideally I would be able to change the dimesion at runtime anyway. 

Jeash StageQuality; Enum or String?

The last day's I've been playing with Haxe and NME without any specific goals. Now I'm starting to code myself a very basic library, similar to my AS3 one. But already after a few lines I encountered some problems regarding the stage setup for HTML.

In this post I'm going to write about a minor jeash specific type error "String should be StageQuality" I got while implementing the basic stage setup and its solution. Although its really simple I felt like sharing.

16.10.12

Haxe + NME: First Steps

I'm currently looking for a smart way to carry all my practice and experience with ActionScript over to other platforms. Haxe, a powerful language able to cross compile into several languages and even mobile platforms seems to be just that. The syntax is similar to ActionScript but with lots of sugar on top. It also supports the main targets I'm interessted in: Flash, Android and HTML/JS/PHP. 

NME:
At first I thought I would be able to use the same API for all languages, but with Haxe alone you need to use quite a lot of language specific packages in order to compile to your target correctly. I also hoped I would be able to generate and manipulate HTML directly, but unfortunatly it does not provide a convenient way to do so ... unless you use it with NME.