I am writing a flight simulation game, and as you all know, this is a massive task for a single person to take on.
So I have had to make some hard decisions to make. One of them was the terrain system.
It would have been nice to have an open world , whole planet, terrain system, but with one coder that would have killed the project. So I have decided to use maps from a modding community (with their permission of course).
The maps have a fairly simple format. One bitmap defines the terrain heights. Another the terrain type and other files contain locations and objects.
The types map uses 5 bits for the actual terrain type, and index into a texture array basically. The other three bits are HasMajorRoad, HasMinorRoad, and HasRailway.
These are the bits I need some help with.
I don't want to do a Lego style system for the roads. Basically you look at all the cells around the current one to create an index into an array and drop in the road section that matches. This would mean all roads exit a terrain cell at the same points and would make everything very unnatural.
So I scanned the bitmap and extracted all the cells with roads, collecting them into point lists. I then used a modified version of the Potrace algorithm to convert the point lists into line lists.
At first glance that seemed to work.
[attachment=32808:roads_1.png]
It is only when I zoomed in I realized I had a problem.
[attachment=32809:roads_3.png]
It seems the Potrace algo actually traces around the point list rather than along the point list.
It's even worse when I add minor roads and rail ways
[attachment=32810:roads_4.png]
Has anyone seen any good ways or converting a point list into a line list?
I don't have time to re-invent the wheel.
Cheers guys.