From 41de3ef337fc7e57560ee876af8d27640ae8b8a7 Mon Sep 17 00:00:00 2001 From: div0 Date: Sun, 30 Apr 2006 19:14:26 +0000 Subject: [PATCH] havocbots now play CTF! git-svn-id: svn://svn.icculus.org/nexuiz/trunk@1352 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/maps/campaign.txt | 2 +- data/maps/nexdm13.waypoints | 30 +++++++ data/maps/nexdm19.waypoints | 102 +++++++++++------------ data/maps/nexdmextra2.waypoints | 50 ++--------- data/qcsrc/server/gamec/campaign.c | 5 +- data/qcsrc/server/gamec/constants.h | 6 ++ data/qcsrc/server/gamec/ctf.c | 4 - data/qcsrc/server/gamec/havocbot.c | 2 +- data/qcsrc/server/gamec/havocbot_roles.c | 69 ++++++++------- 9 files changed, 130 insertions(+), 140 deletions(-) create mode 100644 data/maps/nexdm13.waypoints diff --git a/data/maps/campaign.txt b/data/maps/campaign.txt index 5ddd4a45e..63e4b25f4 100644 --- a/data/maps/campaign.txt +++ b/data/maps/campaign.txt @@ -10,7 +10,7 @@ dom_nexdm02 3 0 300 "" dom_nexdm04 3 1 300 "" "Domination on Skyway" "Find the following items: Rocket launcher, Megahealth, Strength." ctf_nexdm13 3 0 60 "" "CTF on Dismal" "Capture the Flag: take the enemy flag and bring it to your base, touching your flag. Prevent your enemy from doing the same." ctf_nexctf01 3 1 60 "" "CTF on Basement" "This map is a variant of the first map you played. Hint: use the laser." -dm_nexdm14 2 1 10 "g_minstagib 1" "MinstaGib on Soylent Space" "MinstaGib: all you have is a sniper gun with integrated laser. Use it." +dm_nexdm14 2 -1 10 "g_minstagib 1" "MinstaGib on Soylent Space" "MinstaGib: all you have is a sniper gun with integrated laser. Use it." dm_nexdmextra1 1 1 10 "g_cloaked 1" "Cloaked DM on Q1Dm6 remake" "Watch out, everyone is partially invisible!" dm_nexdm09 3 1 10 "g_nixnex 1" "NixNex DM on Aneurism" "No-items-Nexuiz: everyone has the same weapon as the others. Weapons are cycled in regular intervals." dm_nexdm12 2 2 10 "g_rocketarena 1" "RL arena on Evil Space" "You will LOVE that." diff --git a/data/maps/nexdm13.waypoints b/data/maps/nexdm13.waypoints new file mode 100644 index 000000000..bb0dfe3dc --- /dev/null +++ b/data/maps/nexdm13.waypoints @@ -0,0 +1,30 @@ +'1641.2 -1050.0 344.0' +'1641.2 -1050.0 344.0' +0 +'1607.8 420.3 344.0' +'1607.8 420.3 344.0' +0 +'-578.3 -43.3 10.0' +'-578.3 -43.3 10.0' +0 +'-177.1 -112.5 8.0' +'-177.1 -112.5 8.0' +0 +'-11.5 166.6 8.0' +'-11.5 166.6 8.0' +0 +'-140.6 317.9 8.0' +'-140.6 317.9 8.0' +0 +'2771.5 -775.9 8.0' +'2771.5 -775.9 8.0' +0 +'2870.0 -1044.6 10.0' +'2870.0 -1044.6 10.0' +0 +'2954.2 -588.0 8.0' +'2954.2 -588.0 8.0' +0 +'3316.8 -704.1 10.0' +'3316.8 -704.1 10.0' +0 diff --git a/data/maps/nexdm19.waypoints b/data/maps/nexdm19.waypoints index efac0a93c..da8df8f26 100644 --- a/data/maps/nexdm19.waypoints +++ b/data/maps/nexdm19.waypoints @@ -1,81 +1,75 @@ -'2033.2 2429.0 254.4' -'2033.2 2429.0 254.4' -0 -'1582.3 2110.1 301.8' -'1582.3 2110.1 301.8' +'3022.1 1915.1 24.0' +'3022.1 1915.1 24.0' 0 -'2412.5 1564.1 306.0' -'2412.5 1564.1 306.0' +'1666.0 2261.1 -52.8' +'1666.0 2261.1 -52.8' 0 -'1930.5 2011.9 -62.4' -'1930.5 2011.9 -62.4' +'2767.4 1534.7 254.4' +'2767.4 1534.7 254.4' 0 -'1561.6 2248.9 254.4' -'1561.6 2248.9 254.4' +'2559.5 1305.1 408.0' +'2559.5 1305.1 408.0' 0 -'1644.9 2035.7 339.0' -'1644.9 2035.7 339.0' +'2054.4 2246.4 -47.8' +'2054.4 2246.4 -47.8' 0 -'1778.2 1730.2 408.0' -'1778.2 1730.2 408.0' +'2641.7 1406.7 339.0' +'2641.7 1406.7 339.0' 0 -'2599.4 2619.9 254.4' -'2599.4 2619.9 254.4' +'3030.8 2057.8 24.0' +'3030.8 2057.8 24.0' 0 -'2601.9 2371.8 254.4' -'2601.9 2371.8 254.4' +'3025.4 2289.4 120.7' +'3025.4 2289.4 120.7' 0 -'1654.9 1910.0 406.0' -'1654.9 1910.0 406.0' +'3017.3 2601.5 254.4' +'3017.3 2601.5 254.4' 0 -'2593.7 2021.9 254.4' -'2593.7 2021.9 254.4' +'2049.0 2005.3 408.0' +'2049.0 2005.3 408.0' 0 -'2393.0 2186.9 254.4' -'2393.0 2186.9 254.4' +'2015.2 2197.2 335.0' +'2015.2 2197.2 335.0' 0 -'2451.4 1675.6 254.4' -'2451.4 1675.6 254.4' +'2416.9 1293.7 408.0' +'2416.9 1293.7 408.0' 0 '2432.5 1454.1 361.0' '2432.5 1454.1 361.0' 0 -'2416.9 1293.7 408.0' -'2416.9 1293.7 408.0' -0 -'2039.7 2310.2 278.5' -'2039.7 2310.2 278.5' +'2451.4 1675.6 254.4' +'2451.4 1675.6 254.4' 0 -'2044.6 2147.4 359.9' -'2044.6 2147.4 359.9' +'2393.0 2186.9 254.4' +'2393.0 2186.9 254.4' 0 -'2049.0 2005.3 408.0' -'2049.0 2005.3 408.0' +'2593.7 2021.9 254.4' +'2593.7 2021.9 254.4' 0 -'3017.3 2601.5 254.4' -'3017.3 2601.5 254.4' +'1654.9 1910.0 406.0' +'1654.9 1910.0 406.0' 0 -'3025.4 2289.4 120.7' -'3025.4 2289.4 120.7' +'2601.9 2371.8 254.4' +'2601.9 2371.8 254.4' 0 -'3030.8 2057.8 24.0' -'3030.8 2057.8 24.0' +'2599.4 2619.9 254.4' +'2599.4 2619.9 254.4' 0 -'2641.7 1406.7 339.0' -'2641.7 1406.7 339.0' +'1778.2 1730.2 408.0' +'1778.2 1730.2 408.0' 0 -'2054.4 2246.4 -47.8' -'2054.4 2246.4 -47.8' +'1644.9 2035.7 339.0' +'1644.9 2035.7 339.0' 0 -'2559.5 1305.1 408.0' -'2559.5 1305.1 408.0' +'1561.6 2248.9 254.4' +'1561.6 2248.9 254.4' 0 -'2767.4 1534.7 254.4' -'2767.4 1534.7 254.4' +'1930.5 2011.9 -62.4' +'1930.5 2011.9 -62.4' 0 -'1666.0 2261.1 -52.8' -'1666.0 2261.1 -52.8' +'2412.5 1564.1 306.0' +'2412.5 1564.1 306.0' 0 -'3022.1 1915.1 24.0' -'3022.1 1915.1 24.0' +'2033.2 2429.0 254.4' +'2033.2 2429.0 254.4' 0 diff --git a/data/maps/nexdmextra2.waypoints b/data/maps/nexdmextra2.waypoints index 55effa5a4..9eda4d790 100644 --- a/data/maps/nexdmextra2.waypoints +++ b/data/maps/nexdmextra2.waypoints @@ -1,11 +1,14 @@ +'114.5 -264.6 -176.0' +'114.5 -264.6 -176.0' +0 '-217.2 703.7 160.2' '-217.2 703.7 160.2' 0 -'-221.3 771.2 126.4' -'-221.3 771.2 126.4' +'-108.8 927.0 64.0' +'-108.8 927.0 64.0' 0 -'-216.7 933.9 45.1' -'-216.7 933.9 45.1' +'-218.3 888.4 67.8' +'-218.3 888.4 67.8' 0 '-216.8 650.5 184.0' '-216.8 650.5 184.0' @@ -28,51 +31,12 @@ '-265.7 -411.3 -56.0' '-265.7 -411.3 -56.0' 0 -'-194.7 -406.5 -76.0' -'-194.7 -406.5 -76.0' -0 -'-158.3 -404.0 -96.0' -'-158.3 -404.0 -96.0' -0 -'-99.9 -400.0 -136.0' -'-99.9 -400.0 -136.0' -0 '-41.6 -396.0 -156.0' '-41.6 -396.0 -156.0' 0 -' 52.0 -270.1 -176.0' -' 52.0 -270.1 -176.0' -0 -' 0.2 -355.3 -176.0' -' 0.2 -355.3 -176.0' -0 -' 38.0 -131.8 -256.0' -' 38.0 -131.8 -256.0' -0 -' 29.4 -174.9 -236.0' -' 29.4 -174.9 -236.0' -0 -' 68.2 -204.7 -216.0' -' 68.2 -204.7 -216.0' -0 -' 84.1 -109.0 -256.0' -' 84.1 -109.0 -256.0' -0 -'122.8 -73.1 -276.0' -'122.8 -73.1 -276.0' -0 -' 54.9 -75.8 -276.0' -' 54.9 -75.8 -276.0' -0 '116.0 -24.8 -296.0' '116.0 -24.8 -296.0' 0 -'115.8 -311.8 -176.0' -'115.8 -311.8 -176.0' -0 -' 94.9 -157.6 -236.0' -' 94.9 -157.6 -236.0' -0 ' 92.8 75.2 -296.0' ' 92.8 75.2 -296.0' 0 diff --git a/data/qcsrc/server/gamec/campaign.c b/data/qcsrc/server/gamec/campaign.c index a798aa46e..333548df2 100644 --- a/data/qcsrc/server/gamec/campaign.c +++ b/data/qcsrc/server/gamec/campaign.c @@ -85,7 +85,10 @@ void() CampaignPreInit = cvar_set("bot_number", ftos(campaign_bots[0])); baseskill = cvar("g_campaign_skill"); - cvar_set("skill", ftos(campaign_botskill[0] + baseskill)); + baseskill = baseskill + campaign_botskill[0]; + if(baseskill < 0) + baseskill = 0; + cvar_set("skill", ftos(baseskill)); title = campaign_shortdesc[0]; campaign_message = strzone(strcat("\n\n\n\n\n\n\n\n\n\n^1\n", title, "\n^3\n", Campaign_wordwrap(campaign_longdesc[0], 50))); diff --git a/data/qcsrc/server/gamec/constants.h b/data/qcsrc/server/gamec/constants.h index 2a8d2c0b7..3fae61d5f 100644 --- a/data/qcsrc/server/gamec/constants.h +++ b/data/qcsrc/server/gamec/constants.h @@ -201,3 +201,9 @@ float game; // set to "gamecfg" on worldspawn float TE_BEAM = 13; // grappling hook + +// CTF +float FLAG_BASE = 1; +float FLAG_CARRY = 2; +float FLAG_DROPPED = 3; + diff --git a/data/qcsrc/server/gamec/ctf.c b/data/qcsrc/server/gamec/ctf.c index 5c9dd44c6..3f46949d7 100644 --- a/data/qcsrc/server/gamec/ctf.c +++ b/data/qcsrc/server/gamec/ctf.c @@ -8,10 +8,6 @@ //float FLAGSCORE_CAPTURE = 5; //float FLAGSCORE_CAPTURE_TEAM = 20; -float FLAG_BASE = 1; -float FLAG_CARRY = 2; -float FLAG_DROPPED = 3; - void() FlagThink; void() FlagTouch; diff --git a/data/qcsrc/server/gamec/havocbot.c b/data/qcsrc/server/gamec/havocbot.c index bf632d79f..a3f6e1c2f 100644 --- a/data/qcsrc/server/gamec/havocbot.c +++ b/data/qcsrc/server/gamec/havocbot.c @@ -224,5 +224,5 @@ void() havocbot_setupbot = { self.bot_ai = havocbot_ai; // will be updated by think code - havocbot_chooserole_dm(); + havocbot_chooserole(); } diff --git a/data/qcsrc/server/gamec/havocbot_roles.c b/data/qcsrc/server/gamec/havocbot_roles.c index 95b7821ab..b8c9b8eaf 100644 --- a/data/qcsrc/server/gamec/havocbot_roles.c +++ b/data/qcsrc/server/gamec/havocbot_roles.c @@ -1,5 +1,5 @@ -//.float havocbot_role_timeout; +.float havocbot_role_timeout; .float bot_strategytime; .void() havocbot_role; @@ -49,7 +49,11 @@ void(float ratingscale, vector org, float sradius) havocbot_goalrating_enemyplay } }; -/* + +void() havocbot_role_ctf_middle; +void() havocbot_role_ctf_defense; +void() havocbot_role_ctf_offense; + void(float ratingscale, vector org, float sradius) havocbot_goalrating_ctf_carrieritems = { local entity head; @@ -59,7 +63,7 @@ void(float ratingscale, vector org, float sradius) havocbot_goalrating_ctf_carri { // look for health and armor only if (head.solid) // must be possible to pick up (respawning items don't count) - if (head.bot_pickupevalfunc == item_health_pickupeval || head.bot_pickupevalfunc == item_armor_pickupeval) + if (head.health || head.armorvalue) if (vlen(head.origin - org) < sradius) { // debugging @@ -68,7 +72,7 @@ void(float ratingscale, vector org, float sradius) havocbot_goalrating_ctf_carri // get the value of the item t = head.bot_pickupevalfunc(self, head) * 0.0001; if (t > 0) - havocbot_routerating(head, t * ratingscale); + navigation_routerating(head, t * ratingscale); } head = head.chain; } @@ -81,7 +85,7 @@ void(float ratingscale) havocbot_goalrating_ctf_ourflag = head = find(world, classname, "item_flag_team1"); // red flag else // blue head = find(world, classname, "item_flag_team2"); // blue flag - havocbot_routerating(head, ratingscale); + navigation_routerating(head, ratingscale); }; void(float ratingscale) havocbot_goalrating_ctf_enemyflag = @@ -91,7 +95,7 @@ void(float ratingscale) havocbot_goalrating_ctf_enemyflag = head = find(world, classname, "item_flag_team2"); // blue flag else // blue head = find(world, classname, "item_flag_team1"); // red flag - havocbot_routerating(head, ratingscale); + navigation_routerating(head, ratingscale); }; void(float ratingscale) havocbot_goalrating_ctf_ourstolenflag = @@ -102,7 +106,7 @@ void(float ratingscale) havocbot_goalrating_ctf_ourstolenflag = else // blue head = find(world, classname, "item_flag_team2"); // blue flag if (head.cnt != FLAG_BASE) - havocbot_routerating(head, ratingscale); + navigation_routerating(head, ratingscale); }; void(float ratingscale) havocbot_goalrating_ctf_droppedflags = @@ -118,9 +122,9 @@ void(float ratingscale) havocbot_goalrating_ctf_droppedflags = error("havocbot: item_flag_team2 missing\n"); if (redflag.cnt != FLAG_BASE) // red flag is carried or out in the field - havocbot_routerating(redflag, ratingscale); + navigation_routerating(redflag, ratingscale); if (blueflag.cnt != FLAG_BASE) // blue flag is carried or out in the field - havocbot_routerating(blueflag, ratingscale); + navigation_routerating(blueflag, ratingscale); }; // CTF: (always teamplay) @@ -147,7 +151,7 @@ void() havocbot_role_ctf_carrier = { if (self.flagcarried == world) { - bprint("changing role to middle\n"); + dprint("changing role to middle\n"); self.havocbot_role = havocbot_role_ctf_middle; self.havocbot_role_timeout = 0; return; @@ -174,12 +178,11 @@ void() havocbot_role_ctf_offense = //local entity f; if (self.flagcarried) { - bprint("changing role to carrier\n"); + dprint("changing role to carrier\n"); self.havocbot_role = havocbot_role_ctf_carrier; self.havocbot_role_timeout = 0; return; } -*/ /* // check our flag if (self.team == 5) // red @@ -188,18 +191,17 @@ void() havocbot_role_ctf_offense = f = find(world, classname, "item_flag_team2"); if (f.cnt != FLAG_BASE && canreach(f)) { - bprint("changing role to interceptor\n"); + dprint("changing role to interceptor\n"); self.havocbot_role = havocbot_role_ctf_interceptor; self.havocbot_role_timeout = 0; return; } */ -/* if (!self.havocbot_role_timeout) self.havocbot_role_timeout = time + random() * 30 + 60; - if (Inventory_Quantity(self, "rockets") < 15 || time > self.havocbot_role_timeout) + if (self.ammo_rockets < 15 || time > self.havocbot_role_timeout) { - bprint("changing role to middle\n"); + dprint("changing role to middle\n"); self.havocbot_role = havocbot_role_ctf_middle; self.havocbot_role_timeout = 0; return; @@ -226,12 +228,11 @@ void() havocbot_role_ctf_middle = { if (self.flagcarried) { - bprint("changing role to carrier\n"); + dprint("changing role to carrier\n"); self.havocbot_role = havocbot_role_ctf_carrier; self.havocbot_role_timeout = 0; return; } -*/ /* // check our flag if (self.team == 5) // red @@ -240,26 +241,25 @@ void() havocbot_role_ctf_middle = f = find(world, classname, "item_flag_team2"); if (f.cnt != FLAG_BASE && canreach(f)) { - bprint("changing role to interceptor\n"); + dprint("changing role to interceptor\n"); self.havocbot_role = havocbot_role_ctf_interceptor; self.havocbot_role_timeout = 0; return; } */ -/* if (!self.havocbot_role_timeout) self.havocbot_role_timeout = time + random() * 10 + 10; if (time > self.havocbot_role_timeout) - if (Inventory_Quantity(self, "rockets") >= 25) + if (self.ammo_rockets >= 25) { if (random() < 0.5) { - bprint("changing role to offense\n"); + dprint("changing role to offense\n"); self.havocbot_role = havocbot_role_ctf_offense; } else { - bprint("changing role to defense\n"); + dprint("changing role to defense\n"); self.havocbot_role = havocbot_role_ctf_defense; } self.havocbot_role_timeout = 0; @@ -289,12 +289,11 @@ void() havocbot_role_ctf_defense = local entity f; if (self.flagcarried) { - bprint("changing role to carrier\n"); + dprint("changing role to carrier\n"); self.havocbot_role = havocbot_role_ctf_carrier; self.havocbot_role_timeout = 0; return; } -*/ /* // check our flag if (self.team == 5) // red @@ -303,18 +302,17 @@ void() havocbot_role_ctf_defense = f = find(world, classname, "item_flag_team2"); if (f.cnt != FLAG_BASE && canreach(f)) { - bprint("changing role to interceptor\n"); + dprint("changing role to interceptor\n"); self.havocbot_role = havocbot_role_ctf_interceptor; self.havocbot_role_timeout = 0; return; } */ -/* if (!self.havocbot_role_timeout) self.havocbot_role_timeout = time + random() * 20 + 30; - if (Inventory_Quantity(self, "rockets") < 15 || time > self.havocbot_role_timeout) + if (self.ammo_rockets < 15 || time > self.havocbot_role_timeout) { - bprint("changing role to middle\n"); + dprint("changing role to middle\n"); self.havocbot_role = havocbot_role_ctf_middle; self.havocbot_role_timeout = 0; return; @@ -327,7 +325,6 @@ void() havocbot_role_ctf_defense = havocbot_goalrating_items(10000, f.origin, 10000); navigation_goalrating_end(); } -*/ /* // FIXME: place info_ctf_defensepoint entities in CTF maps and use them // change position occasionally @@ -348,7 +345,7 @@ void() havocbot_role_ctf_defense = // if there are no defensepoints defined, switch to middle if (self.goalentity == world) { - bprint("changing role to middle\n"); + dprint("changing role to middle\n"); self.havocbot_role = havocbot_role_ctf_middle; self.havocbot_role_timeout = 0; return; @@ -358,7 +355,6 @@ void() havocbot_role_ctf_defense = if (self.goalentity != world) self.goalentity.count = time + 0.5; */ -/* }; // CTF: @@ -366,6 +362,7 @@ void() havocbot_role_ctf_defense = void() havocbot_chooserole_ctf = { local float r; + dprint("choose CTF role...\n"); if (self.team == 13) self.havocbot_role = havocbot_role_ctf_rogue; else @@ -379,7 +376,6 @@ void() havocbot_chooserole_ctf = self.havocbot_role = havocbot_role_ctf_defense; } }; -*/ //DM: //go to best items @@ -402,11 +398,12 @@ void() havocbot_chooserole_dm = void() havocbot_chooserole = { + dprint("choose a role...\n"); navigation_routetogoal(world); self.bot_strategytime = -1; - //if (cvar("g_ctf")) - // havocbot_chooserole_ctf(); - //else // assume anything else is deathmatch + if (cvar("g_ctf")) + havocbot_chooserole_ctf(); + else // assume anything else is deathmatch havocbot_chooserole_dm(); }; -- 2.39.2