Tag: C++
Hello friends, today I want to talk about board games.
Well, not really, but let’s briefly discuss that I made one.

I’ve spent a lot of my downtime the last few days crawling through C++ in a debugger and gathering crash data via adb from my tablet with the aim of fixing threading bugs! A few core classes lightly stripped down and occasionally rewritten, a few things jiggled about and we have something that’s stable [on Windows].
I left several copies of this code running the other day as a test — none explicitly crashed, although there are persistent memory leak issues over time which eventually lead to a freeze on the second thread, which does a lot of the work.
But in my testing all the sessions ran for at least half an hour at double speed (only a debug option right now, sorry), notching up an impressive health of over -5000. Besides the threading fixes everything else is basically the same as in the previous demo, so still lots of unfinished/unfixed/placeholder content and code.
Within the nme.geom package of Haxe NME you’ll find Matrices, Points, Vectors, Rectangles and… ColorTransform? It seems a slightly odd place to put it but it can be useful in your project to dynamically alter object colours. I wanted to talk briefly on how I’ve used it across my previous Pinball project and now, in Tower Defence.
Sometimes you want the same object to appear multiple times in your project, but with subtle variations. Behavioral changes can be accomplished in code by subclassing, size variations by scaling, but what if you wanted it red in one instance and green in another?
Including the same image twice with different colours feels redundant even if the images in question are quite small, so what are your options? In Pinball I used ColorTransform to colorize the lights and lighting effects with the image files themselves being greyscale. Now in Tower Defence I’m using it on some UI elements (the slider knob’s that change colour dependent on value).
Let’s step through how this works. First, of course, you have to create a graphic you want to use. Here’s the image of the slider knob in Tower Defence, as it came out of Photoshop…
Thanks, as seems increasingly usual, to Joshua Granick for writing about another awesome Haxe feature that works so well with NME: Inline C++!
This seems so obvious! It compiles to C so why can’t we throw our own stuff in there? Obviously you sacrifice the niceties of a higher level language like Haxe: Vague compiler errors and manual memory management abound, but it’s worth it sometimes.
For example: My first thought, since I’ve been implementing around it for some time, was to try and implement game saves on my HP TouchPad. I actually tried to use NME’s extension system to implement this a few weeks ago and got nowhere, so I wasn’t sure what to expect. I wanted to call into the webOS API to get a safe path using PDL_GetDataFilePath(), then write a string out to a file, and in a second function be able to read that string back.
Today I want to briefly talk about a cancelled project from around the time I finished University. Myself and a friend began building a game for this new platform called Windows Phone.

Continue reading “Canned WP7 RTS game”
