Blog

Removing bodies in Box2D

Hello, today I bring you another lesson learnt.

When you choose Haxe for a project there are a few 2D physics engines available, mostly ports of other popular engines like Box2D. There are actually a few distinct ports to Haxe of various versions of B2D, but the most up-to-date and the one I’ve been using is Joshua Granick’s port of 2.1a. You can get it from Haxelib by opening a command prompt / terminal and running “haxelib install box2d”

In brief, it’s fantastic. Once you get a handle on how it works and where all the bits you want to use are it’s pretty simple, a far cry from the engine I initially experimented with – Physaxe – which was basically 20 pages of pure maths disguised as classes and functions! But there are some small issues I’ve run across while using it, and here comes the latest.

Continue reading “Removing bodies in Box2D”

Haxe inline C++

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.

Continue reading “Haxe inline C++”

I’ve been implementing a second thread of execution in my current game project for the last few days. I had already tried and mostly failed to do this in a previous project.

At that time there was almost no instruction online as to how threads worked in NME, but that has changed recently thanks to the (always excellent) Joshua Granick, whose blog post, “Using Threads with NME“, lists out some basic scenarios for communication between threads. There’s also some useful nuggets of information in this forum thread.

Continue reading “Thread synchronization in Haxe NME”

In my new “Tower Defence” project I need to know when certain things are touching, or when object A is within range of object B, and other nonsenses like that.

In the early days of this project I implemented a collision system again with just two shape types: Rectangle and circle. It worked well enough, but the performance was awful. I had knocked together a few arrays and an update loop, but more advanced stuff like knowing which objects could be safely ignored to speed the whole process up takes time to write and test. Having experience with it previously, I  dropped Box2D in to my project so I could begin prodding.

Continue reading “Using Box2D as a collision system”

3D Modelling with Maya

For a little while just before work began on that XNA RTS game that was quickly cancelled, I was trying to learn 3D modelling in Maya. My friend and I were both programmers and recognized we were going to have problems with art right away, so I volunteered to try and learn some modelling.

I hardly became a virtuoso, but over the few months I was working through the included “Getting Started” tutorial I think I learnt a lot of the basics and I did produce a number of simple in-game objects that were sadly never used.

The largest object I attempted was a main character for a future game which was to be a platformer/puzzle game where you controlled a mouse through a house full of obstacles to escape to freedom. Obviously the game never happened, but I do have a short video of the rigged mouse model with a simple animation.

In my final year of University I was lucky enough to take part in the robotics module. As I understand it, people starting the same course at the time I was leaving got to do robotics as standard in their first year! Not so with us, it was kept to the last and had limited places and all.

The course was half practical – building and programming a robot – and half theory – how to process data from sensors and control various aspects of the robot. The robots themselves were based on a small micro controller board with many simple I/O ports, built in to a shell made of Lego.

Initially I and my team mates were all unsure of the programming side of it, but certainly confident in our Lego abilities! This changed around pretty abruptly when it came to actually building the thing – turns out Lego can be a pain!

The result of a Robotics module at the University of Birmingham, built in Lego and designed to sort cans by colour. The objective of the robot was to collect coloured cans in a small square arena, and deposit them in the identically-coloured corner of the arena. Not hitting walls or getting stuck was preferable too.
Continue reading “University “Intelligent Robotics” module”

The Indie Lounge website

In 2008/9 I visited a bar near where I lived called The Indie Lounge frequently. Friendly staff, live music and cheap drinks beckoned me in, but after a while I began work on an altogether more professional project with them – creating a website.

There was some interest in having an online presence which could be customized and styled, unlike the bars most prevalent means of communication at the time, Facebook. So I went and built a design I felt reflected the bar, grungy and dark. From there, things got a little strange…

 

1

Continue reading “The Indie Lounge website”