You really don't want to use a GA to do pathfinding, it's about as poorly fitting for the problem as you can get. GAs work best with big 'fuzzy' problem spaces where you're trying to find some optimal configuration. Besides, pathfinding is a (largely) solved problem with methods which will be guranteed to produce the optimal answer in a finite amount of time - something no GA is going to be able to do.

You really don't want to use a GA to do pathfinding, it's about as poorly fitting for the problem as you can get. GAs work best with big 'fuzzy' problem spaces where you're trying to find some optimal configuration. Besides, pathfinding is a (largely) solved problem with methods which will be guranteed to produce the optimal answer in a finite amount of time - something no GA is going to be able to do.

So GAs are good for general AI such as that in a FPS or an RTS?How do neural nets compare in that regard?

A Genetic Algorithm (GA) is a search optimization technique. It is mostly used to find the optimal or near-optimal solution to a problem. If the problem is path finding, then each individual in the population has to represent a solution to the path finding problem. But in order to find that optimal or near-optimal solution, each individual has to be tested and that will represent one generation. It may take hundreds or even thousands of generations to find the best solution.

I'm working on a similiar situation. I'm currently working on a Real-Time AI Animation of a spacecraft flying through an asteroid belt. I planned to use a neural flight controller that is optimized by a GA. The initial optimization will run off-line to find the best set of weights for the neural network. Then the neural network would be used during the animation/simulation. Consider using your GA to optimized either the weights or the topology of a neural network in an offline process. That neural network could be part of your path finding algorithm used during your game once the neural network is optimized.

Basically you're saying neural nets can be used in conjunction with a GA to find an optimal solution to the problem?

This has been done for quite some time now. For example a neural network is used to control a cart-pole system where a pole is hinged to a cart on a track. Input into the neural network would be the angle of the pole with respect to the y-axis, the angular speed of the pole, the position of the cart on the track with respect to the x-axis, and the speed of the cart. Output from the neural network is the force applied to either side of the cart to keep the pole balanced. The individuals in the GA can represent either the weights of the network or the topology of the network. The GAs responsibility will be to search for the individual that can balance the pole the longest. Letting time be the fitness score for the individuals.

I personally believe that fuzzy logic, neural networks and genetic algorithms can be used to make a strong AI Engine. But a powerful processor is required for such an AI engine.

The things EP generally needs in the problem in order to do really well are: - no single perfect solution, nor any single always-best tactic (if so, WTF are you wasting time with EP for?) - lots of solutions that seem pretty good given any particular scenario within the game, but different scenarios cause different sets of possible solutions, and different weightings of them - fine-grained feedback on how successful the player is with their current strategy (score in a shmup is a good one, number of resources in an RTS is absolutely awful - high resources does NOT mean they are currently doing well!)

Blah^3:How big of a system do you think I'd need to have a GA playing M:TG?I'd hate to think that my A64 3000+ will be playing M:TG at 1fph.

You would probably want something like 200 islands with a thousand or maybe 5-10k individuals per generation.

Maybe a few k generations to get a vaguely interesting deck?

But that assumes you've already got an algorithm that plays the game optimally given a deck; if you're making algorithms taht both play the deck and select it, I'd say you probably have to quadruple the population size, maybe mroe.

Those pop sizes may also turn out to be out by a factor of 10, potentially.

So, the question becomes: how long does it take you to run a few billion games of magic (to get a "vaguely interesting" deck)?

GAs for the Java VM.The JVM is complex enough and an optimised GA could make improve performance over the current VM.Of course computers will need to increase in performance before the benefits outwiegh the cons.

When I complete my Epic World-Beating Masterpiece (tm) in which the majority of the gameworld will be automatically generated (this is a plan I will be completing either when I grow up or when I suddenly and inexplicably become rich and have loads of time on my hands) I plan to use GA stuff for some of the AI development but I would only ever think to use it in scene-setting rather than in-game. I can't even think of a way it could be used in-game, but I may be entirely unimaginative in this respect.

