How to determine the player’s aggressiveness in the game?

I am writing a game to promote gameboy, and I am implementing a basic AI in the form of a binary search tree. There is 1 person and 1 computer player. I need to figure out how to react aggressively to a computer. The person will press the button for the attack (and must be within a certain radius of the computer), so my first thought was to see how many attacks were compared with the number of iterations that my main loop whilewent through. This seems like a bad way to do this , although this number will depend on the frame rate, which can fluctuate. Does anyone have any ideas for a better way to do this?

+3
source share
4 answers

Why not just count the number of times a player can attack on a computer? I mean, you obviously need to check if it is within range, so why not check if it is within range, and if there is one, increase the counter could_have_attacked. Then, if he really attacks, increase the counter attacked. Then you can compare how often a human player attacks, how often he has the opportunity.

Alternatively, compare how often it is in range, how often it is not in range, or, as a rule, it tracks the average distance between players. More aggressive players are likely to be much closer to their opponents than to passive players.

, , . , , , .

+13

, . , , , , , , . , , , , , . , , . , "" , , .

+1

. , rnd(), 0 1 - . 0 1. , , , rnd() . - , .

0

-, . 5 :

float avgTimeWithoutCombat;
float currentTimeWithoutCombat;

float avgRateOfFire;
int shotsFired;
float combatTimeElapsed;

, "" currentTimeWithoutCombat. , avgTimeWithoutCombat 2, .

Each time a player attacks, the number of shots increases. Also count the battle time. Check the main circuit if a certain time has passed without any attacks. If so, the battle is over and you can calculate avgRateOfFire.

You now have two values ​​for measuring player aggressiveness:

  • avgTimeWithoutCombat: the higher the number, the less aggressive the player.
  • avgRateOfFire: the higher the number, the more aggressive the player.
0
source

Source: https://habr.com/ru/post/1706508/


All Articles