Tony Polinelli
Tarwin Stroh-Spijer

contact [at]
touchmypixel.com

6/25 Easey Street
Collingwood, 3066
Vic, Australia

+61 3 8060 5321

Archive for the ‘haxe’ Category

Wednesday, July 22nd, 2009

We might start throwing up some tests of games we’re working on. I hope it will be good to get some feedback – but keep in mind, this IS in development, so go easy ;P

So – whats deadsun? Thats the codename (hah how mysterious!) for my latest game, Tarwin is working on a few other things. It will hopefully be release on the iphone too (hence the format).

The sun is dead, and post apocolyptic radiation is pouring out of the sky. You need to gather it to your cities to power them. In this test, you can play with the mechanic of collecting energy from the black-holes which expel it. There will be more advanced levels to come, which involve protecting the cities, tba.

Use Keys 1-8 to flick between the levels.

NOTE: please view this on its own page (not with all other blog posts) as it probably will run slow otherwise – we are working on fixing this weakness of our blog.

UPDATE – I HAVE TAKEN THIS TEST DOWN UNTIL WE DEVELOP THE GAME.

Saturday, May 23rd, 2009

After the haxe meeting last saturday night, i was excited that the topic of targeting the iphone was brought up. This could cause a lot of adoption of haxe as a language. Being able to develop games for flash and Iphone at the same time would be perfect and something lots of flash game developers would love!

I tried my hand at compiling c++ into and ObjC wrapper a few weeks ago, and in my inexperience… failed miserably. Hugh (the haxe C++ target creator) has taken the challenge, and in the last few days, successfully made some first tests for haxe C++ on the iphone. Hopfully over the next few weeks everything will continue to come to plan (and more people just on bord for testing and dev) and we’ll have an iphone target :P

I cant wait to get a chance to do some testing (looking to buy a macbook next week when we go to LA for e3).

read about it here:

http://gamehaxe.com/2009/05/22/haxe-on-iphone-simulator/

cheers

Tony

Monday, April 27th, 2009

jellyroids-01

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

UPDATE:

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

hxcpp?

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 http://www.microsoft.com/express/vc/
    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

Main.hx:

Actionscript:
  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.

make_cpp.bat:

CODE:
  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:

make_cpp.bat
cpp/Main.exe

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!

Cheers,

Tony - Touch My Pixel

Our Friends:

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