Frikbot Item desirability

Discuss Artificial Intelligence and Bot programming.
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Re: Frikbot Item desirability

Post by Lightning Hunter »

gnounc wrote:sorry, I'm out of ideas.
I'm really not sure what else to do, except ask frikac for help.
I hope you manage to get something going though.
It's ok, I appreciate your help! I'll stick with the initial random code I came up with unless someone else has an idea. 8)
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Re: Frikbot Item desirability

Post by Lightning Hunter »

Well, since the initial idea of having randomized item placement seems to be too difficult, I thought I'd just perfect what we already have. Gnounc, I'm sure this question is easy for you. I simply want to tell the bots not to go for health boxes if their health is higher than a certain amount. I'm not sure how to do this. This is the current code, which is supposed to give the bots a high priority if their health is lower than 50, but I sometimes see the bots going for health when it is above 50:

Code: Select all

	else if (thing.classname == "item_health")
		{
			if (self.health <= 50)
				thisp = 50;
			if (thing.spawnflags & 2)
				thisp = 13*(random()) + 37;
		}
Is it as easy as adding this?

Code: Select all

if (self.health > 50)
				thisp = 0;
Or is there more to it than that?

Edit:

Well, the code above does seem to work, so I answered my own question. I am currently using this code now to give the bots different priority of health pickups based on their own health:

Code: Select all

		else if (thing.classname == "item_health")
		{
			if (self.health <= 50)
				thisp = 50;
			if (self.health > 50)
           		 thisp = 35;
			if (self.health > 80)
           		 thisp = 20;
			if (self.health > 99)
           		 thisp = 0;
			if (thing.spawnflags & 2)
				thisp = 13*(random()) + 37;
		}
Last edited by Lightning Hunter on Thu Mar 27, 2014 3:41 am, edited 1 time in total.
gnounc
Posts: 428
Joined: Mon Apr 06, 2009 6:26 am

Re: Frikbot Item desirability

Post by gnounc »

the only improvement I would suggest is using converted health.
Meaning count armor as well.

But, looks good! good work
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Re: Frikbot Item desirability

Post by Lightning Hunter »

I was just about to post the code I just created for the Armor as you made your post. :)

Here is the Armor code:

Code: Select all

		else if (thing.classname == "item_armor1")
		{
			if (self.armorvalue <= 99)
				thisp = 13*(random()) + 26;

			if (self.armorvalue > 99)
           		thisp = 0;
		}

		else if (thing.classname == "item_armor2")
		{
			if (self.armorvalue <= 149)
				thisp = 13*(random()) + 35;

			if (self.armorvalue > 149)
           		thisp = 0;
		}

		else if (thing.classname == "item_armorInv")
		{
			if (self.armorvalue <= 199)
				thisp = 10*(random()) + 45;

			if (self.armorvalue > 199)
           		thisp = 0;
		}
Does all look good? It seems to work pretty well in the game. I haven't seen the bots go for health or armor yet when they are maxed. As soon as they lose Armor, they go straight for more. I think this will help keep the bots going for different items based on their circumstances. I hate when all the bots go for the same item that spawns with a high priority - resulting in battles always ending up in one part of the map.

If you have any suggestions for further improvement, I would like to hear it.
gnounc
Posts: 428
Joined: Mon Apr 06, 2009 6:26 am

Re: Frikbot Item desirability

Post by gnounc »

looks good. if it works good thats even better!
If you really want to stretch a bit, I got this bit from spike.

Code: Select all

local float m;
m = self.health/(1-self.armortype)

if(self.armorvalue > m && m > 0)
     health = self.health + m;
else
     health = self.health + self.armorvalue;
that gives you "converted health" which is how much health you have when you take into account your armor.
So you can check that number, and not do anything until it dips, unless you happen to be really close to armor/health, then snag it anyways.

If not, it doesnt really add that much benefit.

Other ideas I have are helping the frikbot to spawncamp. Players know the maps very well coming in, they know where the items are, how long they take to respawn, and where the player spawns are.
From what I saw frikbot doesnt know these things. I think it would be a nice benefit to let him scan the map items at the start and give him an initial goal list. maybe even a list of 3 things to track.

Again though, I understand you were more interested in fixing glaring omissions. But if you decide you want to keep patching up the frikbot, theres some stuff that can be done : )
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Re: Frikbot Item desirability

Post by Lightning Hunter »

gnounc wrote: Other ideas I have are helping the frikbot to spawncamp. Players know the maps very well coming in, they know where the items are, how long they take to respawn, and where the player spawns are.
From what I saw frikbot doesnt know these things. I think it would be a nice benefit to let him scan the map items at the start and give him an initial goal list. maybe even a list of 3 things to track.

