Compare commits

...
4 Commits
Author SHA1 Message Date
ineed bots e1ba6f94cb credit 2026-09-24 12:59:09 -06:00
ineed bots 374058938c add some comments for zk libcod 2026-09-24 12:47:05 -06:00
ineed bots 234dcfc9ce more accurate adapter 2026-09-24 12:22:54 -06:00
ineed bots 383a5692ea Getting ready for a release 2026-09-24 11:21:37 -06:00
6 changed files with 307 additions and 273 deletions
+124 -3
View File
@@ -1,6 +1,127 @@
![GitHub Logo](/bw-assets/bw-logo.png)
# IW2 Bot Warfare # IW2 Bot Warfare
Bot Warfare is a GSC mod for [CoD2rev Server](https://github.com/voron00/CoD2rev_Server)'s implementation of [libcod](https://znation.nl/cod2script/)'s bot functions.
Bot Warfare for CoD2. It aims to add playable AI to the multiplayer games of CoD2.
TODO: You can find the ModDB release post [here](https://www.moddb.com/mods/bot-warfare/downloads/iw2-bot-warfare-latest).
- docs
## <span style="color:red">Important to public dedicated servers</span>
The `bots_main_firstIsHost` CVAR is enabled by default!
This is so inexperienced users of the mod can access with menu without any configuration.
Make sure to disable this CVAR by adding `set bots_main_firstIsHost 0` in your server config!
## Contents
- [Features](#Features)
- [Installation](#Installation)
- [Documentation](#Documentation)
- [Changelog](#Changelog)
- [Credits](#Credits)
## Features
- A Waypoint Editor for creating and modifying bot's waypoints of traversing the map. Have a look at [Using the Waypoint editor](/bw-assets/wpedit.md).
- A clean and nice menu, you can edit every bot CVAR within in-game.
- Everything can be customized, ideal for both personal use and dedicated servers. Have a look at [Documentation](#Documentation) to see whats possible!
- This mod does not edit ANY stock .gsc files, meaning EVERY other mod is compatible with this mod. Mod doesn't add anything unnecessary, what you see is what you get.
- Adds AI clients to multiplayer games to simulate playing real players. (essentially Combat Training for CoD2)
- Bots move around the maps with native engine input. (all normal maps)
- Can load MeatBot waypoints as well.
- Bots press all the buttons with native engine input. (ads, jump, etc)
- Bots play all gamemodes/objectives, they capture flags, plant, defuse bombs, etc. (all normal modes)
- Bots can camp randomly.
- Bots can follow others on own will.
- Bots have smooth and realistic aim.
- Bots respond smartly to their surroundings, they will go to you if you shoot, compass, etc.
- Bots use all weapons.
- Bots difficulty level can be customized and are accurate. (hard is hard, easy is easy, etc.)
- Bots each all have different classes, traits, and difficulty and remember it all.
- Bots switch from between primaries and secondaries.
- Bots can throw grenades, they even use grenades in preset map locations.
- Bots can melee people.
- Bots can run!
- Bots can climb ladders!
- Bots jump shot and drop shot.
- Bots detect smoke grenades, and grenade slows.
- Bots will remember their class, skill and traits, even on multiround based gametypes.
- ... And pretty much everything you expect a Combat Training bot to have
## Installation
You can easily setup a local LAN dedicated server for you to join and play on.
0. Make sure that CoD2 server + libcod and game client is installed, updated and working properly.
- Download the [latest release](https://github.com/ineedbots/iw2_bot_warfare/releases) of Bot Warfare.
1. Locate your CoD2 server install folder.
2. Move the files/folders found in `Add to root of CoD2 server` from the Bot Warfare release archive you downloaded to the root of your CoD2 server folder.
- The folder/file structure should follow as `.CoD2 server folder/mods/mp_bots/z_svr_bots.iwd`.
3. The mod is now installed. Now before you start your server, you will need to set the `fs_game` CVAR to `mods/mp_bots` as a commandline argument (`+set fs_game "mods/mp_bots"`).
4. Now start your CoD2 client and connect to your server (`connect 127.0.0.1` in the console most likely) and play!
## Documentation
### Menu Usage
- You can open the menu by pressing the fire, activate and melee buttons together.
- You can navigate the options by the pressing the activate and fire keys, and you can select options by pressing your melee key.
- Pressing the menu button again closes menus.
### CVARs
| Cvar | Description | Default Value |
|----------------------------------|---------------------------------------------------------------------------------------------|--------------:|
| bots_main | Enable this mod. | 1 |
| bots_main_firstIsHost | The first player to connect will be given host. | 1 |
| bots_main_GUIDs | A comma separated list of GUIDs of players who will be given host. | |
| bots_main_waitForHostTime | How many seconds to wait for the host player to connect before adding bots to the match. | 10 |
| bots_main_menu | Enable the in-game menu for hosts. | 1 |
| bots_main_debug | Enable the in-game waypoint editor at start of the game, or enable bot event prints. <ul><li>`0` - disable</li><li>`1` - for just debug events</li><li>`2` - for every event</li><ul> | 0 |
| bots_main_kickBotsAtEnd | Kick the bots at the end of a match. | 1 |
| bots_main_chat | The rate bots will chat at, set to 0 to disable. | 1.0 |
| bots_manage_add | Amount of bots to add to the game, once bots are added, resets back to `0`. | 0 |
| bots_manage_fill | Amount of players/bots (look at `bots_manage_fill_mode`) to maintain in the match. | 0 |
| bots_manage_fill_mode | `bots_manage_fill` players/bots counting method.<ul><li>`0` - counts both players and bots.</li><li>`1` - only counts bots.</li><li>`2` - exactly `0` but auto adjusts `bots_manage_fill` to map.</li><li>`3` - exactly `1` but auto adjusts `bots_manage_fill` to map.</li><li>`4` - bots are used for balancing teams.</li><li>`5` - exactly `4` but auto adjusts `bots_manage_fill` to map.</li></ul> | 0 |
| bots_manage_fill_watchplayers | Bots will not be added until one player is in the game | 0 |
| bots_manage_fill_kick | If the amount of players/bots in the match exceeds `bots_manage_fill`, kick bots until no longer exceeds. | 0 |
| bots_manage_fill_spec | If when counting players for `bots_manage_fill` should include spectators. | 1 |
| bots_team | One of `autoassign`, `allies`, `axis`, `spectator`, or `custom`. What team the bots should be on. | autoassign |
| bots_team_amount | When `bots_team` is set to `custom`. The amount of bots to be placed on the axis team. The remainder will be placed on the allies team. | 0 |
| bots_team_force | If the server should force bots' teams according to the `bots_team` value. When `bots_team` is `autoassign`, unbalanced teams will be balanced. This cvar is ignored when `bots_team` is `custom`. | 0 |
| bots_team_mode | When `bots_team_force` is `1` and `bots_team` is `autoassign`, players/bots counting method. <ul><li>`0` - counts both players and bots.</li><li>`1` - only counts bots</li></ul> | 0 |
| bots_skill | Bots' difficulty.<ul><li>`0` - Random difficulty for each bot.</li><li>`1` - Easiest difficulty for all bots.</li><li>`2` to `6` - Between easy and hard difficulty for all bots.</li><li>`7` - The hardest difficulty for all bots.</li><li>`8` - custom (look at the `bots_skill_<team>_<difficulty>` cvars)</li><li>`9` - Every difficulty parameter is randomized</li></ul> | 0 |
| bots_skill_axis_hard | When `bots_skill` is set to `8`, the amount of hard difficulty bots to set on the axis team. | 0 |
| bots_skill_axis_med | When `bots_skill` is set to `8`, the amount of medium difficulty bots to set on the axis team. The remaining bots on the team will be set to easy difficulty. | 0 |
| bots_skill_allies_hard | When `bots_skill` is set to `8`, the amount of hard difficulty bots to set on the allies team. | 0 |
| bots_skill_allies_med | When `bots_skill` is set to `8`, the amount of medium difficulty bots to set on the allies team. The remaining bots on the team will be set to easy difficulty. | 0 |
| bots_skill_min | The minimum difficulty level for the bots. | 1 |
| bots_skill_max | The maximum difficulty level for the bots. | 7 |
| bots_play_move | If the bots can move. | 1 |
| bots_play_knife | If the bots can knife. | 1 |
| bots_play_fire | If the bots can fire. | 1 |
| bots_play_nade | If the bots can grenade. | 1 |
| bots_play_obj | If the bots can play the objective. | 1 |
| bots_play_camp | If the bots can camp. | 1 |
| bots_play_jumpdrop | If the bots can jump/drop shot. | 1 |
| bots_play_ads | If the bots can aim down sights. | 1 |
| bots_play_aim | If the bots can aim. | 1 |
## Changelog
- v2.3.0
- Initial release
## Credits
- voron00 - https://github.com/voron00/CoD2rev_Server
- INeedGames - http://www.moddb.com/mods/bot-warfare
- PeZBot team - http://www.moddb.com/mods/pezbot
- MeatBot team - https://www.moddb.com/mods/meatbot-v092
- Ability
- Salvation
Feel free to use code, host on other sites, host on servers, mod it and merge mods with it, just give credit where credit is due!
-INeedGames/INeedBot(s) @ ineedbots@outlook.com
+1 -6
View File
@@ -6,7 +6,7 @@
*/ */
init() init()
{ {
level.bw_version = "2.3.0 PR 1"; level.bw_version = "2.3.0";
if ( getcvar( "bots_main" ) == "" ) if ( getcvar( "bots_main" ) == "" )
{ {
@@ -131,11 +131,6 @@ init()
setcvar( "bots_skill_max", 7 ); setcvar( "bots_skill_max", 7 );
} }
if ( getcvar( "bots_loadout_rank" ) == "" ) // what rank the bots should be around, -1 is around the players, 0 is all random
{
setcvar( "bots_loadout_rank", -1 );
}
if ( getcvar( "bots_play_move" ) == "" ) // bots move if ( getcvar( "bots_play_move" ) == "" ) // bots move
{ {
setcvar( "bots_play_move", true ); setcvar( "bots_play_move", true );
+1 -1
View File
@@ -173,7 +173,7 @@ doGreetings()
wait 1; wait 1;
self iprintln( "Welcome to Bot Warfare " + self.name + "!" ); self iprintln( "Welcome to Bot Warfare " + self.name + "!" );
wait 5; wait 5;
self iprintln( "Press [{+attack}] + [{+activate}] + [{+melee_breath}] to open menu!" ); self iprintln( "Press [{+attack}] + [{+activate}] + [{+melee_breath}] / [{+melee}] to open menu!" );
} }
watchPlayerOpenMenu() watchPlayerOpenMenu()
+1 -1
View File
@@ -5,7 +5,7 @@ init()
level thread onPlayerConnect(); level thread onPlayerConnect();
// bootstrap // bootstrap
level thread scripts\mp\bots_adapter_libcod::init(); level thread scripts\mp\bots_adapter_znation_libcod::init();
level thread scripts\mp\bots_wp_editor::init(); level thread scripts\mp\bots_wp_editor::init();
level thread scripts\mp\bots::init(); level thread scripts\mp\bots::init();
level thread scripts\mp\bots_chat::init(); level thread scripts\mp\bots_chat::init();
-262
View File
@@ -1,262 +0,0 @@
init()
{
level.bot_builtins[ "printconsole" ] = ::do_printconsole;
level.bot_builtins[ "botaction" ] = ::do_botaction;
level.bot_builtins[ "botstop" ] = ::do_botstop;
level.bot_builtins[ "botmovement" ] = ::do_botmovement;
level.bot_builtins[ "isbot" ] = ::do_isbot;
level.bot_builtins[ "botangles" ] = ::do_botangles;
level.bot_builtins[ "botweapon" ] = ::do_botweapon;
thread setup_weaponid_map();
}
register_weaponid( weap )
{
if ( !isdefined( level.bot_weaponids[ weap ] ) )
{
level.bot_weaponids[ weap ] = level.bot_weaponids.size;
}
}
setup_weaponid_map()
{
waittillframeend;
level.bot_weaponids = [];
register_weaponid( "none" );
register_weaponid( "defaultweapon_mp" );
turrets = getentarray( "misc_turret", "classname" );
for ( i = 0; i < turrets.size; i++ )
{
if ( !isdefined( turrets[i].weaponinfo ) )
{
continue;
}
register_weaponid( turrets[i].weaponinfo );
}
// in the order of precache
switch ( game[ "allies" ] )
{
case "american":
register_weaponid( "frag_grenade_american_mp" );
register_weaponid( "smoke_grenade_american_mp" );
register_weaponid( "colt_mp" );
register_weaponid( "m1carbine_mp" );
register_weaponid( "m1garand_mp" );
register_weaponid( "thompson_mp" );
register_weaponid( "bar_mp" );
register_weaponid( "springfield_mp" );
register_weaponid( "greasegun_mp" );
register_weaponid( "shotgun_mp" );
break;
case "british":
register_weaponid( "frag_grenade_british_mp" );
register_weaponid( "smoke_grenade_british_mp" );
register_weaponid( "webley_mp" );
register_weaponid( "enfield_mp" );
register_weaponid( "sten_mp" );
register_weaponid( "bren_mp" );
register_weaponid( "enfield_scope_mp" );
register_weaponid( "m1garand_mp" );
register_weaponid( "thompson_mp" );
register_weaponid( "shotgun_mp" );
break;
case "russian":
register_weaponid( "frag_grenade_russian_mp" );
register_weaponid( "smoke_grenade_russian_mp" );
register_weaponid( "TT30_mp" );
register_weaponid( "mosin_nagant_mp" );
register_weaponid( "SVT40_mp" );
register_weaponid( "PPS42_mp" );
register_weaponid( "ppsh_mp" );
register_weaponid( "mosin_nagant_sniper_mp" );
register_weaponid( "shotgun_mp" );
break;
}
register_weaponid( "frag_grenade_german_mp" );
register_weaponid( "smoke_grenade_german_mp" );
register_weaponid( "luger_mp" );
register_weaponid( "kar98k_mp" );
register_weaponid( "g43_mp" );
register_weaponid( "mp40_mp" );
register_weaponid( "mp44_mp" );
register_weaponid( "kar98k_sniper_mp" );
register_weaponid( "shotgun_mp" );
register_weaponid( "binoculars_mp" );
}
get_weaponid_for_string( weap )
{
ans = level.bot_weaponids[ weap ];
if ( !isdefined( ans ) )
{
return 1;
}
return ans;
}
do_printconsole( s )
{
println( s );
}
do_botaction( action )
{
switch ( action )
{
case "+fire":
self fireweapon( true );
break;
case "-fire":
self fireweapon( false );
break;
case "+ads":
self adsaim( true );
break;
case "-ads":
self adsaim( false );
break;
case "-reload":
self reloadweapon( false );
break;
case "+reload":
self reloadweapon( true );
break;
case "-melee":
self meleeweapon( false );
break;
case "+melee":
self meleeweapon( true );
break;
case "+frag":
self thrownade( true );
break;
case "-frag":
self thrownade( false );
break;
case "-gocrouch":
case "-goprone":
case "-gostand":
self setbotstance( "stand" );
break;
case "+gocrouch":
self setbotstance( "crouch" );
break;
case "+goprone":
self setbotstance( "prone" );
break;
case "+gostand":
self setbotstance( "jump" );
break;
case "-activate":
// self activate( false ); // no equal in libcod
break;
case "+activate":
// self activate( true );
break;
case "+smoke":
// self throwsmoke( true );
break;
case "-smoke":
// self throwsmoke( false );
break;
case "+holdbreath":
// self holdbreath( true );
break;
case "-holdbreath":
// self holdbreath( false );
break;
}
// self botaction( action );
}
do_botstop()
{
self adsaim( false );
self reloadweapon( false );
self meleeweapon( false );
self fireweapon( false );
self thrownade( false );
self setbotstance( "stand" );
self setlean( "none" );
self setwalkdir( "none" );
self switchtoweaponid( get_weaponid_for_string( self getcurrentweapon() ) );
// self botstop();
}
do_botmovement( forward, right )
{
// best i can do for libcod...
self setwalkdir( "none" );
if ( forward > 63 )
{
self setwalkdir( "forward" );
}
if ( forward < -63 )
{
self setwalkdir( "back" );
}
if ( right > 63 )
{
self setwalkdir( "right" );
}
if ( right < -63 )
{
self setwalkdir( "left" );
}
// self botmovement( forward, right );
}
do_isbot()
{
return false; // no equal in libcod
// self isbot();
}
do_botangles( angles )
{
self setplayerangles( angles );
// self botangles( angles[ 0 ], angles[ 1 ], angles[ 2 ] );
}
do_botweapon( weapon )
{
self switchtoweaponid( get_weaponid_for_string( weapon ) );
// self switchtoweapon( weapon );
}
+180
View File
@@ -0,0 +1,180 @@
init()
{
level.bot_builtins[ "printconsole" ] = ::do_printconsole;
level.bot_builtins[ "botaction" ] = ::do_botaction;
level.bot_builtins[ "botstop" ] = ::do_botstop;
level.bot_builtins[ "botmovement" ] = ::do_botmovement;
level.bot_builtins[ "isbot" ] = ::do_isbot;
level.bot_builtins[ "botangles" ] = ::do_botangles;
level.bot_builtins[ "botweapon" ] = ::do_botweapon;
}
do_printconsole( s )
{
println( s );
}
do_botaction( action )
{
switch ( action )
{
case "+fire":
self fireweapon( true );
break;
case "-fire":
self fireweapon( false );
break;
case "+ads":
self adsaim( true ); // setaim
break;
case "-ads":
self adsaim( false );
break;
case "-reload":
self reloadweapon( false );
break;
case "+reload":
self reloadweapon( true );
break;
case "-melee":
self meleeweapon( false );
break;
case "+melee":
self meleeweapon( true );
break;
case "+frag":
self thrownade( true ); // throwgrenade
break;
case "-frag":
self thrownade( false );
break;
case "-gocrouch":
case "-goprone":
case "-gostand":
self setbotstance( "stand" );
break;
case "+gocrouch":
self setbotstance( "crouch" );
break;
case "+goprone":
self setbotstance( "prone" );
break;
case "+gostand":
self setbotstance( "jump" );
break;
case "-activate":
// self activate( false ); // no equal in libcod
break;
case "+activate":
// self activate( true );
break;
case "+smoke":
// self throwsmokegrenade( true );
break;
case "-smoke":
// self throwsmokegrenade( false );
break;
case "+holdbreath":
// self holdbreath( true ); // no equal in libcod
break;
case "-holdbreath":
// self holdbreath( false );
break;
}
// self botaction( action );
}
do_botstop()
{
self adsaim( false );
self reloadweapon( false );
self meleeweapon( false );
self fireweapon( false );
self thrownade( false );
self setbotstance( "stand" );
self setlean( "none" );
self setwalkdir( "none" );
// self holdbreath( false );
// self throwsmokegrenade( false );
// self activate( false );
self do_botweapon( self getcurrentweapon() );
// self botstop();
}
do_botmovement( forward, right )
{
// best i can do for libcod...
self setwalkdir( "none" );
if ( forward > 63 )
{
self setwalkdir( "forward" );
}
if ( forward < -63 )
{
self setwalkdir( "back" );
}
if ( right > 63 )
{
self setwalkdir( "right" );
}
if ( right < -63 )
{
self setwalkdir( "left" );
}
// self botmovement( forward, right ); // setwalkvalues
}
do_isbot()
{
return self isbot();
}
do_botangles( angles )
{
self setplayerangles( angles ); // botangles
}
do_botweapon( weapon )
{
if ( !isdefined( level.bot_weaponids ) )
{
level.bot_weaponids = [];
weaps = getloadedweapons();
for ( i = 0; i < weaps.size; i++ )
{
level.bot_weaponids[ weaps[ i ] ] = i;
}
}
self switchtoweaponid( level.bot_weaponids[ weapon ] );
// self switchtoweapon( weapon );
}