auto-pilot improvements

Make suggestions for improving one of the best games on the net!
Post Reply
David
Private First Class
Private First Class
Posts: 18
Joined: Sun Aug 31, 2003 12:14 pm

auto-pilot improvements

Post by David »

I went on a vacation from bzflag back when 1.9 was an alpha release. I had helped to fix keyboard issues, but at about 10 lines or less that was the limit of my useful source contributions. But now I'm back, at least for part of this weekend. What interested me was the possibility of making a bot that can fight well against real players without cheating.

Last night I downloaded the bzflag 1.10.4 source and modified Roger so that he can navigate around obstacles to reach his targets. What it does is test several random two-segment paths if no direct paths exist and tries to choose the one that'll get it closest to its target, or furthest from its current position if no paths to targets were found. It seems to work very well at avoiding wall collisions. I'm also working on predictive targetting and improved dodging. My changes broke the feature where Roger can jump onto or over obstacles to reach a target, but I hope to find a suitable replacement.

I'll try to find time tonight and tomorrow to implement the rest of my planned improvements and debug them, then post the source when I'm done.
User avatar
blast
General
General
Posts: 4931
Joined: Fri Mar 21, 2003 3:49 pm
Location: playing.cxx
Contact:

Post by blast »

I've been working on improving autopilot as well. I've managed to make him shoot under falling players and over jumping players. I also implemented a priority system to help him pick targets better. He also looks for flags when no target is available.
"In addition to knowing the secrets of the Universe, I can assure you that I am also quite potty trained." -Koenma (Yu Yu Hakusho)

Image
User avatar
Chestal
Dev Guru
Dev Guru
Posts: 171
Joined: Fri Dec 06, 2002 11:56 pm
Location: Siegen, Germany
Contact:

Post by Chestal »

You might also want to check out the bots in current CVS (both v1_10branch and HEAD whcih is 1.11). They use predictive targeting now and I copied the simpel evasive code over from roger. Playing several of them on my ducati robot server is now actually somewhat challenging.

But of course this bot coding is still kinda hackish, so I wouldn't put too much effort into it right now. Some small changes which improve them are interesting, though.
David
Private First Class
Private First Class
Posts: 18
Joined: Sun Aug 31, 2003 12:14 pm

Post by David »

Chestal wrote:You might also want to check out the bots...
As strange as this may seem, I didn't look at robotplayer.cxx long enough to realize it was a working bot.
David
Private First Class
Private First Class
Posts: 18
Joined: Sun Aug 31, 2003 12:14 pm

Post by David »

I uploaded a list of the changes I made and the source to http://www.mytsoftware.com/misc/changes.txt

It does still have some navigation problems, such as jittering between seeing a target and not seeing it, and sometimes it gets kicked for going out of bounds without actually going out of bounds. I'm still investigating why it gets kicked when all it appears to do is adjust speed and rotation, and jump.
David
Private First Class
Private First Class
Posts: 18
Joined: Sun Aug 31, 2003 12:14 pm

Post by David »

I made some more improvements, mostly dealing with dodging. The source changes are at the same url as in my last post.

On simple maps it probably fights a bit too well at this point, so it'll probably need some sort of automatic skill adjustment so that players won't see a score benefit to turning it on for extended periods. And it'll need better filtering of the movements to remove the jitter.
User avatar
blast
General
General
Posts: 4931
Joined: Fri Mar 21, 2003 3:49 pm
Location: playing.cxx
Contact:

Post by blast »

One thing I did to make Autopilot less deadly is to add a small delay between when it wants to jump and when it actually does. I'll have to try out your changes later today.
"In addition to knowing the secrets of the Universe, I can assure you that I am also quite potty trained." -Koenma (Yu Yu Hakusho)

Image
David
Private First Class
Private First Class
Posts: 18
Joined: Sun Aug 31, 2003 12:14 pm

Post by David »

I believe I've fixed the problem where it gets sealed in the floor or auto-kicked. It appears to be caused by speed or rotation getting set to NaN. I haven't yet taken the time to identify the exact cause, but adding simple checks to the end of the autopilot function seems to remedy the problem.

I've also made targetting improvements. It can now predict curved motion, I think. It's hard to test with certainty but it appears to work. It will also needs to take into the account that opponents can be expected to stop turning, but never turn faster. So the expected turn rate will always be less than the maximum turn rate, more so when the opponent is further away. For now I just have it dividing the turn rate by two and using that for its predictions. It'll also assume that they won't turn more than 60 or so degrees, so that it won't predict that far away enemies will just go around in full circles.

The prediction code is seperated into its own function that takes a source and destination player and a network lag estimate, and returns the location that the player would likely be when your shot reaches them if you were to immediately fire at that location. It'll even try to take into account the shot speed difference resulting from your movement speed.

I'm not at home right now so I can't post the revisions yet.

As for using delays in the jump timing to determine when to jump, I've found that the difference in time between consistently escaping and consistently getting hit seems very small. How about having the skill level be a weight that gets multiplied by some periodic function(s) to determine errors in judgement. When the weight gets really high, sometimes it'll jump to escape shots that pose it no threat at all, and sometimes it just won't jump. There could also be some visibility modifier. Many players will fail to dodge shots that only appear on the radar screen.
David
Private First Class
Private First Class
Posts: 18
Joined: Sun Aug 31, 2003 12:14 pm

Post by David »

I've got it adjusting its skill level to ensure that its total contribution to your score is roughly zero. In my last field test it both killed and was killed 35 times (total score 0), and its score mostly stayed within +/- 4. When at -4 or less, it'll play its best. From -3 to +4 or more it'll gradually get worse and worse. Its skill level mostly affects movement responsiveness, aiming, and dodging/jumping. At +4 it won't dodge at all, and predictive targetting is not used.

I also fixed up the flag grabbing/dropping, which I mostly broke earlier. And its no longer a team killer. Although it would never intentionally shoot at team members, it didn't previously check to see if they were in the way. This lead in combination with its bad aim from the reduced skill can annoy quite a lot of players in a rabbit hunt. It's now very careful (perhaps too careful) about shooting when there's a team mate near the shot path.

Same place as before: http://www.mytsoftware.com/misc/changes.txt
David
Private First Class
Private First Class
Posts: 18
Joined: Sun Aug 31, 2003 12:14 pm

Post by David »

blast pointed out that the latest version no longer attempts to jump on buildings. I'll try to fix this bug when I get a chance.
David
Private First Class
Private First Class
Posts: 18
Joined: Sun Aug 31, 2003 12:14 pm

Post by David »

I've fixed several bugs in my additions relating to targetting, path finding, jumping, etc.. Little in the way of new features, as that's no longer a priority. I'll try to find time to clean & comment my code so that easier to work with. I re-uploaded the code to the same place as before.

Edit: Fixed a few more serious bugs that I added earlier. At least one bug in the path finder, a few related to jumping, and then the accidental use of degrees vs radians in a couple places.
Post Reply