O2 Scam text doing the rounds (Ireland)

I just got a text from a Vodafone number to my Three mobile with a link to an o2upgrade.com - apparently to “Update your O2 to claim unlimited calls credits to any network” - I haven’t opened the page but I can be 99.999% sure this is a Damn Spam Scam. You’ve been warned.

P.S. I think they just texted a load of 086 numbers because I still have an 086 number even though I’m with Three.

Snapping prefabs Together in #unity3d

I got to thinking - how would you go about setting up a Sim-City style base-builder where you could snap prefab building blocks together?

Here’s a demo of what I’m talking about:

Snapping Prefabs together Demo

Here’s an image of what’s going on (scene view)

I had code for the above demo but I’ve since overwritten it because I started to re-write the whole thing - it’s not very efficient and has a couple of bugs, it’s more of a just braindump than anything else.  If I get a final version of the code I’ll post it up asap.

Any comments / criticisms are very welcome (although I do know about most of the bugs, it’s just a proof of concept)

Windows registry scripting with PHP (compiled to EXE!)

I do a lot of windows scripting for all sorts of different reasons, and I use different languages depending on what I want to do. For example, I built an intranet website which catalogs all of our Windows PCs, the specifications, their software etc. But it was messy because I used KixTart for the main script which gathers data about the machine with WMI, and sent that info back to the server which parsed all the data with PHP. I also had other scripts written to pull back other info, using Autohotkey and other languages, and all going back to the same PHP script for parsing. Anyway, I think I should be able to do all of this with PHP, although I didn’t realise I could.

There are a lot of PHP compilers out there but for simple stuff like file parsing, directory operations etc. I always just use Bambalam PHP EXE Compiler/Embedder. It’s a great piece of software, very easy to use, creates decent size EXE files for Windows by simply packing the PHP parser and your code together into a nice little EXE package. I should point out that I’ve only ever used it for command-line stuff but I’m pretty sure you can do some GUI stuff with Winbinder. The only real drawback is that it uses PHP 4.4 and hasn’t been updated since 2006 I think. However, it’s still a very useful piece of kit for those who like PHP and also windows scripting. I only found out lately about PHP’s COM scripting and that I could access the registry with this without the need for third party tools like REG.EXE etc. - You can even use the COM scripting to check EXE file versions etc.

