Giter Club home page Giter Club logo

rcbot2's People

Contributors

apgrobocop avatar caxanga334 avatar nosoop avatar pongo1231 avatar rcbotcheeseh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rcbot2's Issues

Look into known crashes with certain SourceMod plugins

@APGRoboCop mentioned that a number of plugins conflict with RCBot2, and updated their packaged config with the below plugins unloaded:

  • bot_ai
  • bot_nologic
  • bot_playerdestruction_ai
  • bot_rocketjump
  • bot_rocketjump_alt
  • bot_trucefix
  • botmanager
  • ClassRestrictionsForBots (causes bots to repeatedly switch to restricted classes)
  • GiveBotsCosmetics (reportedly fixed at some point)
  • GiveBotsWeapons (fixed with 2bf8354)
  • tf2items_manager
  • smac_cvars (see this comment; likely fixed either in RCBot2 v1.0 or with 5052778 and c22a212)

(These should be checked off once resolved.)

I'd like to see what parts of the codebase cause issues with those plugins (especially the ones that are reported as crashing).

My suspicion is that they only check and can't distinguish fake clients from the subset that are TFBot players, resulting in the SourceMod plugin overwriting inputs in OnPlayerRunCmd.

CBasePlayer::GetBotType() can be used to tell TFBots apart from other fake clients, but the burden would be on the SourceMod plugin authors to update their plugins accordingly (which then introduces a non-builtin dependency).
Since that's a tall order, it'd probably be better to prevent SDKHooks from modifying our usercommands.

Failure to compile on newer toolchains

While it does compile correctly on Ubuntu 16.04 (LTS) and Debian 8, I'm stumped at what this error is on Debian 10:

(ambuild-sm-1.10) user@build:~/alliedmodders/rcbot2/build$ ambuild
Spawned worker (pid: 759)
Spawned worker (pid: 760)
[759] clang++ -Wall -Wno-non-virtual-dtor -Wno-overloaded-virtual -Werror -fPIC -fno-rtti -msse -fno-strict-aliasing -fvisibility=hidden -fvisibility-inlines-hidden -std=c++11 -w -D__linux -Wno-delete-non-virtual-dtor -Wno-unused-private-field -Wno-deprecated-register -m32 -Dstrcmpi=strcasecmp -g3 -Wno-expansion-to-defined -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -DGNUC -DPOSIX -D_LINUX -DSE_EPISODEONE=1 -DSE_ORANGEBOX=3 -DSE_CSS=6 -DSE_HL2DM=7 -DSE_DODS=8 -DSE_SDK2013=9 -DSE_TF2=11 -DSE_LEFT4DEAD=12 -DSE_NUCLEARDAWN=13 -DSE_LEFT4DEAD2=15 -DSE_DARKMESSIAH=2 -DSE_ALIENSWARM=16 -DSE_BLOODYGOODTIME=4 -DSE_EYE=5 -DSE_CSGO=21 -DSE_DOTA=22 -DSE_PORTAL2=17 -DSE_BLADE=18 -DSE_INSURGENCY=19 -DSE_DOI=20 -DSE_CONTAGION=14 -DSE_BMS=10 -DSOURCE_ENGINE=11 -DCOMPILER_GCC -DSM_EXT -I /home/user/alliedmodders/rcbot2/build/includes -I /home/user/alliedmodders/rcbot2 -I /home/user/alliedmodders/mmsource-1.10/core -I /home/user/alliedmodders/mmsource-1.10/core/sourcehook -I /home/user/alliedmodders/hl2sdk-tf2/public -I /home/user/alliedmodders/hl2sdk-tf2/public/engine -I /home/user/alliedmodders/hl2sdk-tf2/public/mathlib -I /home/user/alliedmodders/hl2sdk-tf2/public/vstdlib -I /home/user/alliedmodders/hl2sdk-tf2/public/tier0 -I /home/user/alliedmodders/hl2sdk-tf2/public/tier1 -I /home/user/alliedmodders/hl2sdk-tf2/game_shared -I /home/user/alliedmodders/hl2sdk-tf2/game/shared -I /home/user/alliedmodders/hl2sdk-tf2/game/server -I /home/user/alliedmodders/hl2sdk-tf2/public/game/server -I /home/user/alliedmodders/hl2sdk-tf2/public/game/server -I /home/user/alliedmodders/sourcemod-1.10/sourcepawn/include -I /home/user/alliedmodders/sourcemod-1.10/public/amtl -I /home/user/alliedmodders/sourcemod-1.10/public/amtl/amtl -I /home/user/alliedmodders/sourcemod-1.10/public -I /home/user/alliedmodders/rcbot2/sm_ext -I /home/user/alliedmodders/rcbot2/utils/RCBot2_meta -I /home/user/alliedmodders/rcbot2/versioning -H -c /home/user/alliedmodders/rcbot2/utils/RCBot2_meta/bot_sigscan.cpp -o utils_RCBot2_meta_bot_sigscan.o
In file included from /home/user/alliedmodders/rcbot2/utils/RCBot2_meta/bot_sigscan.cpp:37:
In file included from /home/user/alliedmodders/rcbot2/utils/RCBot2_meta/bot.h:68:
In file included from /home/user/alliedmodders/rcbot2/utils/RCBot2_meta/bot_utility.h:37:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/vector:60:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:64:
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_pair.h:428:13: error: no member named 'swap' in namespace 'std'
        using std::swap;
              ~~~~~^
