Tony Polinelli
Tarwin Stroh-Spijer

contact [at]

6/25 Easey Street
Collingwood, 3066
Vic, Australia

+61 3 8060 5321

Archive for April, 2009

Monday, April 27th, 2009


After only a day or two playing in hxcpp i’ve got my first little test to show – Jellyroids!

This gametest compiles (using haxe) out to flash & C++ (exe in the cpp folder for windows only – i dont have a mac or linux, so cant test as yet).

Running the software rendered c++ version is a little slow – ~200fps on my comp, opengl is ~1500fps. Whereas flash clocks in at 100fps (maxed out). Prerendering the explosion animation (currently vector animation from a swf) will make it MUCH faster for c++ (stop the slowdown on shoot), as i feel its vector animation code isnt anywhere as optimized as that in flash.

Overall, its fun to see how easy its been to get out a simple test in hxcpp.

download the game test here

cheers – Tony


to get it to work you need to change a few small things in the neash 0.9. realease.

There are two issues with the current release of neash that need fixing. Just change the following lines:

1/ in neash.display.MovieClip:
add in some stubs for functions (just copy in the following lines)

public function gotoAndPlay(frame:Dynamic, ?scene:String):Void { }
public function gotoAndStop(frame:Dynamic, ?scene:String):Void { }

public function stop(){}
public function play(){}

2/ in neash.display.DisplayObject:
make getRotation method look as follows:

public function GetRotation()
return mRotation * (180.0 / Math.PI);

Thursday, April 23rd, 2009


We've been recently looking at expanding our skills of games dev, to finally break out of Flash! (The whole platform that is.) Looking at Unity3D (seems to be a great platform) but also interested in getting a little closer to the root of most great games... C++.

Coming from a web background, and developing in Flash for about 10 years, I don't want to abandon all of my existing knowledge, and quite frankly, after learning C++ for a few days, it looks kinda clunky - or maybe just scary ;P

Luckily, Hugh Sanderson has been developing a C++ target for haXe (the open source Flash compiler) which after a little testing seems to look like it will take a LOT of the pain out of the transition.  For those who don't know, haXe is a multipurpose compiler, it can compile code, similar to ECMAScript, to many targets. Some of these being:  SWF bytecode (which out performs the Flex and Flash compilers),  JS, PHP, and more. This new C++ target will allow people to build a game which can compile to a SWF & C++.  Why would would a C++ and SWF output be good you ask? If PC, Mac and Linux arn't enough, iPhone can natively run c++ for instance.  If we want to make a game which will need more performance than Flash can offer or just want to target C++, at the very least it will allow us to develop games in the same style, and code base, as our existing efforts.

Many of the technicalities are still being worked on as the project isn't fully released as yet, but there are some great 2D tests, and some varying in progress OpenGL 3D. I was amazed that Hugh has even included a SWF reader in neash which will allow import of SWF assets and animations to your C++ games - wow!

Getting stated with hxcpp (haXe C++)  with Visual Studio C++ Express

I've been through some trials working out installation (as I've never compiled C++ before),  so i thought it would be good to share my findings for other noobs ;P

So without further adieu here's what you do.

haXe installation and setup for hxcpp

  1. Download and install haxe
  2. Access the the windows command prompt (console): Start->Run->"cmd"
    note you will have to close and re-open the command prompt after making any changes to environment variables before they will take effect in the command promt
  3. Type "haxelib install hxcpp". This will install the hxcpp library for haXe.
  4. Type "haxelib install neash". Installs the neash library.
  5. Type "haxelib install nme". Note this may already be installed as a dependency.
  6. Open your System Properties dialogue (Start->Control Panel->System), go to the Advanced tab, and then click Environment Variables button. Here we'll be adding some environment paths. You can add them either in the User variables (the top list, which will only work for the current user) or System variables (the bottom list, which work for all users).
  7. Set an environment variable called "HXCPP" by clicking New under the list and entering Variable name "HXCPP" and Variable value to hxcpp install directory ie:  "C:\Program Files\Motion-Twin\haxe\lib\hxcpp\0,4"
  8. Add "%HXCPP%" to the PATH variable, making sure that it is seperated with a ";" and no space.
  9. Add "%HXCPP%\bin\Windows"  to the PATH as well. This is so haxecpp.exe can be found.
  10. Type "haxecpp" in the command-prompt to check if it finds the compiler

