I put a bit more work into the ray caster. Its still not working, but its not working more correctly than before. I'm going to spend a while now running through the ray casting code line by line and see whats broken. I don't want to spend too much time on this at the expense of the engine but it's really fun.
If any one else is interested in writing a ray caster this is what I read before I started coding. Its quite descriptive, giving you the theory behind the whole thing but leaves you to implement it entirely on your own.