]> de.git.xonotic.org Git - voretournament/voretournament.git/commitdiff
Make bots much smarter :)
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 14 Jul 2011 14:50:53 +0000 (17:50 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 14 Jul 2011 14:50:53 +0000 (17:50 +0300)
data/botsVT.cfg
data/qcsrc/server/bot/havocbot/vore_ai.qc

index 2876a72bb17574f408ed139785c8215df5dd02d6..1840624981004e419f915ad4008c409be790c7df 100644 (file)
@@ -45,10 +45,10 @@ set bot_ai_bunnyhop_skilloffset 7   "Bots with skill equal or greater than this va
 set bot_ai_bunnyhop_startdistance 250 "Run to goals located further than this distance"\r
 set bot_ai_bunnyhop_stopdistance 220 "Stop jumping after reaching this distance to the goal"\r
 set bot_ai_bunnyhop_firstjumpdelay 0.5 "Start running to the goal only if it was seen for more than N seconds"\r
-set bot_ai_vore_decide_pred 1 "How fast bots decide what to do with their prey, at lowest skill"\r
-set bot_ai_vore_decide_prey 1.2 "How fast bots decide what to do with their predator, at lowest skill"\r
-set bot_ai_vore_decide_swallow 0.8 "How often bots decide if to swallow someone"\r
-set bot_ai_vore_fear 2 "How much bots will fear players more powerful than them and avoid them in some situations"\r
+set bot_ai_vore_decide_pred 1 "How fast bots decide what to do with their prey, at lowest skill (delay in seconds)"\r
+set bot_ai_vore_decide_prey 1.2 "How fast bots decide what to do with their predator, at lowest skill (delay in seconds)"\r
+set bot_ai_vore_decide_swallow 0.6 "How often bots decide if to swallow someone, not influenced by skill (delay in seconds)"\r
+set bot_ai_vore_fear 1 "How much bots will fear players more powerful than them and avoid them in some situations"\r
 set bot_ai_vore_teamhealabandon 0.75 "Probability (from 0 to 1) of the bot abandoning a team heal when seeing an enemy they can vore, at highest skill"\r
 set bot_ai_vore_stayinstomach 0 "When enabled, a bot will stay in a team mate's stomach even if he has no reason to and could willingly leave"\r
 set bot_ai_vore_keepinstomach 0 "When enabled, a bot will keep a team mate in his stomach even if he has no reason to and could regurgitate him"\r
index a468fd7f52dffd90d08c45c474f611bc5bfd216b..b46f5a2f55d8884bb251358205787d9a986484c6 100644 (file)
@@ -5,10 +5,18 @@ float Swallow_condition_check_bot(entity prey)
 {
        // checks the necessary conditions for a bot to swallow a player
 
+       float kick_dmg;
+       if(cvar("g_vore_kick") && skill >= 7)
+       {
+               kick_dmg = cvar("g_balance_vore_kick_damage");
+               if(cvar("g_healthsize"))
+                       kick_dmg *= pow(prey.scale / self.scale, cvar("g_balance_vore_kick_scalediff")); // based on the damage the prey can do to us at his size
+       }
+
        if(Swallow_condition_check(prey)) // check the normal conditions of the vore system
        if(time >= prey.spawnshieldtime) // spawn shield means you are invincible
        if not(prey.BUTTON_CHAT) // don't eat players who are chatting
-       if(self.health > cvar("g_balance_vore_kick_damage") && skill >= 5) // explained below
+       if(self.health > kick_dmg)
                return TRUE;
        return FALSE;
 }
@@ -132,19 +140,23 @@ void Vore_AI()
 
                if(!cvar("g_vore_reversescoring")) // when reverse scoring is on, it's in the interest of the prey to get eaten, so the predator has nothing to fear
                {
-                       if(prey.items & IT_STRENGTH) // avoid eating bots that have the Strenght powerup
-                               fear += cvar("bot_ai_vore_fear") * self.bot_vorefear;
-                       if(prey.items & IT_INVINCIBLE) // avoid eating bots that have the Invincible powerup
-                               fear += cvar("bot_ai_vore_fear") * self.bot_vorefear;
-                       fear += self.stomach_load; // the bigger our stomach, the less we want to put someone else in there
+                       if(skill >= 3) // make bots aware of this from skill 3 and up
+                               fear *= 1 + self.stomach_load; // the bigger our stomach, the less we want to put someone else in there
+                       if(skill >= 5) // make bots aware of this from skill 5 and up
+                               fear *= 1 + prey.stomach_load; // predators fear prey that have a large stomach
+
                        if(cvar("g_healthsize"))
                                fear *= (prey.scale / self.scale); // predators fear larger prey and are courageous toward smaller prey
-                       if(prey.stomach_load)
-                               fear *= prey.stomach_load; // predators fear prey that have a large stomach
+                       if(prey.items & IT_STRENGTH) // avoid eating bots that have the Strenght powerup
+                               fear *= 2;
+                       if(prey.items & IT_INVINCIBLE) // avoid eating bots that have the Invincible powerup
+                               fear *= 2;
 
                        // when a bot is being swallowed, he will try to swallow the enemy back in defense, forgetting about fear
                        if(self.swallow_progress_prey)
                                fear /= self.swallow_progress_prey * skill;
+
+                       fear *= cvar("bot_ai_vore_fear") * self.bot_vorefear;
                }
 
                decide_pred_time = cvar("bot_ai_vore_decide_pred") / skill / self.bot_vorethinkpred;
@@ -176,7 +188,22 @@ void Vore_AI()
                {
                        // if the predator's health is smaller than the damage a stomach kick can do, regurgitate the player(s)
                        // otherwise the predator is putting himself at risk by keeping you inside
-                       if(self.health <= cvar("g_balance_vore_kick_damage") && skill >= 5) // such awareness comes from skill 5 and up
+                       float kick_dmg;
+                       if(cvar("g_vore_kick") && skill >= 7) // such awareness comes from skill level 7 and up
+                       {
+                               kick_dmg = cvar("g_balance_vore_kick_damage");
+                               if(cvar("g_healthsize"))
+                               {
+                                       entity e;
+                                       FOR_EACH_PLAYER(e) // count the size of all players in the stomach for accounting the danger level
+                                       {
+                                               if(e.predator == self)
+                                               if not(teamplay && e.team == self.team) // don't count team mates
+                                                       kick_dmg *= pow(e.scale / self.scale, cvar("g_balance_vore_kick_scalediff")); // based on the damage the prey can do to us at his size
+                                       }
+                               }
+                       }
+                       if(self.health <= kick_dmg)
                                self.BUTTON_REGURGITATE = TRUE;
 
                        else if(!self.digesting && cvar("g_vore_digestion"))