On “You can’t make good HTML5 games in Haxe”

You can't make good HTML5 games in Haxe

- A phrase usually popping up when it comes to a discussion about HTML5 and Haxe. Which is complete nonsense. Not just that it is nonsense, but it's also a good measure of how little (read: none) research the author of phrase has made on the topic. I'm quite tired explaining to people, why their opinion about this is incorrect, so I've decided to group key points into a post,

Continue reading

Introducing: OpenFL-bitfive

OpenFL-bitfive logo

Today I'm officially releasing OpenFL-bitfive, an alternative backend to OpenFL-html5. Similar to standard backend, OpenFL-bitfive assists you at creating HTML5 games (apart of standard Flash, Windows, Mac, Linux, Android, iOS, [...] ones) with use of comfortable Flash-like OpenFL API. A difference is that while focusing only on certain feature set, OpenFL-bitfive reaches quite higher performance and compatibility in its niche, also making it possible to develop mobile HTML5 games using the framework. This post goes in-depth about it.

Continue reading

Haxe: migrating For-loops

Migrating from C-styled for-loops to Haxe for-loops

If you are migrating to Haxe (or just porting an existing application) from another C-like language, such as JavaScript or ActionScript, you may have already noticed that for-loops in Haxe differ a bit from standard format that you would expect to see in languages of this type. To be precise, they lack common 3-statement format support. This article is dedicated to different methods of "migrating" your for-loops without rewriting contents entirely.

Continue reading

Haxe: Replacing NME/Browser (Jeash)

If you are working with HaxeNME, you might have noticed that compiled JS/HTML5 applications do not necessary work same as other platforms. Or don't work at all. Or don't compile because of some uncommon unimplemented method that you've used.
Reasons of such behaviour are even somewhat understandable - process of recreating Flash API on JavaScript+HTML5 isn't exactly an easy task, especially since multiple features do not exist in both of two in the same way or do not exist in second at all, meaning that implementation may require a trick or two to work.
And as code base is accumulating "tricks" by multiple contributors, it does not necessarily remain entirely stable.
For example, if you've decided to clear your BitmapData-based 640x480 buffer via BitmapData.fillRect, you are making a huge mistake - the function is not just doing this pixel-by-pixel, but also via ImageData API.
Overall, this article is dedicated to substituting Browser/Jeash part of NME by your own library in JS compilation.

Continue reading

Vector: Haxe icon

Haxe vector icon

Recently I was searching for at least relatively high-definition icon for Haxe (programming language), and found that there ... just isn't one. The best I could find was icon used on someone's blog, and that had white seams at shape intersections (suggesting anti-aliasing problems).
So I've made one.

The whole icon (after a few manual optimizations) is 1108 bytes, is in SVG format, and seems to meet proportions of original perfectly.
Also sections of icon are made to partially overlap "behind the scenes" to avoid earlier mentioned white seams on shape boundaries.

Download PNG Download SVG

Alternatively, if download links are not working, here's SVG code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
	"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
	xmlns:xlink="http://www.w3.org/1999/xlink"
	width="128px" height="128px"
	viewBox="0 0 128 128" xml:space="preserve">
<g>
	<rect fill="#f7941e" width="96" height="96" x="16" y="16"/>
	<polygon fill="#fdb813" points="0,0 4,32 16,64 64,16 32,4"/>
	<polygon fill="#faa61a" points="0,128 32,124 64,112 16,64 4,96"/>
	<polygon fill="#f36f21" points="128,128 124,96 112,64 64,112 96,124"/>
	<polygon fill="#f58220" points="128,0 96,4 64,16 112,64 124,32"/>
	<polygon fill="#ffcb08" points="0,0 64,16 32,0"/>
	<polygon fill="#fff200" points="0,0 0,32 16,64"/>
	<polygon fill="#fff200" points="0,128 16,64 0,96"/>
	<polygon fill="#f4813c" points="0,128 32,128 64,112"/>
	<polygon fill="#f7941e" points="128,128 64,112 96,128"/>
	<polygon fill="#f15922" points="128,128 128,96 112,64"/>
	<polygon fill="#f15922" points="128,0 112,64 128,32"/>
	<polygon fill="#ffcb08" points="128,0 96,0 64,16"/>
</g>
</svg>
 

Haxe: Neko Server-client communication example (chat)

Recently I've been searching for examples of client-server communication in Haxe, however could not find anything specific. After some search and asking around, I was pointed to sys.net.Socket class, but the actual means of usage remained unclear. It was also confirmed to mirror POSIX socket functionality. Indeed it does that, though, given that Haxe implementation uses exceptions rather than return values, usage remained uneasy.

After some experimenting, I've figured a semi-simple way of using "blocking" sockets.

Continue reading