1
\$\begingroup\$

This question already has an answer here:

My final year project for university is based on the idea that a two-dimensional top-down multiplayer racing game can be made using Google Maps to dynamically generate race tracks. The idea is that the user would pick two points on a Google Map and then click a button that would generate a route between the two points. I am able to extract the path from these points.

Route Generated On Google Maps

Result

Now, I can't figure out how to actually transform this shape into a race track. I tried changing the stroke width, it messes up the details, like curves.

I want thicker strokes without losing details and the strokes overlapping each other so that the strokes look more like race tracks, because the camera would center the player's car and be zoomed in on it while following the car. Something like this:

Sample from Contiracer.cz

Is there any way I can make the route shape into an actual race track? If so, how?

\$\endgroup\$

marked as duplicate by Seth Battin, Kromster, bummzack, congusbongus, Kevin Reid Dec 18 '14 at 22:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • \$\begingroup\$ I removed the code and your request for a framework to use. I'm not sure how the code added to the question as this is more of a conceptual question and technology suggestions are off topic for the site. It seems like you have everything you need, but you're not explaining very well exactly what you want to get out of this. What is a race track in the context of your game? A mesh? A physics object? Just a thicker line? Please provide more details as to the end result you're looking for. \$\endgroup\$ – MichaelHouse Sep 24 '14 at 17:36
  • \$\begingroup\$ Done, I hope its more clear. \$\endgroup\$ – Sam Sam Sep 24 '14 at 17:52
  • \$\begingroup\$ Those are not just "thicker strokes" That's a textured road. Your first step is to be able to create a straight track. Do you have anything implemented to create a track already? The next step would be introducing turns and finally converting your extracted path into a track using the methods you have to create straight track and turns. \$\endgroup\$ – MichaelHouse Sep 24 '14 at 17:59
  • \$\begingroup\$ Yes, I have. Straight tracks with textured roads are simple, I just use a texture that can be tiled and draw it in a loop vertically or horizontally. I used that screenshot to show how I wanted the camera to be. I realize that what I want might not be possible with textured roads, but if it is, I am open to suggestions. I was asking for somewhere to start, and if thicker strokes get me started, I'll take that. \$\endgroup\$ – Sam Sam Sep 24 '14 at 18:50
  • 1
    \$\begingroup\$ If you're generating your textured road as a rectangle, then you're most of the way there. Your curve needs to be made up of trapezoid segments - the more you use, the smoother the curve effect will be. \$\endgroup\$ – salmonmoose Sep 25 '14 at 2:05

Browse other questions tagged or ask your own question.