.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   The RealBot 'Source' (http://forums.bots-united.com/forumdisplay.php?f=52)
-   -   Buytable SCREWED. (http://forums.bots-united.com/showthread.php?t=2174)

V or 'Tex 02-07-2004 04:09

Buytable SCREWED.
 
All my CTs buy Shields first, then MAYBE buy something else.

Ts are fine, they usually get AKs and whatnot but that's normal.

stefanhendriks 02-07-2004 08:21

Re: Buytable SCREWED.
 
hehe, yep... i changed some shield compatible code. I wanted to let them buy shields... you should change the source for that.

stefanhendriks 02-07-2004 17:14

Re: Buytable SCREWED.
 
The bots do not screw up buying at all, i have a nice buytable which lets CT's buy shields, but not too much. Quite fun. I will lower it a bit and provide a buytable.ini file, perhaps just package WIP #11 now... hmm

V or 'Tex 03-07-2004 05:42

Re: Buytable SCREWED.
 
Why do my bots always buy shields, then?

If it isn't broken, tell me what stat in the ini files determines how often they buy shields.

stefanhendriks 03-07-2004 10:15

Re: Buytable SCREWED.
 
Here is my buytable.ini (note, it is shorter now, because the CS 1.6 bug is fixed)

Quote:

#Updated by Stefan Hendriks for Counter-Strike 1.6
################################################## #
#
# Information Regarding weapon support in CS 1.5 and CS 1.6
# A few fields have been added, these should NEVER be changed
# UNLESS you know what you are doing. If you only want to
# change the bots behaviour with buying stuff, then read
# below about the relevant items you can change.
#
################################################## #
#
# This file has been updated at 02/07/04
#
# REALBOT: COUNTER-STRIKE PRIORITY BUY TABLE
#
# [WEAPON_TYPE]
# Price=<see below>
# Priority=% importance.
#
# Price is important! This is the price they take into account before even checking
# the priority queue. Do NEVER set the price lower then the actual price in Counter-Strike
#
# Priority is also important, but do also mind that the ORDER of weapons is important aswell!
#
# The buy code automaticly understands if its a secondary/primary gun. If the code cannot
# identify a weapon (due an update of Counter-Strike), the weapon type is automaticly
# UNKOWN and not taken into account in the buy code, to prevent odd behaviour.
#
# TIPS:
# Always take ammo money into account with prices, as i did. So a gun is 3000, do + 200 to
# make sure the bot will have money left for ammo.
#
# Do not edit the C4 and the KNIFE!
# !! A maximum of 32 weapon types is allowed in this file !!
#
# Stefan

#======
#CS 1.6
#======
; Counter-Terrorist weapon; not as good as Galil
[FAMAS]
Price=2250
Priority=15
; Terrorist Weapon; pretty accurate
[GALIL]
Price=2000
Priority=30
; Counter-Terrorist shield
[SHIELD]
Price=2000
Priority=25
#============================
#End of CS 1.6 specific stuff
#============================
; GRENADE
[HEGRENADE]
Price=400
Priority=25
; Grenade type
[FLASHBANG]
Price=300
Priority=25

; AK - Super popular
[AK47]
Price=2750
Priority=45
; Colt - Super popular
[M4A1]
Price=3350
Priority=45
; MP5 - pretty good second overal weapon
[MP5]
Price=1650
Priority=33
; Steyr Aug - nice weapon
[AUG]
Price=3750
Priority=40
; The AWP - 3v1l!
[AWP]
Price=5000
Priority=20
; Sig sg552
[SG552]
Price=3750
Priority=35
; TMP - bad
[TMP]
Price=1500
Priority=24
; Mac - bad
[MAC10]
Price=1650
Priority=24
; Primary (sub machine) gun
[P90]
Price=2400
Priority=22
; shotgun.. RealBot Rampage Weapon
[M3]
Price=1950
Priority=22
[UMP45]
Price=1950
Priority=22
; Sniper rifle
[SCOUT]
Price=3000
Priority=22
; shotgun.. RealBot Rampage Weapon
; Primary weapon
[XM1014]
Price=3250
Priority=20
; Paragun
[M249]
Price=6000
Priority=25
; Sniper rifle
[SG550]
Price=4450
Priority=10
; Sniper rifle
[G3SG1]
Price=5250
Priority=10
; Elite (Double guns)
[ELITE]
Price=1100
Priority=25
; Desert Eagle
[DEAGLE]
Price=750
Priority=35
[FIVESEVEN]
Price=800
Priority=35
; SECONDARY
[P228]
Price=700
Priority=25
; Grenade type
[SMOKEGRENADE]
Price=500
Priority=0
; Knife (do not edit)
[KNIFE]
Price=32000
Priority=0
; C4 BOMB (do not edit)
[C4]
Price=32000
Priority=0
# These weapons are already owned by a bot.. depending on the team so we give them 0 priority
# to prevent any 'buying a gun we already own' issues...
# a more neat way would be to have PriorityTerror and PriorityCounter, but hence... i lack time
[USP]
Price=500
Priority=0

[GLOCK18]
Price=400
Priority=0


V or 'Tex 03-07-2004 21:29

Re: Buytable SCREWED.
 
I even DELETED the entry for shield.


The bots still buy shields EVERY ROUND. EVERY SINGLE ROUND!

stefanhendriks 03-07-2004 22:10

Re: Buytable SCREWED.
 
be more specific, how many bots buy the shields? All of them?

You should not delete the entry for shield btw. Anyway, its odd because they do not buy a dang thing here if i set the priority to 0.

V or 'Tex 04-07-2004 03:58

Re: Buytable SCREWED.
 
All of them.


And I tried priority 0.


Sometimes... two or three will not buy the shield. (Out of 8 bots on the team)

But usually 7/8 or all of them buy shields.

Moreover, everybody on the T team thinks that once a shield drops it'd be the sweetest thing in the world to pick it up and use it until they die.

evy 04-07-2004 09:48

Re: Buytable SCREWED.
 
In the same vein, I suspect that some crashes with build 3051 are linked to the weapon system...

On my Linux, I have the following crash info:
Code:

0x438bdd09 in CBasePlayer::HasPlayerItem () from .../hlds_l/cstrike/dlls/cs_i386.so
So, it seems that RB could corrupt the data structure of the CS mod (like a NULL pointer instead of a valid one) so that a call to HasPlayerItem (part of the HL engine) fails. ???:(

Not really useful info..., I know :'(

-eric

V or 'Tex 04-07-2004 23:12

Re: Buytable SCREWED.
 
Well I haven't experienced any crashes... but it is really annoying because I can't use RB anymore... the CTs suck at using the shields but they buy them every single round so there's no point in playing as CT or T. It's either too easy or your allies do absolutely nothing.

V or 'Tex 05-07-2004 21:12

Re: Buytable SCREWED.
 
Can we please get a fix? The CTs buy shields every round if they have the money.

They even buy WEAPONS, but then they buy SHIELDS right after they buy weapons. What's the point of buying an AWP if you are gonna drop it for a shield in a millisecond!?

Josh_Borke 06-07-2004 06:07

Re: Buytable SCREWED.
 
edit the source code

you can disable them from buying completely in bot_buycode.cpp by return false for CS_SHIELD or whatever the definition is.

evy 06-07-2004 08:43

Re: Buytable SCREWED.
 
Frankly, but looking at the code, there is no specific code for the shield.

So, my guess is that if you do not want a bot to buy a shield (considered as a primary weapon):
- specify a favorite weapon in the bot personality file, they should never drop their favorite weapon
- specify a very low priority (actually it is a probability as %) for the shield in buytable.ini
- move the shield down in the list in buytable.ini, first weapons have more probability to be selected than later ones (even with a lower priority)

NB: there may well be code missing to understand that a bot is carrying a shield. This could well be another problem.

Hope it helps

-eric

V or 'Tex 08-07-2004 01:22

Re: Buytable SCREWED.
 
Evy, Stefan, I have TRIED all that. Yes, favorite weapons ARE SPECIFIED.

I have 0 priority for shield

I TRIED DELETING THE SHIELD ENTRY


The bots buy IN THIS ORDER:

Chance of getting weapon
If they have leftover money, THEY GET A SHIELD


EVERY TIME. Heck, maybe it's a probability that they get the shield, but I'll be damned that EVERY GAME I play, all but one or two CTs fail to buy a shield.


They aren't MISUNDERSTANDING when they have a shield, they buy the shield when they dont have one. Almost every time!

stefanhendriks 08-07-2004 11:10

Re: Buytable SCREWED.
 
source updated, i found a bug somewhere where the shield was not 'found' (or detected). It was used in the buy code, so it could influence this behaviour. Try the latest dll and see if it works for you now.. :)

V or 'Tex 09-07-2004 00:08

Re: Buytable SCREWED.
 
Thank you! Thank you!

I will try the new DLL immediately.


However, I think your new shield code improperly ranks the shield too highly, as they are still bought at 0 priority quite often.

The bots tend to buy a prim. weapon, then they buy shield. So it isnt that they arent detecting shield, but they think prim. weapon is different from shield and they buy it, I think. Like it isnt recognizing that both are technically primary weapons, and that you cant buy a FAMAS + shield.

stefanhendriks 09-07-2004 21:37

Re: Buytable SCREWED.
 
the code ranks no shields at all. the buytable ranks.. ;)

V or 'Tex 09-07-2004 23:18

Re: Buytable SCREWED.
 
They are still buying shields, almost every round all but 2 buy shields.

It is now like 50/50... much better but they still buy shields all too often.

stefanhendriks 11-07-2004 12:59

Re: Buytable SCREWED.
 
hmm, this is really odd! Well , i think its back to the drawing board then. Ow, i wonder if there are any other meta plugins running at ur server? Ie, when i run statsme, it somehow messes up sometimes. So *perhaps* other mods/plugins influence this behaviour... (just a random shot though).

V or 'Tex 11-07-2004 20:32

Re: Buytable SCREWED.
 
I only have StatsMe and RealBot, with MetaMod 1.17.1.


It's a local server.


And uh... here's what they do every round, I think the problem is in detecting what type of 'weapon' the shield is.

Round start
[Bot will about 80% of the time buy a new primary weapon, even if it is a downgrade... like AK47 to MP5 or SG552 to pump-shotty]
[If bot is CT, the bot will usually buy a shield at this point]


I don't think it's statsme because AFAIK it wouldn't have any reason to interface with metamod in the same way RealBot does...

Josh_Borke 16-07-2004 15:43

Re: Buytable SCREWED.
 
would something like this work?

bot_buycode.cpp:270

Code:

if (UTIL_GiveWeaponType (wapen_tabel[i].iId) == SHIELD)
 if (FUNC_BotHasWeapon (pBot, pBot->ipFavoPriWeapon) == true)
  continue;

also, a possible fix for buying a weapon with lower priority than the current weapon:
Code:

if (pBot->iPrimaryWeapon > -1) {  // bot has a weapon
  if (wapen_tabel[pBot->iPrimaryWeapon].priority > wapen_tabel[i].priority) 
 // the weapon is at a higher priority than the one we can buy, don't do anything
          continue;
 // DOES NOT WORK!! need priority of current weapon

i'm not sure how to get the priority for the current weapon though

stefanhendriks 16-07-2004 21:48

Re: Buytable SCREWED.
 
i think your code should work...

Josh_Borke 16-07-2004 23:48

Re: Buytable SCREWED.
 
the first code set should work, the second code set won't because iId != wapen_tabel index. a simple function to create a static array should be easy, ie
Code:

int UTIL_GetWapenIndex (int iId)
 {
        return wapen_ids(iId);
 }
 
 void UTIL_MakeWapenIndex (void)
 {
          int i = 0;
          for (i = 0; i < 32; i++)
                  wapen_ids(wapen_tabel(i).iId) = i;
          return;
 }

or something like that.

HTH. testing the shield code now...

stefanhendriks 16-07-2004 23:57

Re: Buytable SCREWED.
 
There already is code to revert the real ID and the wapen_tabel id ... in the buycode.cpp function afaik.

Josh_Borke 17-07-2004 00:31

Re: Buytable SCREWED.
 
yea, there is, thanks.
bot_buycode.cpp: 210
Code:

  if (pBot->iPrimaryWeapon > -1) {
                                  int index = ListIdWeapon (pBot->iPrimaryWeapon);
                                  if (wapen_tabel[index].priority > wapen_tabel[i].priority)
                                          continue;
                                  }

similarly:, bot_buycode.cpp line 282
Code:

if (pBot->iSecondaryWeapon > -1) {
                                  int index = ListIdWeapon(pBot->iSecondaryWeapon);
                                  if (wapen_tabel[index].priority > wapen_tabel[i].priority)
                                          continue;
                                  }

also, not to be a pest ;)
bot_buycode.cpp line 254
Code:

// Buy favorite weapon
 buy_weapon = pBot->ipFavoSecWeapon;
 
 // should be
 
 // Buy favorite weapon
 buy_weapon = pBot->ipFavoSecWeapon;
 bBuyOther = false;


evy 17-07-2004 22:39

Re: Buytable SCREWED.
 
In the code util.cpp, there are question marks around the weapon name used internally by CS 1.6 for shields, can someone check in reallog.txt if there are lines like:

UTIL_GiveWeaponId: Unknown weapon name xyz

where xyz should be weapon_shield (then the question marks should be removed), else the code should be modified 9_9

You need to use build 3056 which has just been committed on 18th of July...

Thanks

-evy

PS: I have no access to a CS 1.6...

Josh_Borke 18-07-2004 00:42

Re: Buytable SCREWED.
 
i have no Unknown weapon name in my reallog.txt, though they don't run 24/7. bots have bought all the weapons though. HTH

Josh_Borke 22-07-2004 05:53

Re: Buytable SCREWED.
 
i made the changes to my bot_buycode described below and it has drastically reduced/eliminated the buying multiple primaries each round.
it also reduces the buying of a shield if they have a primary weapon

no Unknown weapons yet evy, done aprrox 30 rounds on mindmaze and none yet.

Josh_Borke 23-07-2004 00:50

Re: Buytable SCREWED.
 
sorry for all the double posting

bot_buycode.cpp: line 179

why isn't it
Code:

pBot->buy_primary = false;
    bBuyOther = false;

? so that they actually save for their favorite?

also, for the actual buy'ing section, I don't know if the compiler will optimize it as much as converting it to a switch statement because that's all it basically is. I remember from my compilers class that a switch statement converts to quicker code than if statements :) HTH :) I have such conversion implemented :)
you have line 444 = line 436

perhaps we could put into the personality a buy only pistols option? perhaps it could be a mode ;)

i've been trying to debug the buycode, it doesn't seem to update the iPrimaryWeapon before going into the buycode sometimes
it is updated after the swat teams are created though :/
any idea why that is????:(:'(

stefanhendriks 23-07-2004 13:45

Re: Buytable SCREWED.
 
The original code was meant to buy every round a new primary weapon; or better said, to let the bot rethink about it so it could buy a BETTER weapon when it has the money and such. When the favorite weapon ip is set, the 'thinking' will be stopped automaticly there.

a pistol mode is cool ;)

iPrimaryWeapon is updated every frame in UpdateStatus() of the bot.


All times are GMT +2. The time now is 17:58.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.