i am trying to work on a little rts game with settler 2 style.
Now i got a terrain an working rts cam with mouse terrain collision and so own.
Now i want to to automatic way finding for building street.
My Idea: I select a point at the terrain and a second point on the terran, now there should link a street this two points.
The Concept: I thought i use a PolylineCurve or multiple Lines and try to calculate a path from one to the other point.
Now i need a idea of doing that in code, in less performace.
Someone got an idea, how i could do that in a simple effienct way ?
thanx for ideas
It’s actually quite a difficult task to build roads, or at least time consuming. You have to deal with intersections, right angle and possible at other angles. You also have to snap the terrain up to the road, and the road down to the terrain. Substitutable models as well.
But that being said, it is possible and lots of people would love it as a feature in the SDK. We can provide you guidance for developing it.
To implement it, you would want to do it as a plugin in the SDK. That way you can see what it will look like and place buildings and other scene elements around it for your map.
A good start would be to have fixed 90 degree turns, and have it work off of a grid, snapping to points. Each section of road can be a set length and width, and then you can easily and cleanly (no gaps or overlaps) lay out roads with a tool.
Picture drawing a line, connecting it to other road lines (building up a graph) and seeing it place road pieces as you drag it. If you drag the line shorter, the pieces disappear. Then you can drag the points again and the road will adjust