Phaze, the futuristic racing game I co-developed with Pazzazz Games, has been released for the iPhone and iPod Touch!
Go and buy it now! ;)
Oct 28 08

iPhone ARM references

by Julian

June 2009: The recently announced iPhone 3GS has a different set of hardware, and the original post does not apply to this new device. The chip is suspected to be the ARM Cortex-A8, based on ARMv7 (compare with ARMv6 below). Looking at the specs it appears to have a NEON unit, which should be good news for games developers.

Well over a year ago Engadget posted a description of the (suspected) processor in the iPhone  - ARM1176JZF (ARM11 family, implementing the ARMv6 instruction set). It has a VFP11 vector coprocessor for SIMD operations. It does not support NEON as some have suggested.

In my attempt to figure out how to access the SIMD operations for matrix and vector math, I’ve found these reference PDFs that might be of use to others:

There’s also a (pay-for) article on the IEEE Xplore website, called “Accelerating floating-point 3D graphics for vector microprocessors”, which talks specifically about ARM VFP processors.

It may also be worth keeping an eye on this math library, which forms part of the Oolong Engine.

Jan 15 07

Setting up a Perforce proxy server on Ubuntu

by Julian

One of the more important things I’ve been wanting to do, is to set up a perforce proxy to connect to the work server.

That way, it can sit in the background periodically updating itself (not quite but see below), and when I want to sync, it should be nice and fast. In theory. In reality I suspect it won’t be so clear cut.

Running a perforce proxy is easy, it’s just a case of choosing a root for the cache, telling it what port to listen on, and what the target server is:

p4p -p 1667 -t workserver:1666 -r /perforce/p4p/cache -L /perforce/p4p/p4p.log

That’s nice, but I want this to start automatically when I boot up, and an easy way to quickly stop and start it. I need a script in /etc/init.d. Here’s mine:

#! /bin/sh
# p4pinit
# Startup script for Perforce Proxy server.
# Check out the man page for start-stop-daemon. Notice
# I use -b to run p4p in the background. p4p has a similar
# option, but I didn't have as much success.

DAEMON=/usr/local/bin/p4p
P4P_NAME=p4p
P4P_DESC="Perforce Proxy"
P4P_CACHE=/perforce/p4p/cache
P4P_PORT=1667
P4P_TARGET=workserver.somewhere.co.uk:1666
P4P_LOG=/perforce/p4p/p4p.log

# Check p4p exists
test -x $DAEMON || exit 0

case "$1" in

  start)
	echo -n "Starting $P4P_DESC: "
	start-stop-daemon --start -b -m \
                --pidfile /var/run/$P4P_NAME.pid \
                --exec $DAEMON \
                -- -p $P4P_PORT -t $P4P_TARGET \
                -r $P4P_CACHE -L $P4P_LOG
	echo "$P4P_NAME."
	;;

  stop)
	echo -n "Stopping $P4P_DESC: "
	start-stop-daemon --stop \
                --pidfile /var/run/$P4P_NAME.pid \
                --signal KILL \
                --exec $DAEMON \
                --oknodo
	echo "$P4P_NAME."
	;;

  *)
	echo "Usage: $0 {start|stop}"
	exit 1
	;;
esac

exit 0

Once you’ve done this, you need to call update-rc.d p4pinit defaults. This will ensure that p4p is started when you boot up. This will create symlinks to p4pinit in the directories /etc/rcX.d etc…

Now synching is just a case of pointing the client at homeserver:1667, rather than the default :-) However, you need to pre-load the cache and ideally keep it synched regularly after that.

Unfortunately this is where Perforce falls down, as the proxy has no means to do this itself; You’re required to set up another client spec, and use that to sync and fill the proxy’s cache. This could mean double the files on your server, which isn’t great.

What you can do, rather cunningly, is set your client root to /dev/null. When you sync you’ll get errors that it can’t write the file/create the directory, but by that point the file has been downloaded to the cache. To quote Tim O’Mahony of Perforce support:

…The errors mean that you can’t write anything to db.have for those files, but by this time you already have downloaded them to the proxy. That means that every time you then run a p4 sync on this client it is the same as running a full “p4 sync”. Files that aren’t on the proxy will simply be got from the server…

