Artificial Intelligence

AI & C++ problem

1. We are given a road map:
2D map
2-colors coloring: black & white
black = road (the car is allowed to drive on)
white = rest of the map = terrain (the car is forbidden to drive on this field)

Where could I find information (math, computation, hints, etc) about how to draw a wired line/circuit (1 pixel width x ROAD LENGTH) based on this map. More precisely: I suppose you watched at least once at Formula F1. You saw that every player use a tactic when it approaches to a curve/sharp turn: it's positioning on the external side of the curve, it breaks and then enters the curve. I need to "recreate" the "trails" of the car.

2. Now supposing that I have the wired circuit I need some hints about how to know when to accelerate/brake/steering before and after a curve. Some math links/computations. I think it is based on motion laws + pre-scanning (a-priori) of the circuit with some meters before the analysed situation.

I don't want a solution of this problems, but some helpful links.

Thanks in advance.
Can't anyone help me ?
Well what process would you follow, on paper if you had to do this step by step? You would need to simulate a velocity possibly, and a direction. So a vector, and you would have to calculate an angle that would turn you closest to your curve (assuming all curves are smooth and there are no dead ends)
The thing here is, that you can make the whole driving simulation thing almost infinitely complex here (taking in account various things like material of the tires, the material of the road, the wetness etc). It really depends on how realistic you want this to be.

Basically what you want to do is
A) Create the circuit. The question here is with the inital 2D map - is it guaranteed to be a valid map, e.g. it's not just some 2D map of alternating black and white pixels? Is it guaranteed not to have any other colors (like red) inside that could cause undefined behaviour (though I think you could just assume that anything that is not black is something you can not drive on)?
Once you have a valid map, I suppose you could define the actual road as a vector of cubic bézier curves, especially if the width of the road is fixed - with bézier curves, you already have the tangent of your curve at any given point, so getting the normal you need to draw the road is trivial (I just saw it just needs to be 1 pixel width- in that case you don't even need the normal).
Here for info on the bézier curves : http://en.wikipedia.org/wiki/B%C3%A9zier_curve

B) Now this is interesting. You'd have to calculate how much velocity you can have when entering a curve to be able to get through it, and based on that calculate how long you can accelerate on the straight before etc. You'd better read on the basics of motion laws again (anywhere in the internet, basically) and try to figure something out.
Topic archived. No new replies allowed.