Again though, I understand you were more interested in fixing glaring omissions. But if you decide you want to keep patching up the frikbot, theres some stuff that can be done : )
Thanks Gnounc, I'll mess with the converted health sometime later today.

I absolutely would be interested in patching up other things with the Frikbots! Anything that makes them even a little better is beneficial. My thoughts lately were that anybody who wants to help improve any part of the code with the Frikbots would be helpful, so we can have the best bot for Quake around. The final version would be included in my next major release of the Waypoint pack (which will hopefully include a zombie mod).

When it comes to spawncamping, I do think it's a good idea, but only if the bots randomly choose to do it. I do want the bots to occasionally go for lesser items, so they navigate an entire map. Unreal Tournament has a nice system in which the bots will sometimes go for an item like 10 seconds before it is about to respawn, and stand on the spot where it will spawn. Once it spawns and they pick it up, they go for another goal. This should be randomized though, so the bots aren't always sitting around waiting for items to respawn.

By the way, there are a few other things that bother me about the Frikbots that I think someone like you could easily fix. One such issue is the bots sometimes shooting buttons with grenades or rocket launchers (hurting themselves in the process). The bots should only shoot buttons with shotguns and nails (preferably shotguns, since they are less likely to miss a button when they aim).

Also, a while back, I was interested in modifying the spawn system so that the Frikbots do not spawn within a certain radius of the player or other bots. I noticed when I'm battling the bots that spawn kills are far too easy, especially when I'm running around with an RL or Quad. The bots would do better if they spawned away from each other and players. I don't know what coding is involved for this, though. The mod NewDM has such a feature, but there is no source for it. I tried contacting bta.monster a while back, but he never responded (he hasn't been around lately). Not sure where he disappeared to.

Edit: I should have uploaded this for you a while back, btw. This is the current working version of source for the Frikbots in my folder, and is the version that should be worked on. It does have various other updates that I've added over time, including an aim offset code by Wazat and Supa (so they aren't 100% accurate with the shotgun): http://filebeam.com/aea8781571d69adb4afbbd14fa68482c
gnounc
Posts: 428
Joined: Mon Apr 06, 2009 6:26 am

Re: Frikbot Item desirability

Post by gnounc »

I do need to point out that dr shadowborg just asked for frikbotsxc because he couldnt find it. Thats the latest version.
This leads me to believe that maybe the version you're working with is older. I saw in the release notes that a "major navigation bug" was squashed. So try updating to xc and let me know if that solves any of the problems without further modification.
Also post what version you have if you know (i checked your zip, theres no release info there)
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Re: Frikbot Item desirability

Post by Lightning Hunter »

The version I based all this on was FBX+, which was an updated version by "illithid", based on the last release FrikaC made (which should be fbxb, found here). I looked just now, but can't find any download link to FBX+. It doesn't seem to exist anymore. The version I have is based off it, though.

My version also includes a fixed map cycler, which was broken in the original fbx+ release. It should have all the last updates by FrikaC, in addition to updates by illithid, and a few other tweaks and fixes since then (like the aim offset code by Wazat and Supa). What version do you suggest I compare to? The only "latest" releases I know of are fbxb and FBX+, and it does seem that FBX+ has new code added to fbxb, including bot_ai improvements.