In other words, if you sync later, p4 will want to re-grab those files. However it will take them from the proxy, so it will only download genuinely new files. If you don’t want the output in your logs (like me), then you can run p4 flush immediately after the sync, to convince the server that you really do have those files:

p4 sync //depot/something/to/sync/...
p4 flush //depot/something/to/sync/...

Hope this helps someone.

Since writing, I found that in some situations (that I’ve yet to fathom) the proxy server delivers files from the server rather than itself. To see where your files are coming from, you can use the -Zproxyverbose flag to your p4 command.
Dec 19 06

Installing Firefly Media Server on Ubuntu 6.06

by Julian

The following instructions need to be updated, though the steps are pretty similar.

Installing Firefly on Dapper Drake was a breeze:

  • Grab mt-daapd_0.9-svn-1463_dapper_i386.deb from here
  • dpkg --install mt-daapd_0.9-svn-1463_dapper_i386.deb
  • If it complains about dependencies, grab them:
    apt-get install libflac7 libid3tag0 libogg0 libsqlite0 libvorbis0a libvorbisfile3
    That’ll finish the installation of mt-daapd.
  • Check to see if it’s working by browsing to http://your-machine:3689
  • The main configuration file is /etc/mt-daapd.conf. I didn’t change anything except the mp3_dir, which I set to my iTunes folder on my samba share. I might need to change the scan_type later, as I noticed it was set to “Painfully aggressive” :)  (As an aside, I manage my music with iTunes on my Mac. I simply moved the entire iTunes folder to the linux box, and created a symbolic link, so that iTunes wouldn’t think anything had changed: cd to ~/Music, and ln -s /Network/Servers/ubuntu/share/iTunes. I have the samba share automounting, and if you check /Network/Servers is a symlink to /automount/Servers. See below.)
  • The firefly server should show up in iTunes under the SHARED section.

Upon rebooting my ubuntu box, I found firefly wasn’t running. Checking the forums, helped, and all I needed to do was: ln -s /opt/etc/init.d/S60mt-daapd /etc/rc2.d/S60mt-daapd.

If you need to restart the server, issue (as root) a /etc/init.d/mt-daapd restart. If you check the running processes, you’ll see TWO mt-daapd processes. This had me confused for a while, but is normal.

By default you can’t see your iTunes playlists – this is down to an inappropriately named switch in the config file. Read about it here, under Why can’t I see my iTunes playlists.

Dec 2008: I no longer store the entire iTunes folder on the network share, as iTunes fails to start if it cannot find the folder location. Instead I’ve found it’s best to store just the iTunes Music folder, and create a symbolic link to that. By doing this it also allows multiple users to access the music, whilst retaining the ability to rate their music, etc. 

This works better than using the “iTunes Music folder location” in the Advanced preferences, as iTunes will reset that folder if it can’t access that folder, without informing you!

Dec 17 06

bind9 DNS on Ubuntu 6.06

by Julian

Setting up a DNS proved easier than I’d first thought. I did spend a long time trying things out, which was pretty frustrating.

In the end, I followed this excellent step-by-step guide. What I would say is follow the steps exactly, make sure it’s working, then go back and amend it for your network and situation.

These are the other sites I referred to.

I use the DNS primarily to access machines on my LAN by name, forwarding requests to work machines to the VPN’s DNS. I’m hoping that I also see a performance improvement due to cached responses. I probably could have used dnsmasq, but I wanted to understand how bind9 worked.

A couple of gotchas;

  • Make sure the format of the zone files is correct; I had excluded the hostmaster email address, which made everything fail horribly.
  • Check your /etc/hosts and /etc/hostname files match your DNS setup. I didn’t; ping returned some very strange results.

UPDATE: After a couple of reboots it was clear something was wrong. The linux box itself wasn’t able to resolve names. Looking in /etc/resolv.conf showed that 127.0.0.1 i.e. itself wasn’t listed; Some process was rewriting it.

I then remembered that the linux box is set up to get its IP by DHCP (always the same as the router matches the MAC address). You need to change the dhcp client settings – take a look in /etc/dhcp3/dhclient.conf, and uncomment the line: #prepend domain-name-servers 127.0.0.1