When I complete my Epic World-Beating Masterpiece (tm) in which the majority of the gameworld will be automatically generated (this is a plan I will be completing either when I grow up or when I suddenly and inexplicably become rich and have loads of time on my hands) I plan to use GA stuff for some of the AI development but I would only ever think to use it in scene-setting rather than in-game. I can't even think of a way it could be used in-game, but I may be entirely unimaginative in this respect.

Yes, that was my point. I was wondering what type of in-game problems could besolved by applying GA techniques that wouldn't be easier to solve another way.

I'm not thinking about any particular game but in terms of the type of problem you encounter in game construction I was finding it very hard to see how GAs could be used to solve them.

It occurs to me that it would be possible in an Action RPG or similar to use genetic techniques to choose enemy strategies, pushing enemy behaviour towards previously successful methods and making the game more challenging as a user progresses, so that's one example. Any others welcome...

Counter Strike Source could even benefit from a GA.You could use a GA to determine what's the best pattern of attack based on previous results.IE: Dust, everyone loves to defend the 3 enterances, however majority of humans tend to gang up in a single area.

I don't think CS:S would benefit from it with the current maps because they don't allow much variation due to size.

I remember an article in Edge a few years ago about a company that was making a Ferrari-licenced racing game. They were using neural nets as driver AI. Each generation was given some track time, and then scored on how far they got around the track.Eventually, the AI drivers were putting in lap times only a few seconds short of the developers themselves.

At any rate, the developer subsequently went bust, or was bought out and the project aborted, or Ferrari pulled the licence, or some such depressing fate.

Another interesting example is the SodaRace competition. In this, humans and computers vie to create the fastest-moving structure. IIRC, the GA-based solutions quickly began exploiting flaws in the physics system, creating unstable structures that would "explode" accross the screen.

IIRC, the GA-based solutions quickly began exploiting flaws in the physics system, creating unstable structures that would "explode" accross the screen.

This always tends to happen with GA solutions.. two occurences of note:

- An artificial life simulator of a friends with some simple animals. The GA was used to evolve a 'balanced' eco system where no one species would dominate. Unfortunatly one of the earliest solutions evolved 'rocks' - all the animals figured that if they stayed still they never expended energy so could live forever.

- I was evolving a simple football AI to play an equally simple game of football. After some time one team started flicking the ball straight up from the center, then heading it into the goal, scoring every time. I still don't know how this happened, as the only availible action was pass and shoot. After tweeking the behaviour of the pass interception code, this magically went away...

IIRC, the GA-based solutions quickly began exploiting flaws in the physics system, creating unstable structures that would "explode" accross the screen.

This always tends to happen with GA solutions.. two occurences of note:

It is common with optimisation algorithms of all types --- flaws in the model get exploited in unexpected ways.

I remember a case where someone decided to improve performance by rounding times to integer minutes. The theory being that in the real world times to the nearest minute be easily accurate enough. Unfortunately the algorithm being used was minimising time and thus tended to choose values which had been rounded down. It was necessary to work in seconds to eliminate unwanted artifacts.

GA are used only when no reasonable other solution exist. Such algorithms might have some simillarities with GA, but often are/should be optimalized to don't have problems with speed/memory.Memory overhead of GA could be drastical. 1000:1 in comparison to reasonable algorithm. CPU demands are high too. So one way how they could be used is pregeneration of some solutions on developer's computer. In this way speed problems are reduced, and memory demands are lower as well.

Fitting function could be an another problem with GA. While some problems have easily defineable fitting function, others are more easily solvable than a programer could create a function that could decide if that solution was optimal, or not. Actually sometimes is hard to create a function that just reasonably aproximate effectivity of a solution.

Funny thing is that some GA methods are based upon myths created from Darwinism, and also on some racism.

If you'd look at that link I typed few posts ago, you could find another problems with GA. Being stuck in local optimum.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org