views:

154

answers:

2

I have free-rein over what I do on a final assignment for school, with respect to modifying a simple direct-x game that currently just has the camera follow some rollercoaster rails. I've developed an interest in genetic algorithms and would like to take this opportunity to apply one and learn something about them. However, I can't think of any way I could possibly apply one in this case. What are some options available to me?

+3  A: 

What is the criteria for a succesful rollercoaster? Once you can describe that quantitatively, you have your fitness function. Then you need to consider what are the pieces of a rollercoaster? Is it something that you can even break down into pieces? If so, then you have your 'genes', and an individual rollercoast is a solution that can be tested against the fitness function, or mutated, or crossed over. Then you make a population of rollercoasters, do cross over and mutation on a sample size of the population and apply the fitness function to the individuals. You then keep the most fit individuals for the next generation, and repeat the process over again.

Amir Afghani
All really valid questions to be asking. Hm..
Chris
A good example would be the rollecoasters designed in RCT, where they have ratings based on the G-forces, and excitement.
Aaron M
+4  A: 

From your query, it seems like that you want to use Genetic Algorithms to get optimized roller coaster rail tracks. For any optimization problem:

  1. you will first need to break down your desired solution into its components or design variables.
  2. Once you have the "variables" you need to look at formulating a objective function with them. Usually you would code it in such a way that your desired solution minimizes it.
  3. Then you need to decide on a coding scheme to use in your Genetic Algorithm. Real Coded Genetic Algorithm is more useful in cases where you have a continuous search space.

These are the first things. Once you have them, you need to decide on a Crossover and Mutation strategy. Then finally you have to decide, whether you want to use a existing GA code in your problem, use some library or code it yourself.

A more descriptive question will help me to add more to this. What language are you looking to work in?

EDIT: I haven't used it myself, PARDISEO is a C++ template based library for among many other things, Genetic Algorithms, as well. Also, you can take a look at the C version of a Real Coded GA at http://www.iitk.ac.in/kangal/codes.shtml

From your(OP) comment:

Literally, all it does is load an xml file with some track coordinates, build the rails, and have teh camera follow these tracks like you were on a rollercoaster. All that in about 100 thousand lines of code

I think you would like to look at the track coordinates as possible design variables and see what combination of them give you a optimized (in terms of cost, better view, comfort, etc..) and then see what mathematical relation you can obtain among the best set. Then you are all set to apply GA to it. :)

Amit
The game engine is written in C++. Thanks for the great description of steps
Chris
Also, I'm sorry that I'm not more descriptive. There really isn't much to the game, which is what makes it a tough call for how genetic algorithms can be applied. Literally, all it does is load an xml file with some track coordinates, build the rails, and have teh camera follow these tracks like you were on a rollercoaster. All that in about 100 thousand lines of code.
Chris
@Chris: I updated my answer.
Amit