1 error generated.
Build failed: rcbot.2.tf2/utils_RCBot2_meta_bot_sigscan.o

Attempting to #include <utility> produces a similar result:

(ambuild-sm-1.10) user@forttest:~/alliedmodders/rcbot2/build$ ambuild
Spawned worker (pid: 1161)
Spawned worker (pid: 1162)
[1162] clang++ -Wall -Wno-non-virtual-dtor -Wno-overloaded-virtual -Werror -fPIC -fno-rtti -msse -fno-strict-aliasing -fvisibility=hidden -fvisibility-inlines-hidden -std=c++11 -w -D__linux -Wno-delete-non-virtual-dtor -Wno-unused-private-field -Wno-deprecated-register -m32 -Dstrcmpi=strcasecmp -g3 -Wno-expansion-to-defined -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -DGNUC -DPOSIX -D_LINUX -DSE_EPISODEONE=1 -DSE_ORANGEBOX=3 -DSE_CSS=6 -DSE_HL2DM=7 -DSE_DODS=8 -DSE_SDK2013=9 -DSE_TF2=11 -DSE_LEFT4DEAD=12 -DSE_NUCLEARDAWN=13 -DSE_LEFT4DEAD2=15 -DSE_DARKMESSIAH=2 -DSE_ALIENSWARM=16 -DSE_BLOODYGOODTIME=4 -DSE_EYE=5 -DSE_CSGO=21 -DSE_DOTA=22 -DSE_PORTAL2=17 -DSE_BLADE=18 -DSE_INSURGENCY=19 -DSE_DOI=20 -DSE_CONTAGION=14 -DSE_BMS=10 -DSOURCE_ENGINE=11 -DCOMPILER_GCC -DSM_EXT -I /home/user/alliedmodders/rcbot2/build/includes -I /home/user/alliedmodders/rcbot2 -I /home/user/alliedmodders/mmsource-1.10/core -I /home/user/alliedmodders/mmsource-1.10/core/sourcehook -I /home/user/alliedmodders/hl2sdk-tf2/public -I /home/user/alliedmodders/hl2sdk-tf2/public/engine -I /home/user/alliedmodders/hl2sdk-tf2/public/mathlib -I /home/user/alliedmodders/hl2sdk-tf2/public/vstdlib -I /home/user/alliedmodders/hl2sdk-tf2/public/tier0 -I /home/user/alliedmodders/hl2sdk-tf2/public/tier1 -I /home/user/alliedmodders/hl2sdk-tf2/game_shared -I /home/user/alliedmodders/hl2sdk-tf2/game/shared -I /home/user/alliedmodders/hl2sdk-tf2/game/server -I /home/user/alliedmodders/hl2sdk-tf2/public/game/server -I /home/user/alliedmodders/hl2sdk-tf2/public/game/server -I /home/user/alliedmodders/sourcemod-1.10/sourcepawn/include -I /home/user/alliedmodders/sourcemod-1.10/public/amtl -I /home/user/alliedmodders/sourcemod-1.10/public/amtl/amtl -I /home/user/alliedmodders/sourcemod-1.10/public -I /home/user/alliedmodders/rcbot2/sm_ext -I /home/user/alliedmodders/rcbot2/utils/RCBot2_meta -I /home/user/alliedmodders/rcbot2/versioning -H -c /home/user/alliedmodders/rcbot2/sm_ext/bot_sm_natives.cpp -o _home_user_alliedmodders_rcbot2_sm_ext_bot_sm_natives.o
[1161] clang++ -Wall -Wno-non-virtual-dtor -Wno-overloaded-virtual -Werror -fPIC -fno-rtti -msse -fno-strict-aliasing -fvisibility=hidden -fvisibility-inlines-hidden -std=c++11 -w -D__linux -Wno-delete-non-virtual-dtor -Wno-unused-private-field -Wno-deprecated-register -m32 -Dstrcmpi=strcasecmp -g3 -Wno-expansion-to-defined -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -DGNUC -DPOSIX -D_LINUX -DSE_EPISODEONE=1 -DSE_ORANGEBOX=3 -DSE_CSS=6 -DSE_HL2DM=7 -DSE_DODS=8 -DSE_SDK2013=9 -DSE_TF2=11 -DSE_LEFT4DEAD=12 -DSE_NUCLEARDAWN=13 -DSE_LEFT4DEAD2=15 -DSE_DARKMESSIAH=2 -DSE_ALIENSWARM=16 -DSE_BLOODYGOODTIME=4 -DSE_EYE=5 -DSE_CSGO=21 -DSE_DOTA=22 -DSE_PORTAL2=17 -DSE_BLADE=18 -DSE_INSURGENCY=19 -DSE_DOI=20 -DSE_CONTAGION=14 -DSE_BMS=10 -DSOURCE_ENGINE=11 -DCOMPILER_GCC -DSM_EXT -I /home/user/alliedmodders/rcbot2/build/includes -I /home/user/alliedmodders/rcbot2 -I /home/user/alliedmodders/mmsource-1.10/core -I /home/user/alliedmodders/mmsource-1.10/core/sourcehook -I /home/user/alliedmodders/hl2sdk-tf2/public -I /home/user/alliedmodders/hl2sdk-tf2/public/engine -I /home/user/alliedmodders/hl2sdk-tf2/public/mathlib -I /home/user/alliedmodders/hl2sdk-tf2/public/vstdlib -I /home/user/alliedmodders/hl2sdk-tf2/public/tier0 -I /home/user/alliedmodders/hl2sdk-tf2/public/tier1 -I /home/user/alliedmodders/hl2sdk-tf2/game_shared -I /home/user/alliedmodders/hl2sdk-tf2/game/shared -I /home/user/alliedmodders/hl2sdk-tf2/game/server -I /home/user/alliedmodders/hl2sdk-tf2/public/game/server -I /home/user/alliedmodders/hl2sdk-tf2/public/game/server -I /home/user/alliedmodders/sourcemod-1.10/sourcepawn/include -I /home/user/alliedmodders/sourcemod-1.10/public/amtl -I /home/user/alliedmodders/sourcemod-1.10/public/amtl/amtl -I /home/user/alliedmodders/sourcemod-1.10/public -I /home/user/alliedmodders/rcbot2/sm_ext -I /home/user/alliedmodders/rcbot2/utils/RCBot2_meta -I /home/user/alliedmodders/rcbot2/versioning -H -c /home/user/alliedmodders/rcbot2/utils/RCBot2_meta/bot_plugin_meta.cpp -o utils_RCBot2_meta_bot_plugin_meta.o
In file included from /home/user/alliedmodders/rcbot2/utils/RCBot2_meta/bot_plugin_meta.cpp:40:
In file included from /home/user/alliedmodders/rcbot2/utils/RCBot2_meta/bot.h:68:
In file included from /home/user/alliedmodders/rcbot2/utils/RCBot2_meta/bot_utility.h:37:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/utility:70:
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_pair.h:428:13: error: no member named 'swap' in namespace 'std'
        using std::swap;
              ~~~~~^
