Need help with AI
Alrighty guys. I am working on a game, maybe 30 min to 1 hour a day (school & work...). But any way. I am making a turn by turn game. Totally original to the app store, so I am a little weary about explaining too much. But it is a lot like tic-tac-toe or chess in the aspect of strategy and turns.
My question is, can any one advise me about making AI to know "where to move"?
---Example 1: Crossing out bottom right in tic-tac-toe
---Example 2: Knight to A-8
Um, to recognize if if what and spaces are being occupied (needed for game strategy), I was thinking of using binary logic and recording them. But that alone would take 63 rules, to record any possible value.
---Example: A row with 5 possible slots has 32 open/close options (2^5).
-----00000
-----00001
-----00010
-----00011
-----etc
My question is, can any one advise me about making AI to know "where to move"?
---Example 1: Crossing out bottom right in tic-tac-toe
---Example 2: Knight to A-8
Um, to recognize if if what and spaces are being occupied (needed for game strategy), I was thinking of using binary logic and recording them. But that alone would take 63 rules, to record any possible value.
---Example: A row with 5 possible slots has 32 open/close options (2^5).
-----00000
-----00001
-----00010
-----00011
-----etc
Comments
However, if you really want to create an AI for a game then this is what I would suggest;
Everything has to be 'coded.'
So for example, in a turn based strategy game that I created I had each enemy with a set of rules that would determine what he would do each 'turn.' I did a change attribute: self.WhatToDo to Random(1,8). I created 8 different 'things' that the enemy could do. And, then edited each enemy type to do slightly different things to provide for better re-playability.
Honestly, if you think that it'll take 63 rules, the that might be what you have to do. Create 63 rules of possible moves for the 'enemy AI'.
In my opinion, the lack of enemy AI development is the weakest part of GameSalad. Best of luck to you though!
Best of luck to you though! I hope your game-dreams become a reality!
I guess to make my question more clear is, the other day I read code monkeys post about many attributes.
Um, Lets say that their are a bunch of different places to move, but I have a rule that tells the computer to take two spots. BUT how do I tell it what spots to take? My problem is keeping track of the "1 moves" "2moves" and so on...
Does that make sense?
Thanks Guys
Michael
I was making this system for another member, until I gave up because I did not have the time to take on such a massive project. This game two was a turn based strategy/board game. I can't really give out what I did, because it would be pages long. I can give you a summary
The computer needs to be smart, but not to smart. So each turn, it finds the possibilities of what can happen two turns ahead.
How could you accomplish that?
Well there's a couple steps you have to take.
1) You need a global attribute for each possible space a player, or an enemy can move to.
(This would be a great time for GameSalad to implement arrays!)
2) The enemy must detect the players coordinates at all time.
3) Enemy should be depending the angle between itself & the player at all times.
...
This should start you off. I can't really say any more until I know the objective of your game, you can email me if you'd like (matthewredler@gmail.com). Because the AI has to find a place to move based on his objective, which I have no idea what that is :P
Matt
Um, by any chance does any one know about how many lines of code a game of tic-tac-toe or four square would take? I have been thinking all day and I believe I have a solution to my problem. But there are just so many rules, I am afraid of the performance.
Finding open spots (62 rules & 257 Change Attributes):
--32 Rules: With 5 change attributes (160 CA's)
--16 Rules: With 4 change attributes (64 CA's)
--8 Rules: With 3 change attributes (23 CA's)
--4 Rules: With 2 change attributes (8 CA's)
--2 Rules: With 1 change attribute (2 CA's)
Moving (15 Rules & 125 Change Attributes):
--5 Rules: With 5 Change Attributes (25 CA's)
--5 Rules: With 10 Change Attributes (50 CA's)
--Random moving:
-----5 Rules: 10 Change Attributes (50 CA's)
So I'm look at around 77 Rules & 382 Change Attributes.
Nothing is movable, and the only timers are delays so no faster then .3 seconds