Page 1 of 1

Robot player tournament framework

Posted: Fri Jun 14, 2013 8:43 am
by Pac-Man
Short version
I made a ServerSidePlayer framework which means you can compile some robots then load and unload them on the map dynamically in a plugin. No support for map objects, but basically for the first time in years it is viable to run a lagless easy-to-program robot tournament for a simple map e.g. 2-shot default variables with all players inside a ring (with ricochet). See live demonstration of my optimal-shooter-training-bot project at 205.185.126.195:5154 (private server) which uses the API.

Useless example (see attached API which is Public Domain):

Code: Select all

void ServerSidePlayer::frameUpdate(double /*dt*/) {
  static bool forward = false;
  if (forward)
    in.tryMove(1, 1);
  else
    in.tryMove(-1, 1);
  float r = (float) rand() / RAND_MAX;
  if (r < 0.05) {
    forward = !forward;
    in.tryShoot(); // API won't actually let you shoot as many bullets as you want
  }
}
To my knowledge, less than 10 people have ever been interested in having a robot tournament. If you are genuinely interested and have at least two of the necessary (sufficient time, some ability in C or C++, math) then contact me and we can discuss. Personally I'm pretty sure no one that I don't already know of (which is only 1 other person who is busy) has a qualified interest, but if someone does front up I'm even willing to help them because it is a lot of work to get anything clever working. That said, this opportunity is about implementing nice ideas and writing a kick-ass robot, not "learning by example".

Or if you know anyone who might be interested please ask them.

Aside: I guess you could propose other crazy ideas if you're interested in making them happen. For example I imagine it's quite achievable to write a parser that generates a robot using a simple language, like:

Code: Select all

Start:
Forward 3 25.0 # 3 seconds at full speed 25 units per second
Delay 1 # Pause 1 second
Turn 1 90.0 # Turn 90 degrees over 1 second
If random < 0.4
  Goto Start
Else
  Teleport 0 0 0
  Shoot 0 90 180 270 # Shoot in 4 directions
...
I made this up randomly but the point is you could have a simple language that map-makers can grasp and use it to generate robots that have some predefined behaviour on a map (for the purpose of acting as targets or obstacles or Ghosts on a Pacman map etc). Obviously if you want it to react to players as well, that's a different story.

Re: Robot player tournament framework

Posted: Fri Jun 14, 2013 11:11 am
by blast
What license are these files released under?

Re: Robot player tournament framework

Posted: Fri Jun 14, 2013 2:59 pm
by mr64bit
Wow, the bot must he a hero, it can't even die!

Re: Robot player tournament framework

Posted: Sat Jun 15, 2013 3:41 am
by JeffM
actually bz robots is used in schools to teach AI so this is not a new concept

the files you have posted are somewhat useless ( they include headers you did not provide).

How much work did you do to complete the server side bot API in bzfs?

Re: Robot player tournament framework

Posted: Sat Jun 15, 2013 5:40 am
by Pac-Man
I'm aware of that bzrobots and other projects, unfortunately they can't really be used.

The files are useless, it's just to show someone what it's like in case they're not sure whether anything is achievable. My post is about finding interested persons, which I doubt will happen which is why this isn't a "tutorial". Also because I'm not intending to release anything if no one wants to use it.
JeffM wrote:How much work did you do to complete the server side bot API in bzfs?
I wrote it over one or two weeks. In terms of work, more than half of it is copying/pasting the network protocol actions. The other part is writing physics simulation (incomplete - I didn't do collision detection yet because I didn't need it for my project) and a world event manager that updates bzfs' data.

So basically I used a hacky approach because I knew it'd be doable and I'd actually get a result. Alternative seemed to be to massive refactoring like in bzflag 3.0's clientBase. Personally I didn't think it was possible.

Re: Robot player tournament framework

Posted: Sat Jun 15, 2013 6:10 am
by JeffM
you do know we actually have a server side bot API already right? it just doesn't do driving, shooting, and dying. Our goal was to do no networking code for bots at all and just let them update the server state.

Re: Robot player tournament framework

Posted: Sat Jun 15, 2013 6:51 am
by Pac-Man
JeffM wrote:you do know we actually have a server side bot API already right? it just doesn't do driving, shooting, and dying. Our goal was to do no networking code for bots at all and just let them update the server state.
I was aware of it and I couldn't see what the incomplete code was getting at.

From your comment it is starting to make sense - the bots can do whatever a plugin tells them to do (which makes sense in terms of flexibility). But if you want a bot that conforms to the physics the burden is on the plugin. If you wanted object awareness like with autopilot...

Re: Robot player tournament framework

Posted: Sat Jun 15, 2013 11:24 am
by blast
Pac-Man wrote:But if you want a bot that conforms to the physics the burden is on the plugin. If you wanted object awareness like with autopilot...
The goal was to have a client logic library that both the client and the server shared. The 2.99.x codebase had the start of such a thing.

Re: Robot player tournament framework

Posted: Sat Jun 15, 2013 6:22 pm
by JeffM
I would like to see your code to see how you implemented it again.