So I’ve included some basic code below to allow you to check a value from the registry (in this case it’s the Lotus Notes path, and then it checks the notes.exe file version from that path. I’m sure you can modify this to do all sorts of useful Windows stuff. COM is extremely useful and there’s an entire MSDN codebase there for you to play with.

So anyway here’s the code:

error_reporting(0); // turns off exceptions for missing paths etc 

$reg = new COM("WScript.Shell") or die("Requires Windows Scripting Host"); 
$stringtoread="HKEY_LOCAL_MACHINE\\SOFTWARE\\Lotus\\Notes\\Path"; //works with values, not sure how to read entire keys 
$LotusPath = $reg->RegRead($stringtoread); 
if ($LotusPath){ 
        $fso = new COM("Scripting.FileSystemObject") or die("Could not create Scripting.FileSystemObject"); 
        $version = $fso->GetFileVersion("$LotusPath\\notes.exe"); 

if ($version)echo "Lotus Notes Version = $version"; 

With bamcompile I was able to compile the PHP above into a simple EXE of only 514KB! if Javascript is more your thing, I will be writing a similar article soon about compiling jscript to EXE files.

upcoming article about making mobile apps

I’ve been working on an article for t3kd.com about creating your own mobile apps for a while now. It’s focusing on the easier methods that use little (JS, HTML etc) or no code at all (templates, and other systems). But it seems there are SOOOO many options out there it’s taking me a bit longer than I would have liked to compile the list. It looks like it’s going to be a vary large overview, just like my 'So you want to make your own games' article in July.

Corona SDK - my one (tiny) peeve

I’ve said it before, @ansca did an amazing job on Corona SDK, and I think the unlimited trial is very forward-thinking. My only issue is that I use a lot of different laptops and PCs and I’m rarely at the same one. Having to de-authorise the trial every time I want to use a different PC for development means poor hobbyist devs like me will never really get a chance to sink our teeth into it. I could use a few different e-mail accounts but that is probably against the license agreement. Does anybody have any recmomendations? I’d love to buy the software but not until I have a working game that’s worth something and I want to publish.

For anybody who doesn’t know what Corona SDK is, it’s an app / game writing tool for creating games and apps for iOS and Android. There is an unlimited free trial and it’s available at http://www.anscamobile.com/corona/

The scripting language used is LUA and is very easy to learn. The SDK has a great built in physics engine and has very high performance. I would recommend it to any mobile game dev starting out. When you do want to publish your game or app, there’s an Indie iOS license for $199/year and the same for the Android license. You can get both for $349 / year !! That’s a great deal!

As in most cases, you can create Android apps with a Windows PC, but you’ll need a Mac if you also want to create for iOS.

Updated Tower Defence learning - Work in Progress

This is part 2 of a previous post, I’ve redesigned a lot of the code since then. 


This is my latest version of a simple tower defence game. it’s nowhere near finished, but I’ve been learning quite a bit when I have any spare time.

Current Features:

  • Click “Tower 1” to spawn a tower, then it follows the mouse around screen until you click again.
  • You can only spawn towers on black parts of the map / maze (it checks the texture pixel data)
  • You cannot spawn a tower in the same place as a previous tower.
  • You cannot spawn a tower unless you have enough money.
  • You can press ‘c’ to switch into first-person mode (something I might include in my final game)

That’s all I’ve got working so far (there just aren’t enough hours in the day)

Still to do:

  • Creeps + Waypoint system
  • Towers targeting creeps and firing at them
  • learn how to do GUI skins, make it look nice.
  • etc etc

I hope to split this into a couple of projects - one standard tower defence with creeps etc. and then maybe a 2-player game where 1 player drops blocks like a sort of lego building game, and the other player is in first person mode and has to traverse the level with the help of the first player.

You can test out the latest project work here

Here are the more important scripts (BE WARNED: code not optimised or complete, but it might give you some ideas) - most of these have been put together with the help of Unity Answers forum and the Unity Script Reference.

FollowMouseAround.js  [attach this script to Tower Prefab]

var GridSize: float = 5.0;
var ColliderToIgnore: String = "Floor";
var MyLayerMask : int = 1 << 8;
static var hit : RaycastHit;  //this var needs to be accessed in CheckGridColour function

function Update(){
		if (Input.GetButtonDown ("Fire1")) {  //If mouse is clicked (if user tries to place tower)
          		if (CheckGridColour()){ //check if the grid colour is correct, otherwise stay in drag tower mode
			} //if the colour isn't correct, we're still in drag+place tower mode

	mousePos = Input.mousePosition;  //Track mouse position as Vector
	var ray : Ray = Camera.main.ScreenPointToRay (Input.mousePosition);

	// Debug.DrawRay (ray.origin, ray.direction * 80, Color.red);
	if (Physics.Raycast (ray, hit)) {
		transform.position = Vector3 (hit.point.x, 2.5, hit.point.z);
		StickToGrid(); // slightly modify the position so we keep to the grid

function StickToGrid(){
	// Now we change the position of the object to make sure it sticks to the grid
	// Don't bother with Y value (height from ground)
	transform.position.x = Mathf.Round(transform.position.x / GridSize) * GridSize;
	transform.position.z = Mathf.Round(transform.position.z / GridSize) * GridSize;

function CheckGridColour(){
	var ray : Ray = Camera.main.ScreenPointToRay (Input.mousePosition);
	var hit : RaycastHit;
	var hitNorm: Vector3;	

	if (Physics.Raycast (ray, hit)) {

		if (hit.transform.name == ColliderToIgnore){ //only spawn object if you're pointing at the 'Floor'
			var TextureMap: Texture2D = hit.transform.renderer.material.mainTexture; //we will use this to figure out the craic
			var pixelUV = hit.textureCoord; //get the points on the texture where the raycast hit (THIS ONLY WORKS WITH MESH COLLIDERS!!!!)
   		        pixelUV.x *= TextureMap.width;
    		        pixelUV.y *= TextureMap.height;
			if (TextureMap.GetPixel(pixelUV.x,pixelUV.y)==Color.black){ //We need to double check the colour
				return true;
				print("you can't place a tower there!");return false;
			print("there's already a tower there!");

function PlaceTheTower(){
	gameObject.layer = 0; //put in the default layer, raycasts will now work on this tower
	MoneyCounter.DaMonies -=AllVars.Tower1Price;  // reduce funds by tower cost
	GameObject.Find("TestCube(Clone)").name = "Tower"; // rename clone of tower to a final name so that we can differentiate
        Destroy(this); //delete the follow mouse around script, so the tower is stuck in place.

CameraSwitching.js   [camera 1 is main camera, camera2 is First person]

var camera1 : Camera;
var camera2 : Camera;
var fpc : GameObject;
public var currentCamera : int = 1;

function Start () 

camera1.enabled = true; camera2.enabled = false;
currentCamera = 1;
KillFPC(); //stop and hide FPC for now (until required)

function Update () {
	if (Input.GetKeyDown ("c") && (currentCamera == 1)){
		currentCamera = 2; camera1.enabled = false; camera2.enabled = true;
	else if (Input.GetKeyDown ("c") && (currentCamera == 2)){
		currentCamera = 1; camera1.enabled = true; camera2.enabled = false; 

function KillFPC(){
		var fpc = GameObject.Find("First Person Controller");
		fpc.GetComponent("MouseLook").enabled = false;
		fpc.GetComponent("CharacterMotor").enabled = false;
		fpc.GetComponent("FPSInputController").enabled = false;
		GameObject.Find("Graphics").renderer.enabled = false;

function FixFPC(){
		var fpc = GameObject.Find("First Person Controller");
		fpc.GetComponent("MouseLook").enabled = true;
		fpc.GetComponent("CharacterMotor").enabled = true;
		fpc.GetComponent("FPSInputController").enabled = true;
		GameObject.Find("Graphics").renderer.enabled = true;

guiMenu.js [I just attach this to an empty gameobject]

var Tower1: Transform;
static var guiVisible : boolean = true;

function OnGUI () {

if (guiVisible){

	// Make a background box for menu
	GUI.Box (Rect (10,10,110,130), "Debug Menu");

	if (GUI.Button (Rect (20,40,95,20), "Clear Towers")) {
		var allTowers = GameObject.FindGameObjectsWithTag ("tower");
		for (var aTower in allTowers) {Destroy(aTower);}

	if (GUI.Button (Rect (20,70,95,20), "Tower 1")) {
		if (CheckMoney(AllVars.Tower1Price)){
			Tower1Spawn = new Vector3(-66, 2, 46);//to the top left of the board
			Instantiate (Tower1, Tower1Spawn, Quaternion.identity);
			print("not enough funds");
	if (GUI.Button (Rect (20,100,95,20), "Add $100")) {
		MoneyCounter.DaMonies +=100;
	// -------------------------------------------------------------

	GUI.Box (Rect (10,200,100,40), "Money");
	GUI.Label (Rect (50, 220, 100, 20), "$ "+MoneyCounter.DaMonies.ToString());


function CheckMoney(ThePrice:int){
	if (MoneyCounter.DaMonies < ThePrice){return false;}else{return true;}

There are a couple of tiny other scripts but I’m sure anyone with basic UnityScript knowledge will figure them out. (if not let me know I’ll send you the whole project)

If anyone has any questions / critiques please let me know. I love learning this stuff and I realise I’m not doing everything 100%

Thanks for reading

Great free Windows software that I use all the time

This is a list of software that goes with me everywhere I go, I install it on every machine I have and keep installing it time and time again, it’s the tried and tested stuff. I’m always trying new software but this is the stuff I never build a new windows machine without.

Avast! Free

My favourite free antivirus. With built-in anti-spyware, real-time anti-rootkit protection, Silent Firewall, Boot-time scanner, Auto-Sandbox. There are loads of other features, give it a try! You can get Avast here

Comodo Personal Firewall

A great personal firewall for your home or small office computer. If you’re not sure what a firewall is, you still need one to stop incoming network threats to your computer(s). Download it here


A progammer’s text editor. It’s java-based and runs on Mac OS X, OS/2, Unix, VMS and Windows. It has syntax highlighting for more than 130 languages and ability to split windows so you can look at two or more files at once, It’s great for coding PHP. another great alternative would be Notepad++, which has a portable version if you need it. You can get jEdit here


From the site - “ImgBurn is a lightweight CD / DVD / HD DVD / Blu-ray burning application that everyone should have in their toolkit!”.

But seriously, it’s great for burning ISO files to disc, or making new ISO files from groups of files, or creating an ISO from a disc. You can get it here


Slimdrivers is the free version of Driverupdate - and is great for updating all of the drivers on your machine. It doesn’t work automatically, you have to click to do each driver yourself but it can help stop you trawling the internet looking for obscure drivers. You can download it here


With Autohotkey you can (copied directly from the site)

"Automate almost anything by sending keystrokes and mouse clicks. You can write a mouse or keyboard macro by hand or use the macro recorder.

Create hotkeys for keyboard, joystick, and mouse. Virtually any key, button, or combination can become a hotkey.”

It’s an incredibly versatile piece of software, you can compile your scripts to EXE for use on other machines. I’ve even been able to use it to wrap other EXEs in administrator credentials so I can roll out software to non-admins here at work. Obviously there are security concerns but in a small private environment it can be extremely useful.

Here are some great example scripts, and you can get Autohotkey here


A simple image editing package, portable if you need it. It’s no Photoshop but does image size, cropping, adding text, drawing lines and arrows (among other things). It’s very lightweight and great for all the little image jobs you might have to do. You can download Photofiltre here


Sharepod is a great way to copy music files from an iPod / iPhone (including song name and artist details) you can get it here


Fences is a great application for organising your desktop icons. You create ‘fences’ and name them and then drag icons in.. it helps keep your desktop clean. You can even take a snapshot and restore it if your resolution has changed, it will put all the icons back where they were supposed to be. You can check it out here

I could go on all day about this, but I won’t. That’s a relatively long list to get your teeth into. As always, comments are appreciated and questions are welcome.

PS. I can’t believe I forgot Dropbox!!! - watch the video on that site to find out more.

Unity 3D by numbers

Somebody should do a guide for the #unity3d engine which gives you breakdown ideas of how to start designing games, for example:

Tower Defence:

  • might involve waypoints or pathfinding
  • then grid placement
  • raycast to ground point (mouse click)
  • instantiate prefab tower and drag around
  • creep spawning and animations
  • etc etc

Car Game:

  • Rigging
  • Wheel Colliders
  • you get the idea

If I had all the knowledge I’d be right on the case, I’ll try to post up as much useful info as I find. I’m trying to get from complete n00b scripter to somewhere in the middle. So what I’m saying is once you get past the basics, some people just want a sort of ‘to-do’ list to work through instead of entire books on the subject.

Or maybe that’s just me. Let me know what you think….

If you want to start scripting with the Unity Game Engine , look no further than this guy - Alec Holowka. This video is the first in a great set of tutorials.



Many great ideas go unexecuted, and many great executioners are without ideas. One without the other is worthless.
Tim Blixseth