# anything AI-ish?

• 01-30-2005
cppdungeon
anything AI-ish?
does ANYONE use anything resembling a choice making thingie in any game they've made? im making a chess game, and i posted a tread erlier. this is different. i want to find other methods that work, so i can use them, as my method is'nt working.
• 01-30-2005
sean
I've done it. Do you have a more specific question? Have you searched google for Chess AI algorithms? What have you tried?
• 01-30-2005
Darkness
If you want something that's *really* into AI, look at the tutorials on this website that talks about Perceptrons. It's sort of like a neural network.

Also look for neural networks, fuzzy logic, and thresholds.

Now, this stuff isn't actually that hard to understand if you actually read about it (otherwise the term 'neural network' sounds a bit intimidating, but it really isn't all that hard to understand...honest).

If you use fuzzy logic and thresholds (which is basically what is talked about on the perceptron tutorial on this website) you can basically 'evolve' the AI by changing the threshold values. For example, each chess player has to consider X number of variables:

X1 + X2 + X3 etc

each of these 'variables' is typically things like 'how close am I to other pieces', or 'how much do I need to get from here to there' etc. Then, each 'variable' is weighted, based on either a method you choose, or some series of weights that has been evolved over time (the tutorial on this site tells how to change weights). The actual output behavior (in this case the chess board movement) depends on the output values of the sum of the weight multiplied with each variable and the threshold of the entity doing the 'thinking' in this case the chess piece.

that's a basic rudimentary way of getting started with neural networks and fuzzy logic. It's cool stuff but kind of confusing when you just start out.

the perceptron thing:
http://www.cprogramming.com/tutorial/AI/perceptron.html

the chess tutorial on this site:
http://www.cprogramming.com/tutorial...sboardrep.html

EDIT:
I actually think that the neural network thing and fuzzy logic thing might be a bit overkill for something that is ultimately just rule based.
• 01-30-2005
VirtualAce
Most games use a state machine architecture. Fire up some mission editors for well known video games and you will see what I mean. The only reason the AI even looks half-intelligent is because the level editor was careful in how they used the AI.

Most games have a very long way to go before we get decent AI - barring Firaxis games as I think they have some of the best AI out there.

But most of it is based on states like this:

1. Green - object continues patrol path - not alerted
2. Yellow - object may stop and look around - alerted but not in offensive mode
3. Red - object is firing at player - alerted and in offensive mode.

From here you normally set AI traits in the editor like:

* - Blind
* - Indestructable
* - Deaf
* - Will fire prone
* - Will only fire standing up
* - Fire timer (how long will object fire at player once alerted)
*- Patrolling (object will not fire at player until they reach waypoint)
*- Gurading (object will not run too far from patrol area - usfeul for buildings)

If the level editor uses theses values randomly then it looks like you have a bunch of guys who act differently...when in reality they are all pretty much following the same algos.

Novalogic has a very good scripting language that allows you to specify stuff like this:

if past(5) and never() then
SSN2SSN(1,2)
GtoWP(7,1)
endif

This essentially says if 5 seconds have past since mission started and this event has never happened before, move object with ID of 1 to object with ID of 2. Move group 7 to waypoint 1.

So your scripts actually control the game AI more than AI algos. Now if object 2 is a vehicle then your AI code in the game should say....drive the vehicle. That is not controlled by the level editor...or it could be...your choice.

Scripts and AI go hand in hand.
• 01-30-2005
Perspective
Check out the contest board. There is a thread for a connect 4 tournament and all the entries are posted. If should give you a decent look at minimax trees with alpha beta pruning.
• 01-31-2005
IfYouSaySo
Also for chess you may want to do a google search for "bitboards", since this one of the normal ways to implement the move generation.
• 02-03-2005
cppdungeon
THANK YOU!!! sorry, internet's been down for a while. anyways, specificly, somthing like this:

Code:

```if(world[x-1][y]==1){ a=1; }```
then a swich/case statement to decide where it goes like : case 2 x-1...
• 02-03-2005
sean
What are you intending us to use that code for? Has your question been answered?
• 02-06-2005
cppdungeon
im using it for a chess-like game more like fire emblem or advance wars.