Category: Programming
Items about code of all sorts, including php, Java, Javascript, Haxe, Perl, and many more.
Quick web project today – a website for a local scaffolding company atop WordPress. This was back in 2013 and having never used WordPress for anything other than this blog before it was a learning curve.
Above the fold features the nav, a service guarantee, various accreditations and a short slideshow of sample jobs, and from there we break in to three columns to enumerate the types of work the company will undertake.
That’s all folks, thanks for reading.
Long time no blog! I’ve been so busy at work recently I haven’t had any time to work on other stuff.
But today I have a little php nugget I had to put together recently that I think someone will find useful.
In the past I’ve dabbled with generating images dynamically in php – usually basic stuff, website statistics etc. But recently I had to do something a little more advanced in generating preview images of “Letters from Santa” that people would be paying for.
This involved placing a large amount of text within a series of template images – including ones with oddly shaped spaces the text would need to wrap around. I guess you could brute force it – manually position each line – but that’s frankly ludicrous and not future-friendly at all.
So, let’s make a solution.
Continue reading “Generating previews with imagettftext”Hello everybody.
Long time no blog, so here’s a quick catch up: I got a job at a small start up doing many varied and interesting things. The first project I was given built on my experiences with game development, and somewhat outstandingly I got to start writing a new game in Haxe NME! I can’t go in to details about the title right now, but it’s 99% complete and looking good.
One desired aspect of the game was an online leaderboard of some sort, so we can assign rewards to weekly/monthly winners. I’d never even looked at NMEs web function before, vaguely deciding I’d worry about highscores in Tower Defence “at some point”.
To my relief it’s super simple to use, and with a few php files on a server I’ve got a nice simple highscore system running.
Continue reading “Online highscore system for Haxe NME”Hello friends, today I want to talk about board games.
Well, not really, but let’s briefly discuss that I made one.

Before the current Nerdshack, and before the previous Nerdshack, there was the original Nerdshack – the same site really, blog, portfolio and random drivel, but in a more designed shell.
I recently found this single screenshot of the old design and figured I’d publish it for posterity. I still like it – those boxy headline backgrounds were based on the window frames from the Watercolour theme in Windows Whistler (XP) builds 2410-2419, and the boxy layout of the sidebar complimented it nicely.
In the final iteration, the lower boxes on the sidebar contained links to recent blog posts, and clicking any link in to the blog triggered a smooth transition to the identically laid out but much darker design of the blog. I’m currently investigating building a similar theme for the current site – the grey is nice but it is a bit depressing after a while!

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.
Progress with Tower Defence has been slow recently with moving and the general disruption that brings, but the other day I did manage to settle in and resolve a few long standing nasty bugs which brings the game to a much more playable level. As such, I felt it might be prudent to make a demo available so people can actually try this thing out themselves rather than watching my boring videos.
I’m a long way from guaranteeing it’s crash free. There are also bugs galore (see full release notes after the break), and a few things are disabled for being either half implemented or inconsistent in performance or reliability, but it gives an impression of the project. This release is in the form of a Windows binary, although if there’s any interest in OSX/Linux/mobile builds I’ll happily crank one out and you’re welcome to see if it works.
One of my first “real” programming projects from around 2006/7, in collaboration with some friends, to create a rough image hosting service for use on our own forums.

At the time our server had just moved to an “unlimited everything” plan, and we basically wanted to test it out, as well as the obvious benefits of hosting our own images.
I was the in-house developer, but I was only familiar with HTML, CSS, and a smidge of Javascript if required, so I didn’t have the chops to take on such a project. Luckily another forum member who I’ve since lost contact with was in to php, and so he began building code.
Eager not to be left out and eager to learn php I started pulling down his code and studying it to figure out how everything worked.
This was me taking the advice to “just make something … Tetris or something, just show you know what you’re doing.”
So a few days later I got up and made Tetris.


All told it was maybe 6-8 hours work split across two days: Mostly production, with the final couple of hours on day two dedicated to bug squashing. Anyway, it’s super simple but I think it’s kinda neat for what it is. As ever, this game is built with Haxe NME (3.5) – to compile the source you will also need the Actuate tween library installed. Download the source here.
Continue reading “Quick project: Tetris”
Today I’m happy to offer some code from my early prototypes of “Tower Defence.” It’s super basic: No maze generating algorithms yet, not much in the way of gameplay.
A random maze is created (i.e, each map tile is 50/50 whether its walkable or not), start and end points generated and a route found between them using A*, and an “enemy” (green square) moves along the path. You can create a single weapon type – the gun – which fires very slow moving bullets at the enemy.
This code also contains remnants of my quick and dirty collision system, though Box2D is actually running the show.

Continue reading “Tower Defence prototype code”