Microsoft Visual Studio C++ Express intallation and setup

This is how to setup MSVSC++ for command-line compiling:

  1. Download and install Microsoft Visual Studio C++ Express from
    Once these are installed, we need to set up some Environment Variables to help it work. As far as we can tell it's meant to do thi stuff itself, but never seems to.
  2. Add vc\bin (location of vc.exe) to the user PATH  eg: "C:\Program Files\Microsoft Visual Studio 9.0\VC\bin"
  3. Type "cl" into the command-promt. This will see if your C++ compiler is working correctly. It will probably throw an error, saying that it cant find some DLLs.
    1. If you get the error run the cl setup eg:  "C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat"
    2. Run "cl" again. If you still get the error, follow next step.
    3. Add Visual Studio 9.0\Common7\IDE to the user PATH (similar to before)  eg: "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE"
    4. Run "cl" again, and you should get the compiler usage message.
  4. Add an environment variable INCLUDE which points to the vc/include folder eg: "C:\Program Files\Microsoft Visual Studio 9.0\VC\include"
  5. Add an environment variable LIB which points to the vc/lib folder eg: "C:\Program Files\Microsoft Visual Studio 9.0\VC\lib"
  6. Add another path to the LIB variable to points to the folder containing kernel32.lib eg:  "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib"
  7. For the hxcpp 1.0 release you also need another step
    Add another path th the INCLUDE which points to the SDK Includes - eg.   C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include

Now you should be ready to compile some C++!

You may find you have to restart your computer for the Environment Variables (PATH etc) to take effect globally in your system. No idea, but restarting Windows seems to fix it.

Hello World Test

make a main class


  1. class Main
  2. {
  3. public static function main()
  4. {
  5. trace("hello world");
  6. }
  7. }

I tried to get hxml files working on my system (assign 'open with...' to the haxecpp.exe, but it kept reverting to haxe.exe) so you can use a simple batch file as follows. Note the "-cp" command tells the compiler where to find the standard libraries for the new hxcpp.


  1. haxecpp.exe -cpp cpp -main Main -cp "C:\Program Files\Motion-Twin\haxe\lib\hxcpp\0,4\std"
  2. cd cpp
  3. nmake -nologo
  4. Main.exe
  5. pause

This should compile the haxe, compile the cpp, run Main.exe and pause to show your trace.

Compiling the neash and nme examples

Remember to check out the neash and nme examples (found in the haxe/lib/xxx/samples  folders)  to see how to get started.

Just make a make_cpp.bat which compiles the haxe, as the .hxml would have, then compiles as per the previous example

Compiling with FlashDevelop

In flash devlop you can use the Build tab (project->properties->build) to set off the haxe & c++ compilers this will allow you traces in the results tab too. Use the make_cpp.bat from before:

in the build put:


This will put all trace commands in the results panel. If you start to do things like include files, or loops - basically most more advanced things, the results might start to not show up - I'm not too sure how to keep them coming up in here - like how neko examples have a window for traces, and a window for the app - Hugh - any ideas?

Remember that you might need to restart FlashDevelop for all PATH and Environment vars to take effect

Also, Check out GameHaxe for more about hxcpp

Now that i've got this all working, i just need to find some time to make something cool!


Tony - Touch My Pixel

Saturday, April 18th, 2009

Its finally time! The Scarygirl project has been in the works for about 2 years, in production for about a year and a half, and in my nightmares for quite a while. So, we are slightly excited to see it out in the wild... and not on our todo lists :P

