All 3 entries tagged Road
July 06, 2006
Bit of a gap since my last entry, but I'm really back in full swing now, and hope for a productive few months.
Road building/networks have almost be completely rewritten from scratch to make it infinitely more useable, now no knowledge of "where" to click in a square is required.
In a previous post I showed off the multiple "View Windows" which were essentially a view of the world through a separate camera, however at the time they simply showed the same view as the main camera. Fortunately now, these windows can now not only be in a different place in the world, but also follow vehicles around!
Today's video is slightly larger than before, 15MB, still Xvid, and demonstrates the new road building and a working Vehicle Camera in a window. Here it is. Enjoy.
May 05, 2006
In what really should be one of my last things in TT3D before I start revising solidly, I implemented dragging of roads, not /quite/ as easy as it sounds given each square is only 2 triangles. A lot of the code that went into it will help a lot when it comes to doing work on Rail too.
Being able to build road networks a lot faster should help with testing as well, as before today it was click click click for every half tile you wanted… Anyway, another ~400KB video of road dragging, and if I post again, you'll know revision isn't quite going as planned.
May 04, 2006
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 :).