This is written by @Stradyvarious and @t1_hopscotch and @Rawrbear. See original post here.
Articificial intelligence/adaptive AI
Articifical intelligence is simulating learning from mistakes. This might include increasing the chance that favourable outcomes occur, or decreasing the chance that unfavourable outcomes happen.
An example of implementation – having an AI mimic or learn a player’s actions:
- Give an AI bot the ability to jump, move left and right.
- The more that the player jumps, we want the more likely that the AI will be set to jump. We can use a variable as a measure of how much the player jumps, and then use that to judge how much chance we should give that the AI will be likely to jump.
When player character jumps
increase "Jump" variable by 5
// Have the Jump variable decrease by 1 each second if it's above 0.
When "Jump" > 0
decrease "Jump" variable by 1
Wait 1 second
When "Jump" > 50
// this shows the player likes to have their character jump a lot.
have the AI chance of jumping when choosing an action be at more than 33%.
otherwise
// The jump variable can actually be modified to be made however you'd like it to be.
// The smaller the number, the less jumpier the AI will be.
// This is useful to know if your player's jump is programmed to be slow or as as rapid in-game.
// It's also possible to modify the wait time for a similar effect.
// keep the amount of jumping for the AI to somewhere near random, like 33% since the player does not favour jumping as much out of the three actions
This will make the AI spend more time jumping in the air, similar to the player’s behavior.
This is just a small idea sample.
Lots of possibilities to do with AI making decisions and copying/learning the player’s behavior are possible.
Here is a project example of an AI learning from experience:
You can see more context of the discussion here
http://forum.gethopscotch.com/t/stradyvarious-coding-topic/35156/43
There is another forum topic here:
http://forum.gethopscotch.com/t/hopscotch-theory-enemy-ai-with-evolution/1808
Do you want to interact with an example of a computer ‘learning’?
###Last One Loses
Playing a game against a computer, in two options:
-
computer remembers which moves lead to losing situations and avoids them
-
computer remembers which moves lead to winning situations and tries to favour those moves in higher preference
###Why can AI be handy?
For some problems you might not know all the solutions, or might not have the resources to determine a solution, there might not be a more efficient way to determine a solution or there might not even be a solution
In which case, you try to determine what’s preferable and increase the chance of it happening.
Feel very free to edit, again, and move everything around and rephrase and things.