All entries for Thursday 04 May 2006

May 04, 2006

Road Pathfinding Complete

Managed to finish the javacc a little quicker than I had expected, so spent the evening doing some more work on the road networks. While the actual method of placing roads is still a little shakey (half squares at a time, no dragging) it builds up a graph data structure to store the network. Currently every square is a node in the graph, but I've already implemented the concept of a "path" from point A to B, so just need to add a little extra functionality to remove straight lines as nodes.

On the pathfinding front, I think I am probably done. I did hope (before I started coding) that I'd be able to abstract rail/road networks into a single "network", but have opted not to, at least for now. Although they share many characteristics, signalling on rail networks is going to be a big enough pain that having the road network separate will make my life easier.

I chose A* pathfinding for a few reasons really, a) it seems generally to be the "fastest" of all the graph searching algorithms, b) OpenTTD uses it, so it must be good, and c) It's not as hard to implement as it might first seem. For a bit of extra reading, Wikipedia is a good place to start, while A* For Beginners does a fairly good job of explaining it.

No screenshot this time, just a video of the pathfinding doing it's stuff. A snip at 546K (xvid) it just illustrates a vehicle knows where it's going. Animation around corners and non–tiling road textures are the least of my worries at the moment :).

May 2006

Mo Tu We Th Fr Sa Su
|  Today  | Jun
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31            

Search this blog



Most recent comments

  • I hope progress is being made, I would pay £30 for this game in 3d, I have many years enjoyment from… by AndyC on this entry
  • Well, I'd love to carry on working with it and I suspect I'll try and at least clean up the code and… by on this entry
  • Nice 3YP – a friend and me tried a similar project a while back – your videos of 3d rendered green l… by Cyphus on this entry
  • Also I checked, the presentations are open to anyone that wants to go, Computer Science or otherwise… by on this entry
  • My presentation is CS1.07, the full list is available here (proxy/campus required). by on this entry

Blog archive

Not signed in
Sign in

Powered by BlogBuilder