Page 1 of 3

PureContest 3 - AI-Game

Posted: Fri Jun 25, 2004 8:00 pm
by Rob
Hi, im the Admin of the german PureBasic-Forum.

We hold an Programming-Contest every few months, the PureContest.
It was asked, if the contest could be expanded to the english forum as well. Except for my poor english, theres nothing to say against. So i hope you understand the rules and participate in swarms Image



AI-Game


The Engine with Documentation and Demo-DLLs written by Lars from the german forum:AI-Game.rar - 165KB


What can be better than to be squired by a little Robot, which relieves you strenuous work, entertains you and eventually lets bothersome people vanish inconspicuously?
Well, not much.

This Robot could also be used for substitute-fights, so that on has'nt to deal with nasty neighbors or similar things. One Arena, two Bots and every dissension is solved in three minutes. Because real bots are not ready for the market yet, we confine to simulations. May the fight begin!


The rules
  • Two Bots fight against each other on the given field. The Bot-Code lies in DLLs which get loaded by the Engine.
  • They have informations about walls, surface, position of the enemy and his shots.
  • Each Bot starts with 100 Health-Points (HP).
  • Lava subtracts 0.007 HP per Timeunit and slows the bot down by 30%, green swamp-slime subtracts no HP but slows the Bot down by 50%.
  • A hit subtracts 5 HP.
  • A match takes 180 seconds.
  • Each Bot has 10ms per round to complete his calculations.
  • Technically allowed is everything that PureBasic is capable of, except other DLLs, Userlibraries and Threads. WinAPI is allowed.
  • It has to be fair corresponding to the rules. The modification of enemy- or engine-data in memory is not allowed...
  • A Bot wins, if he kills the other or has the most HP left at the end.
  • If both bots have the same score at the end, both get the chop (Robots do it all or nothing).
  • Closing date is 31. August 2004. At this date, all Bot-DLLs incl. sourcecode must have arrived at rob@robsite.de.
  • I will then let the Bots fight against each other in randomly chosen order in KO-Mode (classical "Pyramide"). The fights will be held on an 800Mhz Athlon TB with 384MB RAM.
  • If the score difference is <=5, the match will be repeated max. 2 times.
  • Then the results, the Replay-Files and the bots will be published on the PureContest-Site.
  • To play the Replays, just start the Engine with the -replay Parameter.

The profit

A 31,3 cm long 3-Cell D Maglite in royal blue.
'Flashlight' is no expression for this masterpiece of american lamp forging art from Ontario, California. It grants light in all situations and is also feared as a truncheon by the mob...


Image


Screenshots, the Files and the old contests can be found on the PureContest-Site

Posted: Sun Jun 27, 2004 2:23 am
by PolyVector
I love competitions like this!
I wish I had more free time :(

Posted: Sun Jun 27, 2004 9:42 pm
by Rob
Apparently theres not so much interest, at least in the english forum. So maybe you have a chance even with a rather dumb bot ^_^

Posted: Thu Jul 01, 2004 2:07 am
by aaron
Well, like many around here I don't ever seem to have enough time... but I'm planning on putting together a bit of code for this competition. A quick couple of questions.... I read the german forums from time to time, but don't speak german :D , so I'm forced to do it through babelfish. I see that a bug was found in the game engine and fixed last weekend. Was this update rolled into the english version of the code also? Also, is there any limit on the number of robots that one person can submit? :wink:

Posted: Thu Jul 01, 2004 2:57 am
by El_Choni
I'm also playing with this, currently trying to get pathfind working... Just give us some time, we'll do our best ;)

Posted: Thu Jul 01, 2004 4:31 am
by PolyVector
I wrote in a new weapon that turned the opponent into a spinning idiot...
I was planning on making the opponent fly towards me and let me kill him... but... that's against the rules, so I quit right there :)

Posted: Thu Jul 01, 2004 4:13 pm
by Lars
First of all, i'm sorry the support in the english forum had a little delay :)
Sorry!
aaron wrote:Also, is there any limit on the number of robots that one person can submit? :wink:
Yes, 1 :)
aaron wrote:Was this update rolled into the english version of the code also?
Checked, yes.
To give you the information, too: On 26th June there was reported a little
inaccuracy in the collision detection in the german forum. On 27th
June, 7:42 pm
, the fix was reuploaded, all versions later than this
should be redownloaded (old link)!

Posted: Thu Jul 01, 2004 6:35 pm
by PolyVector
I can't get the map array to work at all... I completly understand what's going on...but... For some reason or another the map array appears to contain random data?... And I was looking forward to playing with it too :(

From reading the source I would think that this collision detection code should work:

Code: Select all

    TileX = Round(x / 18,0)
    TileY = Round(y / 18,0)
    If TileX<0 Or TileY<0 Or TileX=>40 Or TileY=>30 Or *Map\Map[(TileY * 40 + TileX)]=1
      Hit=#True
    EndIf
Is it something stupid I'm doing?

Posted: Thu Jul 01, 2004 7:09 pm
by El_Choni
I fell in the same error. You must have in mind that bidimensional arrays in PB are stored in memory by columns, not by rows. Which means you must access them like this:

Code: Select all

*Map\Map[(TileX*30)+TileY]

Posted: Fri Jul 02, 2004 12:03 am
by PolyVector
THANKS EC!!!
I'll try it out

Posted: Fri Jul 02, 2004 2:57 pm
by Lars
I am very sorry to tell you this, but as i read the code again, I found a one
more bug by now that affects the engine to don't pass the shots list right.

I'll do some more bug searching and fixing before releasing a new
Version, i hope you understand this.

I can't express how embarrassing this is to me in my bad english, i'm very
sorry :oops: :oops: :oops: :oops: :oops: :oops:

Posted: Fri Jul 02, 2004 3:17 pm
by El_Choni
Don't worry; personally, I'm still trying to get my idiot bots not to run into every wall they have around, so I don't care too much about shoots yet ;)

Posted: Fri Jul 02, 2004 5:20 pm
by Rob
Ok, the (known) bugs were fixed and the new Files are up (also as ZIP).

Additionally there are two rule changes:

- The closing date is now the 31. August 2004. 1 month more time should be sufficient now.
- Threads are not allowed. Because each bot has 10 ms calculation time, this should be obvious, but now it is explicitly in the rules. E.g. Threads with highest priority cant be use now...

Posted: Sat Jul 03, 2004 3:01 pm
by Lars
Yet another bug :oops:
(Major bug in collision response, one AI could get through a wall, if the
other AI is on special surface :oops: )

The new version is up again, old link.

Thanks to El_Choni for his great help on this bug :wink:

Posted: Wed Jul 14, 2004 6:38 pm
by Rob
The new version is up.
There is also a new rule, which however has no influence on the programming of the bots:

If the score difference is <=5, the match will be repeated max. 2 times.

Through unexpected circumstances (suddenly HDD-Access through Windows, inaccurracy by TimeGetTime_()), every battle can be a little different. So it gets repeated. If the same bot wins, it also wins the game. If not, the battle gets repeated once more.