Edit: I found the readme file for the FBX update (still can't find the file). It says the following:

Code: Select all

The following changes have been made to the original Frikbot X code:

. Improved item pickup AI.
. Improved waypoints for DM1, DM4, DM5 and DM6.
. Included deathmatch 3 mode.
. Included random respawn locations.

Enjoy!

-Igor9
I believe this was the last update done to the Frikbots, and this is the code I've been using.
Dr. Shadowborg
InsideQC Staff
Posts: 1120
Joined: Sat Oct 16, 2004 3:34 pm

Re: Frikbot Item desirability

Post by Dr. Shadowborg »

Its hard to tell whether the C revision includes anything over the fbx+ version by igor9. What I CAN tell is that fbx+ appears to have files that were modified from the post 2006 release of the C revision.

Theres some confusing stuff in the documentation of the C revision that sorta implies that improvments from a "plus" project were included, but beyond frik_file entity dump support, I can't see very much different from the B version.

In any event, I'm going to look over the source codes from fbx+, revision C, and Lightning Hunter's updated_frikbots. Assuming I don't go insanes from trying to figure out how it works...I'll try to do some updating and enhancement.

Any suggestions or issues with the current version should be pointed out for consideration in regards to getting them fixed / implimented.

Side note: Frik_Obstacles lava / slime check seems to be able to check for CONTENT_SKY, which *should* work on voidmaps...but maybe it's not tracing far enough or something. I dunno.
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Re: Frikbot Item desirability

Post by Lightning Hunter »

Dr. Shadowborg wrote:Its hard to tell whether the C revision includes anything over the fbx+ version by igor9. What I CAN tell is that fbx+ appears to have files that were modified from the post 2006 release of the C revision.
I am also confused about this. I never knew there was a Revision C for the official Frikbot release. I always assumed that Igor9's version was the latest.
Theres some confusing stuff in the documentation of the C revision that sorta implies that improvments from a "plus" project were included, but beyond frik_file entity dump support, I can't see very much different from the B version.
I noticed that myself, and am also confused by it. Now I'm not sure that my updated version has all the fixes of Revision B and C!
In any event, I'm going to look over the source codes from fbx+, revision C, and Lightning Hunter's updated_frikbots. Assuming I don't go insanes from trying to figure out how it works...I'll try to do some updating and enhancement.
You are awesome! Be sure to read my list above (bots shooting at buttons with GL/RL, spawning, etc.). There is also another bug I sometimes see with the Frikbots in which they use teleporters wrong. Sometimes you see them touch a teleporter, the sound is heard (along with the teleporting effect), but they didn't actually teleport. They then proceed to run to the wrong waypoint. Sometimes I also hear multiple teleport sounds, and they run to the wrong waypoint, getting stuck on a wall in the process. I have no clue if this bug can be tracked down, though. I can try to record some videos of it next time I come across a trouble teleporter.
Side note: Frik_Obstacles lava / slime check seems to be able to check for CONTENT_SKY, which *should* work on voidmaps...but maybe it's not tracing far enough or something. I dunno.
I can confirm that bots ignore obstacles at great heights. For example, if a ledge is really high above lava, they stop caring that the lava is there. If this is fixed though, it might create some problems with navigation in a few maps. Blind mode is required to get the bots to jump over lava, but I may not have turned on blind mode with some waypoints up high that require bots to jump over lava. Maybe the tracing distance can be increased only for sky?
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Re: Frikbot Item desirability

Post by Lightning Hunter »

Dr. Shadowborg, I do know one more thing that can be enhanced. Bots should reset their path from (based on the nearest waypoint) when they fall a certain distance. For example, if they accidentally fall down a cliff, are blown off a ledge, or are fighting another bot and end up falling off a catwalk somewhere - they always try to get back up to where they were, which gets them stuck, or worse - kills them. Their path needs to be immediately reset when they fall from a certain height (not too small, or they will constantly be resetting their path when they jump normally). This would fix quite a few issues with the bots getting stuck on walls and dying in void maps.

I would definitely put the priority of this feature above the others I mentioned in the post before.
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Re: Frikbot Item desirability

Post by Lightning Hunter »

Hey Shadowborg, did you ever get a chance to compare the code of all the existing Frikbots around? I am thinking of releasing another waypoint pack, but want to make sure I have the most updated, recent version of the Frikbots included with it.
Dr. Shadowborg
InsideQC Staff
Posts: 1120
Joined: Sat Oct 16, 2004 3:34 pm

Re: Frikbot Item desirability

Post by Dr. Shadowborg »

Unfortunatly no, I haven't looked it over yet. :(

Honestly, it kinda slipped my mind too. :oops:

I'll take an earnest go at looking it all over tomorrow, and try to wrestle those bugs out.
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Re: Frikbot Item desirability

Post by Lightning Hunter »

Dr. Shadowborg wrote:Unfortunatly no, I haven't looked it over yet. :(

Honestly, it kinda slipped my mind too. :oops:

I'll take an earnest go at looking it all over tomorrow, and try to wrestle those bugs out.

Awesome, thanks for doing this!

By the way, I uploaded my own tweaked bot_ai.qc for you here:
http://fbe.am/tZv

This is the one I worked on a while back that adds a bit of randomization to the item pickup, and also stops the bots from going for armor and health they don't need (the priority of health and armor pickups increase when the bots' health is low). It is much better than the default code. I'm not sure if Revision B or C of the Frikbots have anything that my code does not have, but I did quite a bit of work and testing to make sure bots pick things up in an order that makes sense (I observe them constantly in the maps I waypoint, so I know the code works well).

Edit: There is also another bit of code I just remembered that was added to bot_ai by Supa. It adds an aim offset for the Frikbots when they wield the shotgun, so they aren't 100% deadly accurate on high skill levels (it was ridiculous before). If you search for "Supa" in the bot_ai file, you will find the code that was added/changed.
Post Reply