Jump to content

  • Log In with Google      Sign In   
  • Create Account

14 years ago on June 15th Gamedev.net was first launched! We want to thank all of you for being part of our community and hope the best years are ahead of us. Happy birthday Gamedev.net!

#ActualSimonForsman

Posted 28 September 2012 - 07:05 AM

thanks before, but my idea is to make AI that can randomly do perfect,good, and miss. but if the player have more perfect than the AI then the percentage of AI would do a perfect is up. according to that what algorithm should i use ?


I don't think there is any named algorithm for that. but something like:
1) set the AIs perfect and good chances to some good initial values (0.4 and 0.35 might work, leaving 5% chance to miss initially) (you can adjust these based on how well the player has done previously or based on how well he is currently doing) (you can for example raise these base values if the player hits several notes perfectly in a row)
2) if the "beat/note/whatever" is within 500 milliseconds of the previous one lower the perfect and good chances by 0.05 (if its identical to the previous one just lower chances by 0.02)
3) if the "beat/note/whatever" is within 200 milliseconds of the previous one, lower the perfect and good chances by an additional 0.05
4) if there hasn't been a note for Y milliseconds restore the AIs values to the initial values (This will make the AI perform better on easy tracks and worse when things happen rapidly, just like a human player)

get a random number between 0 and 1, if it is below the perfect chance the AI hits it perfectly else if its below the perfect+good chances its a good hit else miss.

Tweak the magic numbers and/or add more rules until its plays reasonably well.

#1SimonForsman

Posted 28 September 2012 - 07:04 AM

thanks before, but my idea is to make AI that can randomly do perfect,good, and miss. but if the player have more perfect than the AI then the percentage of AI would do a perfect is up. according to that what algorithm should i use ?


I don't think there is any named algorithm for that. but something like:
1) set the AIs perfect and good chances to some good initial values (0.4 and 0.35 might work, leaving 5% chance to miss initially) (you can adjust these based on how well the player has done previously or based on how well he is currently doing) (you can for example raise these base values if the player hits several notes perfectly in a row)
2) if the "beat/note/whatever" is within 500 milliseconds of the previous one lower the perfect and good chances by 0.05 (if its identical to the previous one just lower chances by 0.02)
3) if the "beat/note/whatever" is within 200 milliseconds of the previous one, lower the perfect and good chances by an additional 0.05
4) if there hasn't been a note for Y milliseconds restore the AIs values to the initial values (This will make the AI perform better on easy tracks and worse when things happen rapidly, just like a human player)

get a random number between 0 and 1, if it is below the perfect chance the AI hits it perfectly else if its below the perfect+good chances its a good hit else miss.

Tweak the magic numbers until its plays reasonably well.

PARTNERS