1 error generated.
Build failed: rcbot.2.tf2/utils_RCBot2_meta_bot_plugin_meta.o

Both are configured to compile against SM 1.10 and ambuild commit b158427.

Prevent bot joinclass / weapon use command spamming

This issue, combined with a low sv_quota_stringcmdspersecond value, kicks RCBots when they aren't expecting to be kicked, causing a crash.

Bots keep trying to select a class on every think tick when they're dead.

#0  CBotFortress::selectClass (this=0xe7cd620) at rcbot2/utils/RCBot2_meta/bot_fortress.cpp:1531
#1  0xaa40355f in CBotFortress::startGame (this=0xe7cd620) at rcbot2/utils/RCBot2_meta/bot_fortress.cpp:337
#2  0xaa3c35f1 in CBot::think (this=0xe7cd620) at rcbot2/utils/RCBot2_meta/bot.cpp:826
#3  0xaa3c4329 in CBots::botThink () at rcbot2/utils/RCBot2_meta/bot.cpp:3417
#4  0xaa48dd3b in RCBotPluginMeta::Hook_GameFrame (this=0xaac3c240 <g_RCBotPluginMeta>, simulating=true) at rcbot2/utils/RCBot2_meta/bot_plugin_meta.cpp:994

Pretty sure CBotTF2::handleWeapons is also problematic as Snipers always switch between their primary and secondary weapons; still need to figure out why though.