We have been surprised by the reaction so far, 200,000+ plays in the last 3 days. We've had to upgrade servers twice, and are rapidly making some fixes to bugs and improvements to gameplay.

As a bit of background, the project is based on the concepts and designs of Nathan Jurevicius. He is a comic artist from Melbourne, Australia, but living in Toronto. The character Scarygirl has had quite a journey over the last 10 years, but is finding her feet in this online game (Funded by Film Victoria & Passion Pictures), soon to be released graphic novels, and an upcoming feature film. We had the opportunity to work on the project due to our friend Suren at Renmotion, and his contact with Nathan.

The project has stretched our skills and through its arduous process, we've learned a lot about planning, designing and developing a game. TouchMyPixel is only two people (Tarwin & myself) so the project was a huge workload. We have a background in Flash development, design, and smaller advertising style games, but not a larger scale game of any sort. Scarygirl, in its essence was only planned to be a 9 month project (sorry Sophie), but I think, in our excitement of making a "proper game", not what people generally see a flash game to be, we overshot the timeline a little. We tried to give the game a depth which most Flash games don't have, as it seems most flash games are focussed on being small, fun snippets of a game. We wanted to produce a full experince. I think everyone on the project felt this way, and wanted to push themselves and the project.

The game is quite artwork driven, which is obviously one of the major requirements (being to promote Nathan's artwork). This challenged us with the task of designing a world which would well reflect Nathan's irregular style while keeping farmiliar game mechanics. We spent a lot of time finding ways to faithfully display his artwork. For instance, we wanted the character to be able to walk over irregular surfaces, surfaces we could quickly mockup in Flash to match to the artwork as needed.

Our first stage was conceptualizing what each level would entail (or even if there were "levels"). Nathan had given us a basic ideas for some levels, and a pre-release of the graphic novel for story reference. Then it was up to use to sketch out some levels. We wanted to incorporate adventure game elements to highten the journey aspect, but also keep with traditional platform style gameplay. From sketches of characters, we would decide how they would fit into the world and react to the player. After producing mock levels without artwork (see non-graphical demo), we handed over level designs to Nathan to have them beautified. At this stage we often had NO IDEA what a level would look like, which gave us the joy and sometimes suprise when we finally saw what a level really looked like; we may have just drawn a small brown patch for tree which would come back as a beautiful peice of art. This was wierd, and made level design hard, as we really didnt have much of a concept of what we were designing, or more to the point were worried that our concepts was wrong.


Progression of level design: 1. sketch  2. level in Flash  3. artwork overlay  4. final product

After getting the graphics and adding them to levels, we found that the game ran at about 1FPS. Which was a slight issue. This brought us to the stage of optimizing, refactoring, and rebuilding all of the levels to work with graphics. In the end all of the level graphics are pre-cached as tiles of bitmaps (starting as vector to save download), as the level might be up to 20,000 x 20,000 pixel in some cases. The bitmaps then have effects such as noise and glows applied to more closely replicate what Nathan is currently doing with his art. Some levels such as the peninsula (Escapade) have multiple levels of background and foreground. We then started adding the animated characters and enemies and found they too slowed the game to a carwl. So all of the animations needed to have each frame pre-cached as well, and kept in a frame cache in memory. Every sprite then works off the same frame information. With all of this caching some levels started to take up to 600mb of memory... which was the next issue. After overcoming the many trials of technically getting the game working, gameplay testing and debugging proceeded for about five months.

As i stated earlier, we've learned a lot about planning and developing a game, and think we'll fair a little better in the future. As for Scarygirl, a standalone version might be on the horizon. We'd also love to look at other platforms too, such as iPhone; not sure if i want to learn Objective C too quickly though.

Well its good to see it released. We are still be making some notable tweaks, and are taking users comments into account, so the job still isn't over yet, but there's light at the end of the tunnel.


Tony - TouchMyPixel

Our Friends:

Powered by haXe / poko cms | Copyright 2008-09 TouchMyPixel