Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Machine learning in simple car racing game

My task is to create a simple, 2D, view from above car racing game. The only goal in this game to achieve the best result in time as possible. The player can wheel the car and can speed up or slow down. If the player goes out from the race track, the game is over.

It is simple at this point, but the game also has an AI. The goal of the AI is to learn the "optimal" tracing on the track, based on the the past tracings of the human player.

I'm considering some functions, these can be used as training sets:

  • the tracing of the player as the function of the topology of the track
  • the speed of the player as the function of position of the track

Of course other functions or information can be useful.

What learning methods can is use to produce a valid track. My goal is not to beat the human player, but to only get to the end of the track. :)

like image 648
WonderCsabo Avatar asked Nov 29 '25 15:11

WonderCsabo


2 Answers

I am mostly just brainstorming here, but:

as I understand, your situation is something like this:

  • you have to go from Start to Finish
  • you don't have to repeatedly do this and achieve better and better "lap" times
  • you have to incorporate any kind of learning algorithm (is there a specification what learning algorithms/intelligent algorithms are allowed?)
  • you know the map, including Start and Finish (?)
  • the map is grid based or can be easily represented as a grid (?)

In this case, a very simple model is as follows:

  • define some simple features (vector) describing your current (or neighboring) position is (e.g. angle from Finish, distance from the edge of the track)
  • define a goodness feature (e.g. distance from Finish)
  • in each step, make a decision, which direction will you move (Left, Righ, Forward, Backward)

So you have a set of input features and a decision problem.

  • you can define a fuzzy control system that gives you the best direction. (rules like IF I am close to border THEN move away, IF I'm headed to the Finish AND far enough from border, THEN move forward)
  • even simpler, you can construct a decision tree
  • you can construct an SVM or Neural Network that chooses the next step

(these are not concrete implementation ideas, that depends on what you are choosing)

Choice heavily depends on what tools are you using (Matlab, C++, Python, etc) and which learning algorithm are you familiar with. I suggest choose the one you know the best, and try to fit a model to that.

like image 162
Oszkar Avatar answered Dec 02 '25 17:12

Oszkar


Maybe you could try a Neural Net?

"In most cases a neural network is an adaptive system changing its structure during a learning phase. Neural networks are used for modeling complex relationships between inputs and outputs or to find patterns in data."

http://en.wikipedia.org/wiki/Artificial_neural_network

like image 38
Daniel Avatar answered Dec 02 '25 17:12

Daniel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!