Call BotPutInServer instead of invoking the bot CCommand

This is what the bot command calls internally, and returns an CSDKPlayer*. Avoids hacking around with invoking server commands.

Implementations are mod-specific; TF2 uses the following prototype:

CTFPlayer *
BotPutInServer(bool bTargetDummy,bool bFrozen,int desiredTeam,int desiredClass,char *name);

Other games might have similar functions, which may be worth looking into.

Bots not moving on Windows build

The AMBuild build process outputs a DLL without any (known) issues, and the plugin loads in and rcbotd is recognized, but the bots don't actually move.

Crash in `fgets` during config read

RCBot2 segfaults seemingly at random while reading config.ini on startup.

(I have a commit to fix this ready to go, just putting the issue up for records.)

Flawed failsafe on running non-dedicated commands

if ( !pClient && !canbeUsedDedicated() )
{
CBotGlobals::botMessage(NULL,0,"Sorry, this command cannot be used on a dedicated server");
return COMMAND_ERROR;
}

tl;dr missed a pCommand->, and that is why my changes will use explicit this

canbeUsedDedicated() erroneously calls the function for this (CBotCommandContainer) instead of pCommand (CBotCommand). That check always passes for the container, so the subcommand always gets fired, which leads to bad things.

It should be changed to the following:

if (!pClient && !pCommand->canbeUsedDedicated()) {
    // ...
}

Marking this issue down for reference to other forks, as a refactoring commit ends up fixing this anyways.

Remove rcbot_const_point_master_offset

Marking this issue down for reference to other forks. It's kind of a dumb hack, but it works.

(TODO Test to ensure this actually works on DOD:S.) DOD doesn't use this

RCBot2's CTeamControlPointMaster has different offsets on Windows and Linux. The offsets are based on it being a subclass of CBaseEntity, and so the offset is sizeof(CBaseEntity).

There is ability to access the size of entities via an IEntityFactory, and conveniently we can access and perform lookups against an IEntityFactoryDictionary interface.

The following code does just that:

extern IServerTools *servertools;

// HACK: we use one of the known CBaseEntity-sized entities to compute the offset to the first subclass member for CTeamControlPointMaster / CTeamControlPointRound
size_t baseEntityOffset = servertools->GetEntityFactoryDictionary()->FindFactory("simple_physics_brush")->GetEntitySize();

uintptr_t pMasterMembers = reinterpret_cast<uintptr_t>(servergameents->EdictToBaseEntity(pMaster)) + baseEntityOffset;

m_PointMaster = (CTeamControlPointMaster*) pMasterMembers;

Move extern declarations to headers

A bunch of functions have inline extern declarations. Should move them all over to the headers for sanity.

I can also restrict convars to the specific engine / game with preprocessor shenanigans.

Use git-based versioning scheme

The current versioning system is still based off of SVN.
Plan is to migrate it off to an automatic versioning scheme based on SourceMod's build tooling.

Add functionality to block DoD:S's bot think process

Day of Defeat: Source is built with a basic bot system from the Source SDK; all fake clients (including the ones spawned by the bot manager) have controls processed by it.

Allowing it to run alongside RCBot's think function makes the bots move at twice the speed, which is why RCBot has a dedicated hook on usercommand processing. Keeping it that way makes it easier for end-users to maintain (as they can pull vtable offsets themselves), as well as introduce this functionality for any other games that may need it.

On the other hand, detouring or stubbing the function out would mean that we don't have to worry about the hook and the CPU time spent doing SDK AI, plus we can gut the game's unique handling of CUserCmd inputs.

Decisions, decisions.

Use global class instances instead of static classes and members

Probably the largest refactor here.

Avoids having static const values declared outside of the class definition, and lets us use RAII and destructors instead of custom ::freeMemory() calls.

Or at least I think that's the case. It's difficult to say until it's actually tried.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.