WonderCsabo
WonderCsabo

Reputation: 12207

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:

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. :)

Upvotes: 3

Views: 2117

Answers (3)

Oszkar
Oszkar

Reputation: 697

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.

Upvotes: 2

JeromeZhao
JeromeZhao

Reputation: 115

I think it's more important to figure out how to represent your environment and "probable" action for that situation, the model is just a thing to link them.

In my opinion, you can try features like "distance from left/right-margin of road to you car", "current car speed" and "angle differences between car's & road's orientation" and more. These will be your model inputs.

Then next is related them to available actions of car, "turn left"/"turn right"/"speed up/down","game continue/over" or something else. These will be your model output.

If you're about to use a NN, I come up with two ways to get your model trained. 1. You can play your game, and make your program log down inputs any time when an action is apply to the car. 2. Make an algorithm that drive the car randomly to sample the training data, and choose effective ones to train your model.

I'm not familiar with reinforcement learning, but i still think it's related, you can also dive into that and have a try.

Upvotes: 0

Daniel
Daniel

Reputation: 2515

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

Upvotes: 1

Related Questions