]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/bot/default/bot.qc
Add a new bot skill level for extremely tough bots
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / bot / default / bot.qc
index 5bfa79aa55edbb3ace3986e6fe60c8721d259329..2a663a10dc7e02b377704e7540ab6e730e32d526 100644 (file)
@@ -65,7 +65,11 @@ void bot_think(entity this)
        if(autocvar_bot_god)
                this.flags |= FL_GODMODE;
 
-       this.bot_nextthink = max(time, this.bot_nextthink) + max(0.01, autocvar_bot_ai_thinkinterval * min(14 / (skill + this.bot_aiskill + 14), 1));
+       // if bot skill is high enough don't limit their think frequency
+       if (SUPERBOT)
+               this.bot_nextthink = max(time, this.bot_nextthink) + 0.005;
+       else
+               this.bot_nextthink = max(time, this.bot_nextthink) + max(0.01, autocvar_bot_ai_thinkinterval * min(14 / (skill + this.bot_aiskill + 14), 1));
 
        if (!IS_PLAYER(this) || (autocvar_g_campaign && !campaign_bots_may_start))
        {
@@ -91,13 +95,19 @@ void bot_think(entity this)
        this.dmg_save = 0;
        this.dmg_inflictor = NULL;
 
-       // calculate an aiming latency based on the skill setting
-       // (simulated network latency + naturally delayed reflexes)
-       //this.ping = 0.7 - bound(0, 0.05 * skill, 0.5); // moved the reflexes to bot_aimdir (under the name 'think')
-       // minimum ping 20+10 random
-       CS(this).ping = bound(0,0.07 - bound(0, (skill + this.bot_pingskill) * 0.005,0.05)+random()*0.01,0.65); // Now holds real lag to server, and higer skill players take a less laggy server
-       // skill 10 = ping 0.2 (adrenaline)
-       // skill 0 = ping 0.7 (slightly drunk)
+       // if bot skill is high enough don't assign latency to them
+       if (SUPERBOT)
+               CS(this).ping = 0;
+       else
+       {
+               // calculate an aiming latency based on the skill setting
+               // (simulated network latency + naturally delayed reflexes)
+               //this.ping = 0.7 - bound(0, 0.05 * skill, 0.5); // moved the reflexes to bot_aimdir (under the name 'think')
+               // minimum ping 20+10 random
+               CS(this).ping = bound(0,0.07 - bound(0, (skill + this.bot_pingskill) * 0.005,0.05)+random()*0.01,0.65); // Now holds real lag to server, and higher skill players take a less laggy server
+               // skill 10 = ping 0.2 (adrenaline)
+               // skill 0 = ping 0.7 (slightly drunk)
+       }
 
        // clear buttons
        PHYS_INPUT_BUTTON_ATCK(this) = false;
@@ -285,6 +295,24 @@ void bot_setnameandstuff(entity this)
        READSKILL(bot_thinkskill, 1, 0.5); // think skill
        READSKILL(bot_aiskill, 2, 0); // "ai" skill
 
+       // if bot skill is high enough don't limit their skill
+       if (SUPERBOT)
+       {
+               // commented out means they're meaningless with this high skill
+               // no reason to set them, uncomment if this changes
+               //this.havocbot_keyboardskill = 10;
+               //this.bot_moveskill = 10; //midair modifier sets this to 0 to disable bhop
+               //this.bot_dodgeskill = 10;
+               //this.bot_pingskill = 10;
+               //this.bot_weaponskill = 10;
+               //this.bot_aggresskill = 10;
+               this.bot_rangepreference = 1; // no range preference modification
+               //this.bot_aimskill = 10;
+               //this.bot_offsetskill = 10;
+               //this.bot_mouseskill = 10;
+               //this.bot_thinkskill = 10;
+               //this.bot_aiskill = 10;
+       }
        if (file >= 0 && argv(prio) != "")
                LOG_INFOF("^1Warning^7: too many parameters for bot %s, please check format of %s", bot_name, autocvar_bot_config_file);