AI test for my snake game (AnacondaNet) UPDATED: 20 June 05

It has been a while since i have updated the public version of AnacondaNet, i have been slowly plugging away in the shadows (when work lets me :stuck_out_tongue: ) and have come to a point where i have implemented a very primitive AI for computer opponents.

[s]At the moment i have having issues with JGF, so it is available as downloadable executable jar: http://www.geocities.com/budgetanime//AnacondaNet.html

This version is a cut down version to reduce file size. The massive scrollable background has been removed and a static background with “movement indication” sprites added. (i.e. grass, rocks)[/s]

Update: Through various means i have managed to reduce the size of the full graphic version from 7meg to 3.29meg and as such i have decided to replace the old graphically reduced version with this one. download the jar here http://www.geocities.com/budgetanime//AnacondaNet.html

At the moment the AI is the result of two state vector summation of forces. The first state is that is not avoiding collision, in this state there there is a summation of two forces: head toward food and try to keep distance between other snakes.

The second state is that of avoiding collision with other snakes, its own body or the boundaries of the world. This is done by testing the intersection with two “feelers” in front of the snake with a proity based on how close the collision is with the snake’s head and turning appropriately (depending on which feeler has first been intersected. In order to try to have sustained avoidance turns, once in an avoidance turn it will not stop the turn unless a closer collision is detected with more than twice the piroity or if avoidance is nolonger needed. This sustained avoidance turn was needed as the snake would start to avoid and then promptly change direction as the other feeler recieves a slightly higher priority causing a wiggling motion and no avoidance.

Ultimatily there will be more forces added as well as more states to try and make a more difficult opponent. Some form of unique identities will be created for the snake AI by applying some random weights on different behaviours such as “fearfulness” i.e. keep away from other snakes or “greediness” be far more attracted to food, etc.

I would like some ideas on what could be added to the snake AI that would make it seem more ‘intelligent’.

Please let me know what you think of the AI as it stands, keeping in mind it is very primitive.

Some controls that may be handy for testing:

Backspace - remove snake labes
Backslash - show AI debuging (i.e. show snake feelers and collision point indicators)
Tab - add extra body segement to your self.

pressing ESC any time will close the current game and return you to the game menu.

I have noticed that some firewalls adversly effect the game, if you have problems, set the “use TCP” option in the game options to true.

To change the number of AI opponents nagivagte to: Game Options->Server Options->AI opponents and change the value. There is a maximum of 500, but that is very slow, i recommend 30-50 snakes.

oh, use the page up and page down keys to zoom in and out.

Sorry Moogie I have no input on your AI because I have yet to do anything with AI but your game is coming along really well, I really like the concept, keep chugging! Simple yet I could see how it could be really fun.

hehe, cheers for the support.

Have you tried the multiplayer option?

I started it up, went to Options, set my name, went back to the main menu, started up a new game. Liked the snake background! I saw a flash of the game board, and I was sent out to my desktop where Norton had flashed me a message asking if I’d like to permit javaw.exe to bypass the firewall. Eh… I wish it was .jar specific, but ok, I’ll let it through :slight_smile: All during this I was hearing “Uh oh!” sounds. I alt-tabbed back into the game to find I was the only snake on the board. I saw a little blue thing in front of me, but it always stayed in front of me as if it was part of the graphic. Not sure what to think about that. I’m not sure if I saw any of the food you mentioned. There was some greenish stuff on the ground I thought might be it, so I ran over it, but it was still there after I ran over it. Perhaps there was no food? Seeing as how I had noticed in my initial flash of the game there were opponents, but now they were gone, I decided to restart the game. I backed hit Escape and then Enter to start a new game, and was disappointed to find that it was reloading the graphics all over again. Shouldn’t that only need to happen once? Anyway, I got back into the game, wandered around a bit, toying with how the arrow keys worked, and watched 3 AI snakes wander up to the top of the screen and off the board, resulting in the “Uh oh!” sounds again. Now I know what that means! But yeah, the very first thing they did was go straight to death :stuck_out_tongue: Perhaps I downloaded a buggy version?

Yeah, for some reason firewalls do not like me sending udp broadcast packets even to the local loop back. There is aTCP only option in the game options. Did you try that option?

The “uh-oh” sounds are from your opponents dying as they go-out-of-bounds. They do this because no food-updates have been recieved to the client from the server. There is no food to be eaten because of the firewall having issues with the UDP broadcast.

In this version the greenish suff (my poor attempt at grass :slight_smile: ) is only used to help give the illusion of movement as this version of the game has a static background.

The blue dots are a form of radar indicating where your opponents are.

I have made some major improvements since this version which will help:

  • i have managed to make the game multi-resoultion
  • implemented a fixed radar in the top right hand corner
  • managed to reduce the pre-rendered tiles in favour of a once off generation of the needed tiles at each resolution (meaning that i have put back the scrolling background and instead of 6 meg for background tiles it is only 2 meg making it much friendler to download)

I will try uploading this newer version on monday, else tuesday.

But until then can you let me know if the game works with the TCP only option set to true?

Cheers

yup that fixed it! Man I had to put my head up on the screen to see the food though. Too small!

did you use the page up and page down to zoom?

/note to self… need to add those keys to the help screen :stuck_out_tongue:

nope :slight_smile: Didn’t know they were available.

Hi,

I really like the music :-). Did you write it yourself?

A nice addition to the gameplay would be to have a pointer that indicates the direction of the next “powerup”.

Christophe

nope :frowning: it is rip from the music for the Anaconda mini-game from timesplitters 2 for Xbox on which this game is based on. I have no artistic talent be it graphical or musical (as witnessed by my “grass” sprite :slight_smile: )

UPDATED to FULL graphic version! see top post to download.

This version:

  • Full graphics allowing for huge 6400x4800pixel unique background.
  • able to choose different background types (for performance reasons).
    -persistant configuration settings.
  • multi-resoultion!
  • fixed radar in the top right hand corner (allowing both transparancy and bit masked versions)
  • RADICALLY smaller file. Now has an inital extraction of data files + a once off tile re-sizing for each resoultion.

some screen shots:

http://img247.echo.cx/img247/9222/screen19se.jpg

http://img248.echo.cx/img248/9885/screen25ih.jpg

http://img44.echo.cx/img44/6415/screen30eu.jpg

oops! i noticed an annoyance which i cannot modify until tomorrow…

The program cannot find resources.tar.bz2 due to silly programming on my part. For a temporary work around, simply extract that file from the JAR and put it in the same working directory as the JAR and then run the batch file.