IPB

Welcome Guest ( Log In | Register )

> Compiling RCBot2
Cheeseh
post Apr 29 2010, 11:19 AM
Post #1


Admin
*****

Group: Admin
Posts: 3,066
Joined: 11-September 03
From: uk
Member No.: 1



1. Use Visual Studio 2005/2008 (windows)

2. Use a tool such as Ankhsvn or TortoiseSVN for Visual Studio 2005/2008 (windows)
http://ankhsvn.open.collab.net/
http://tortoisesvn.net/

3. Get the appropriate HL2 SDK, from https://github.com/alliedmodders/hl2sdk/ this has updated SDK code
(TF2 SDK https://github.com/alliedmodders/hl2sdk/tree/tf2 )
(DODS https://github.com/alliedmodders/hl2sdk/tree/dods )
(HL 2 DM https://github.com/alliedmodders/hl2sdk/tree/hl2dm)

4. Get the code from sourceforge SVN by opening an SVN project in VS Studio (using AnkhSVN)
https://sourceforge.net/scm/?type=svn&group_id=248612
download the rcbot2 source: using this command svn checkout svn://svn.code.sf.net/p/rcbot2/code/ rcbot2-code
or this server checkout svn://svn.code.sf.net/p/rcbot2/code/

Make sure the project is in the HL2 SDK folder/utils/rcbot2

(Also if you wish to change any code for others to see, make a sourceforge.net username and ask me to add you to the list of coders.)

5. Mar 2013 - note that the latest releases hook to the engine to work properly. This solves many problems that the past rcbot had, but it may create problems in the future, for example TF2 updates may change the engine. For that reasons, if the bot crashes, keep up to date with the website at:
http://www.sourcemodplugins.org/vtableoffsets
and keep the rcbot_runplayer_cmd updated to the latest PlayerRunCommand offset number for windows (the linux offset is added automatically in the bot if the windows offset is correct) .
At this time of speaking, the offset is 418 for tf2 and 417 for DOD:s
Linux offsets are shifted by 1

6. Get coding! cool.gif

Linux instructions + Makefile are here:

http://sourceforge.net/p/rcbot2/wiki/Compiling%20in%20Linux/

Make file for linux by bir3yk in code form below (NOTE if you copy/paste this into a new file, you must change any spaces to tabs)
CODE

#
# SDK Makefile for x86 Linux
#
#

#############################################################################
# Developer configurable items
#############################################################################

# the name of the mod binary (_i486.so is appended to the end)
#NAME=server
NAME=HPB_bot2

# the location of the vcproj that builds the mod
#MOD_PROJ=../game/server/server_hl2mp-2005.vcproj
MOD_PROJ=../utils/RCBot2/HPB_Bot2.vcproj

# the name of the mod configuration (typically <proj name>_<build type><build target>)
#MOD_CONFIG=ServerHL2MP_ReleaseWin32
MOD_CONFIG=HPB_bot2_ReleaseWin32

# the directory the base binaries (tier0_i486.so, etc) are located
# this should point to your orange box subfolder of where you have srcds installed.
#GAME_DIR=~/srcds/orangebox
GAME_DIR=/home/hlds/steam/orangebox

# the path to your mods directory
# set this so that 'make install' or 'make installrelease' will copy your binary over automatically.
#MOD_DIR=$(GAME_DIR)/SampleMod
MOD_DIR=$(GAME_DIR)/

# compiler options (gcc 3.4.1 will work - 4.2.2 recommended)
#CC=/usr/local/bin/gcc
#CPLUS=/usr/local/bin/g++
#CLINK=/usr/local/bin/gcc
#CPP_LIB="/usr/local/lib/libstdc++.a /usr/local/lib/gcc/i686-pc-linux-gnu/4.2.2/libgcc_eh.a"
#CC=/usr/bin/gcc
#CPLUS=/usr/bin/g++-4.1
#CLINK=/usr/bin/gcc-4.1
CPP_LIB=" /usr/lib/gcc/i486-linux-gnu/4.1.3/libstdc++.a /usr/lib/gcc/i486-linux-gnu/4.1.3/libgcc_eh.a"
C = /usr/bin/gcc-4.1
CPLUS = /usr/bin/g++-4.1
CLINK = /usr/bin/gcc-4.1
#CPP_LIB = "libstdc++.a libgcc_eh.a"


# GCC 4.2.2 optimization flags, if you're using anything below, don't use these!
#OPTFLAGS=-O1 -fomit-frame-pointer -ffast-math -fforce-addr -funroll-loops -fthread-jumps -fcrossjumping -foptimize-sibling-calls -fcse-follow-jumps -fcse-skip-blocks -fgcse -fgcse-lm -fexpensive-optimizations -frerun-cse-after-loop -fcaller-saves -fpeephole2 -fschedule-insns2 -fsched-interblock -fsched-spec -fregmove -fstrict-overflow -fdelete-null-pointer-checks -freorder-blocks -freorder-functions -falign-functions -falign-jumps -falign-loops -falign-labels -ftree-vrp -ftree-pre -finline-functions -funswitch-loops -fgcse-after-reload
OPTFLAGS=-O1 -fomit-frame-pointer -ffast-math -fforce-addr -funroll-loops -fthread-jumps -fcrossjumping -foptimize-sibling-calls -fcse-follow-jumps -fcse-skip-blocks -fgcse -fgcse-lm -fexpensive-optimizations -frerun-cse-after-loop -fcaller-saves -fpeephole2 -fschedule-insns2 -fsched-interblock -fsched-spec -fregmove -fdelete-null-pointer-checks -freorder-blocks -freorder-functions -falign-functions -falign-jumps -falign-loops -falign-labels -ftree-vrp -ftree-pre -finline-functions -funswitch-loops -fgcse-after-reload

#OPTFLAGS=

# put any compiler flags you want passed here
USER_CFLAGS=

# Link Libraries
#LIBFILES= \
#  $(LIB_DIR)/lib/linux/tier1_486.a \
#  $(LIB_DIR)/lib/linux/choreoobjects_486.a \
#  $(LIB_DIR)/lib/linux/particles_486.a \
#  $(LIB_DIR)/lib/linux/dmxloader_486.a \
#  libtier0.so \
#  libvstdlib.so \
#  libsteam_api.so \
#  $(LIB_DIR)/lib/linux/tier3_486.a \
#  $(LIB_DIR)/lib/linux/tier2_486.a \
#  $(LIB_DIR)/lib/linux/tier1_486.a \
#  $(LIB_DIR)/lib/linux/mathlib_486.a \


# link flags for your mod, make sure to include any special libraries here
#NOTE: YES we want to include the lib files 2 times. We've run into problems with the 1-pass linker not bringing in symbols it should.
#LDFLAGS="-lm -ldl $(LIBFILES) $(LIBFILES)"
LIB_DIR = $(SOURCE_DIR)/lib/linux
LDFLAGS = "-lm -ldl  $(LIB_DIR)/mathlib_i486.a libtier0.so libvstdlib.so  $(LIB_DIR)/tier1_i486.a $(LIB_DIR)/tier2_i486.a $(LIB_DIR)/tier3_i486.a "

# XERCES 2.6.0 or above ( [url=http://xml.apache.org/xerces-c/]http://xml.apache.org/xerces-c/[/url] ) is used by the vcproj to makefile converter
# it must be installed before being able to run this makefile
# if you have xerces installed already you should be able to use the two lines below
#XERCES_INC_DIR=/usr/include
#XERCES_LIB_DIR=/usr/lib
XERCES_INC_DIR=/opt/include
XERCES_LIB_DIR=/opt/lib

#############################################################################
# Things below here shouldn't need to be altered
#############################################################################
MAKE=make

# the dir we want to put binaries we build into
BUILD_DIR=.
# the place to put object files
BUILD_OBJ_DIR=$(BUILD_DIR)/obj

# the location of the source code
SOURCE_DIR=..

# the CPU target for the build, must be i486 for now
ARCH=i486
ARCH_CFLAGS=-mtune=i686 -march=pentium -mmmx -msse -pipe

# -fpermissive is so gcc 3.4.x doesn't complain about some template stuff
BASE_CFLAGS=-DVPROF_LEVEL=1 -DSWDS -D_LINUX -DLINUX -DNDEBUG -fpermissive -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp

SHLIBEXT=so

SHLIBCFLAGS=-fPIC
SHLIBLDFLAGS=-shared -Wl,-Map,$@_map.txt -Wl

#flags passed to the compiler
CFLAGS="$(USER_CFLAGS) $(DEFINES) $(ARCH_CFLAGS) $(OPTFLAGS) $(BASE_CFLAGS) -Usprintf=use_Q_snprintf_instead_of_sprintf -Ustrncpy=use_Q_strncpy_instead -Ufopen=dont_use_fopen -UPROTECTED_THINGS_ENABLE"

# define list passed to make for the sub makefile
BASE_DEFINES=CC=$(CC) CPLUS=$(CPLUS) CPP_LIB=$(CPP_LIB) \
    BUILD_DIR=$(BUILD_DIR) BUILD_OBJ_DIR=$(BUILD_OBJ_DIR) \
    SOURCE_DIR=$(SOURCE_DIR) SHLIBLDFLAGS=$(SHLIBLDFLAGS) SHLIBEXT=$(SHLIBEXT) \
    CLINK=$(CLINK) CFLAGS=$(CFLAGS) LDFLAGS=$(LDFLAGS) \
    ARCH=$(ARCH) GAME_DIR=$(GAME_DIR) MOD_CONFIG=$(MOD_CONFIG) NAME=$(NAME) \
    XERCES_INC_DIR=$(XERCES_INC_DIR) XERCES_LIB_DIR=$(XERCES_LIB_DIR)

# Project Makefile
MAKE_MOD=Makefile.server
MAKE_VCPM=Makefile.vcpm
MAKE_PLUGIN=Makefile.plugin

all: check vcpm server

check:
    if [ -z "$(CC)" ]; then echo "Compiler not defined."; exit; fi
    if [ ! -d $(BUILD_DIR) ];then mkdir $(BUILD_DIR);fi
    cd $(BUILD_DIR)

vcpm:
    $(MAKE) -f $(MAKE_VCPM) $(BASE_DEFINES)

server: vcpm
    if [ ! -f "libtier0.so" ]; then ln -s $(GAME_DIR)/bin/libtier0.so .; fi
    if [ ! -f "libvstdlib.so" ]; then ln -s $(GAME_DIR)/bin/libvstdlib.so .; fi
#    if [ ! -f "libsteam_api.so" ]; then ln -s $(GAME_DIR)/bin/libsteam_api.so .; fi
# When running over samba we need to copy the files because symlinking isn't possible.
#    cp -f $(GAME_DIR)/bin/tier0_i486.so .
#    cp -f $(GAME_DIR)/bin/vstdlib_i486.so .
#    cp -f $(GAME_DIR)/bin/steam_api_i486.so .

    ./vcpm $(MOD_PROJ)
    $(MAKE) -f $(MAKE_MOD) $(BASE_DEFINES)

plugin:
    $(MAKE) -f $(MAKE_PLUGIN) $(BASE_DEFINES)

clean:
     $(MAKE) -f $(MAKE_VCPM) $(BASE_DEFINES) clean
     $(MAKE) -f $(MAKE_PLUGIN) $(BASE_DEFINES) clean
     $(MAKE) -f $(MAKE_MOD) $(BASE_DEFINES) clean

install:
    cp -f $(NAME)_$(ARCH).so $(MOD_DIR)/bin/$(NAME)_$(ARCH).so

installrelease:
    cp -f $(NAME)_$(ARCH).so $(MOD_DIR)/bin/$(NAME)_$(ARCH).so
    strip $(MOD_DIR)/bin/$(NAME)_$(ARCH).so
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
 
Reply to this topicStart new topic
Replies
Cheeseh
post Apr 27 2015, 06:37 AM
Post #2


Admin
*****

Group: Admin
Posts: 3,066
Joined: 11-September 03
From: uk
Member No.: 1



QUOTE(JRob @ Apr 25 2015, 08:56 PM) *

Well I guess it doesn't really matter since I can use sourcemod to change names. But it is really strange that they started to work randomly.

The only thing I did differently was that I gave up, and left the server alone. The next day I added my steamid to accessinfo.ini, rebooted the server, and then it started to work.

Maybe I could provide you with a Linux VM so you could make sure rcbot works on Linux? It is really much nicer than running on Windows. It is really easy to add libraries to it and when the server crashes, you can get debug symbols. You also won't have to restart your tf2 client.

Also have you thought about moving the project to github?


It could be something to do with the server hibernating when there are no human players that join. You might be able to disable hibernating, I'm uncertain about dedicated servers as I never use them, but I've heard similar cases. check http://rcbot.bots-united.com/forums/index.php?showtopic=1727

I haven't thought about gihub, but if it's easier for linux developers to have a look at and edit the code I'd consider it eventually.

QUOTE(incorporator @ Apr 26 2015, 12:18 PM) *

could you please help me. I've spent many hours trying to get this to compile and i'm stuck at this:

/usr/bin/gcc-3.4 -o ./vcpm ./obj/vcpm/makefilecreator.o ./obj/vcpm/vprojtomake.o ./obj/vcpm/vcprojconvert.o ./obj/vcpm/public/characterset.o ./obj/vcpm/public/interface.o ./obj/vcpm/public/generichash.o ./obj/vcpm/public/KeyValues.o ./obj/vcpm/public/stringpool.o ./obj/vcpm/public/utlbuffer.o ./obj/vcpm/public/utlsymbol.o ./obj/vcpm/public/strtools.o ./obj/vcpm/tinyxml/tinyxml.o ./obj/vcpm/tinyxml/tinyxmlerror.o ./obj/vcpm/tinyxml/tinyxmlparser.o ./obj/vcpm/tinyxml/tinystr.o -lm -ldl -Wl,-rpath /home/steam/tf2/bin /home/steam/tf2/bin/libtier0_srv.so /home/steam/tf2/bin/vstdlib_i486.so -Wl,-rpath-link /home/steam/tf2/bin
/home/steam/tf2/bin/libtier0_srv.so: error adding symbols: File in wrong format
collect2: ld returned 1 exit status


perhaps try adding -m32 in the gcc command line
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
incorporator
post Apr 28 2015, 07:44 AM
Post #3


Newbie
*

Group: Members
Posts: 5
Joined: 24-April 15
Member No.: 2,382



got everything forced to m32 but i had issues with my makefile not actually making the thing at the end


Makefile.RCBot2Meta_ReleaseWin32
vcpm
Makefile.RCBot2Meta_Release_NonHomeFolderWin32
Makefile.RCBot2Meta_DebugWin32
Makefile.rcbot2
files.vdf

i have no idea what to do with these. please help me
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Cheeseh
post May 2 2015, 09:45 AM
Post #4


Admin
*****

Group: Admin
Posts: 3,066
Joined: 11-September 03
From: uk
Member No.: 1



QUOTE(incorporator @ Apr 28 2015, 08:44 AM) *

got everything forced to m32 but i had issues with my makefile not actually making the thing at the end
Makefile.RCBot2Meta_ReleaseWin32
vcpm
Makefile.RCBot2Meta_Release_NonHomeFolderWin32
Makefile.RCBot2Meta_DebugWin32
Makefile.rcbot2
files.vdf

i have no idea what to do with these. please help me

you don't need to do anything with them specifically. what's the error?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
incorporator
post May 4 2015, 08:19 AM
Post #5


Newbie
*

Group: Members
Posts: 5
Joined: 24-April 15
Member No.: 2,382



QUOTE(Cheeseh @ May 2 2015, 09:45 AM) *

you don't need to do anything with them specifically. what's the error?


something was wrong with my makefile its fixed now.

CODE

../utils/RCBot2_meta/bot_main.cpp: At global scope:
../utils/RCBot2_meta/bot_main.cpp:317:1: error: ‘CRCBotPlugin’ does not name a type
CRCBotPlugin g_RCBOTServerPlugin;


i've tried a few things to get past this error, but i haven't been able to fix it yet.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Cheeseh
post May 4 2015, 01:59 PM
Post #6


Admin
*****

Group: Admin
Posts: 3,066
Joined: 11-September 03
From: uk
Member No.: 1



QUOTE(incorporator @ May 4 2015, 09:19 AM) *

something was wrong with my makefile its fixed now.

CODE

../utils/RCBot2_meta/bot_main.cpp: At global scope:
../utils/RCBot2_meta/bot_main.cpp:317:1: error: ‘CRCBotPlugin’ does not name a type
CRCBotPlugin g_RCBOTServerPlugin;


i've tried a few things to get past this error, but i haven't been able to fix it yet.


you're using the meta build -- delete bot_main.cpp from the project
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
incorporator
post May 8 2015, 09:02 AM
Post #7


Newbie
*

Group: Members
Posts: 5
Joined: 24-April 15
Member No.: 2,382



QUOTE(Cheeseh @ May 4 2015, 01:59 PM) *

you're using the meta build -- delete bot_main.cpp from the project


It's compiling now however i have this issue when loading it.

Failed to load plugin HPB_bot2_i486.so (/home/steam/tf2/tf/HPB_bot2_i486.so: undefined symbol: gameclients

how should i go about solving this?

here is my makefile: http://pastebin.com/YEdff5wF
thank you
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Cheeseh
post May 11 2015, 02:09 AM
Post #8


Admin
*****

Group: Admin
Posts: 3,066
Joined: 11-September 03
From: uk
Member No.: 1



QUOTE(incorporator @ May 8 2015, 10:02 AM) *

It's compiling now however i have this issue when loading it.

Failed to load plugin HPB_bot2_i486.so (/home/steam/tf2/tf/HPB_bot2_i486.so: undefined symbol: gameclients

how should i go about solving this?

here is my makefile: http://pastebin.com/YEdff5wF
thank you


is bot_plugin_meta.cpp being compiled? This is the most important cpp for metamod version -- also remember it can only be loaded through metamod
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Posts in this topic
Cheeseh   Compiling RCBot2   Apr 29 2010, 11:19 AM
Rainbow Unicorn   Hey, one note: I posted in another forum about the...   May 1 2010, 03:39 AM
TesterYYY   Hi, it's possible to compile RCBot2 under VS20...   Feb 3 2013, 05:13 PM
Cheeseh   add this before IServerGameDLL in eiface.h this w...   Feb 4 2013, 03:04 AM
TesterYYY   Thanks but now Ive got next error: Error 1 error C...   Feb 4 2013, 03:26 AM
Root   Hey Cheeseh can you update makefile? Its really di...   Sep 21 2013, 03:35 PM
Ted   I've added CMake build support for RCBot. The...   Jan 27 2014, 11:47 PM
Root   Hello Cheeseh! Thanks for all your work of RCb...   Dec 22 2014, 03:10 PM
Root   I found problem... all builds that below r429 are ...   Dec 22 2014, 04:24 PM
Root   Sorry for yet another post, I want to say that I f...   Dec 23 2014, 07:01 PM
Root   I really have no idea how magically you compile th...   Dec 26 2014, 05:00 PM
Cheeseh   0. yes this thread is quite old because valve has ...   Jan 19 2015, 11:28 PM
Cheeseh   I've officially given up with compiling on Lin...   Jan 29 2015, 10:41 AM
n0nnie   I've officially given up with compiling on Li...   Feb 11 2015, 07:53 PM
Cheeseh   If you need a testserver, I can give you one. I d...   Feb 11 2015, 11:33 PM
n0nnie   if your test server uses Linux and you can give S...   Feb 16 2015, 12:06 PM
Cheeseh   Do you need root access for that? I got Ubuntu 12...   Feb 20 2015, 09:55 AM
JRob   I gave up on RCbots a while ago when it was broken...   Apr 19 2015, 08:26 PM
Cheeseh   I gave up on RCbots a while ago when it was broke...   Apr 20 2015, 12:47 AM
JRob   The VSP is error because of VS2013. You have to r...   Apr 20 2015, 01:01 AM
JRob   So I took a closer look at the code. It looks lik...   Apr 20 2015, 01:44 AM
Cheeseh   So I took a closer look at the code. It looks li...   Apr 20 2015, 01:45 PM
JRob   Perhaps you're using the wrong VC proj file -...   Apr 20 2015, 07:36 PM
Cheeseh   bot_hooks.cpp and header are only important for vs...   Apr 21 2015, 01:26 AM
JRob   I was looking at the code again and I noticed th...   Apr 21 2015, 09:28 PM
Cheeseh   I was looking at the code again and I noticed tha...   Apr 22 2015, 01:56 AM
JRob   1. the playerruncmd hook has to be [b]declared fi...   Apr 22 2015, 02:41 AM
Cheeseh   1. I'm not talking about the declaration. I...   Apr 22 2015, 08:04 AM
JRob   In that case it's a bug so just move the load...   Apr 22 2015, 06:59 PM
Cheeseh   Yes that's what I did. It kept crashing becau...   Apr 23 2015, 01:52 PM
JRob   it's probably not finding the rcbot2 folder w...   Apr 23 2015, 07:18 PM
Cheeseh   It is finding the folder. If it couldn't find...   Apr 24 2015, 02:19 AM
JRob   I'd do a debug with rcbotd debug bot <bot...   Apr 24 2015, 07:30 PM
Cheeseh   hmm those commands won't work on dedicated con...   Apr 25 2015, 02:49 AM
JRob   hmm those commands won't work on dedicated co...   Apr 25 2015, 07:56 PM
incorporator   Well I guess it doesn't really matter since I...   Apr 26 2015, 11:18 AM
Cheeseh   Well I guess it doesn't really matter since I...   Apr 27 2015, 06:37 AM
JRob   It could be something to do with the server hiber...   Apr 27 2015, 07:29 PM
incorporator   got everything forced to m32 but i had issues with...   Apr 28 2015, 07:44 AM
Cheeseh   got everything forced to m32 but i had issues wit...   May 2 2015, 09:45 AM
incorporator   you don't need to do anything with them speci...   May 4 2015, 08:19 AM
Cheeseh   something was wrong with my makefile its fixed no...   May 4 2015, 01:59 PM
incorporator   you're using the meta build -- delete bot_mai...   May 8 2015, 09:02 AM
Cheeseh   It's compiling now however i have this issue ...   May 11 2015, 02:09 AM
incorporator   is bot_plugin_meta.cpp being compiled? This is th...   May 14 2015, 08:07 AM
Cheeseh   CommandClient is for players connecting to the ser...   Jun 22 2015, 04:18 AM
modnerd   having the same issue mod edit - signature remo...   Jun 22 2015, 03:26 AM
Seaman   So... The instructions in the main post are outdat...   Apr 11 2016, 10:16 AM


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 3rd June 2024 - 03:07 AM