Keebler Elf Posted October 31, 2011 Author Share Posted October 31, 2011 I do not know how many of you have ever heard of this website but it is pretty cool. [http://aichallenge.org](http://aichallenge.org) It is a contest in which they take simple games and your goal is to create the best AI (bot) for that game. Almost any language you might want to use is supported. Anyone can enter as was clearly shown when I entered what I must say is a real horrible bot. It is still fun however and I suggest checking it out. Link to comment Share on other sites More sharing options...
westin444 Posted November 1, 2011 Share Posted November 1, 2011 You are so right. That's an epic website. unfortunately, now I'm likely to spend lots of time programming a bot for that. *sigh* Well there is a trade-off. Link to comment Share on other sites More sharing options...
Rithy58 Posted November 2, 2011 Share Posted November 2, 2011 I started with a very basic Java Bot. It just tell the ants to explore the unexplored tiles then loop it over and over. Then I tried VB. I wrote VB in VS 2010 but didn't work on their server with Mono. I'm not sure what's wrong cause I never do anything for Mono. It was something to do with HashTable. So I switched to a very basic Python for temporary. I don't know enough Python to keep going and make my Bot better so I went back to Java. I added food gathering as top priority and also avoid collision. I did not know that collision cause ants to die. Now I just need to do the pathfinding cause using getDirection cause the ants to get stuck in corners. Researching on A* Algorithm at the moment and will try to implement it in my Java Bot then it's ready to upload.How are you guys doing?Sincerely,Rithy Link to comment Share on other sites More sharing options...
Keebler Elf Posted November 2, 2011 Author Share Posted November 2, 2011 I am pretty new to programming. So the fact that c++ is my first language is not helping. I have a shitty python bot that crashes around halfway through most of its game. So I am working on a c++ one. Ya the A* algorithm is nice, however I am having trouble implimenting it, so I will probably just continue messing around for now. Link to comment Share on other sites More sharing options...
RyokuHasu Posted November 2, 2011 Share Posted November 2, 2011 Entered with a VB.NET bot!I'm just using a simple priority based AI, I'll add in Tactics later. =PPriority list: (is visible field)1\. attack hills2\. gather food3\. search aimlesslyavoiding collision is a constant in all priorities =D Link to comment Share on other sites More sharing options...
Rithy58 Posted November 2, 2011 Share Posted November 2, 2011 Ryoku, how are you keeping the data? I tried keeping it in HashTable or Stack and it won't compile on the server.Sincerely,Rithy Link to comment Share on other sites More sharing options...
RyokuHasu Posted November 2, 2011 Share Posted November 2, 2011 keeping data?I have no Idea what you mean… >.<... maybe if you explained that a bit more x.x (sorry if that sounds stupid)XD I'm just using a Blind-Bot that wonders aimlessly until it sees something, then it acts. All I have is a lightly modded VB starter pack.* * *Edit: I'm surprised my bot actually worked right… sorta... XD I messed up on the wondering part but its gather and attack hill logic RULES!But since I know I'm on the right track I can make it WAY better >:D* * *Edit 2:I don't see a lot of advanced attack risk checkers in other bots. They just attack if it's 2 against 1.I'm making an attack-risk manager that will determine if my the local force of your ants is greater they attack, if not they retreat, no more Large army stand offs XD Link to comment Share on other sites More sharing options...
LeaRae Posted November 2, 2011 Share Posted November 2, 2011 Looks neat, if I wasn't moving this week I would give it a shot Link to comment Share on other sites More sharing options...
Rithy58 Posted November 3, 2011 Share Posted November 3, 2011 Well I'm keeping track of the orders I'm giving to each ants for each turn. I don't want to tell two ants to go for the same food location.I also keep track of all ants hill found. Once I have enough ants, I send them in for the attack. I'm just not sure when to do that yet. There is no way for me to know how many ants the enemy have.I'm also working on the exploring. I send ants to different part of the map to explore. Again, keep track of what's going on. I don't want to send ants to the same place.As for the pathfinding, I'm probably also going to keep track of data again.Sincerely,Rithy Link to comment Share on other sites More sharing options...
Keebler Elf Posted November 3, 2011 Author Share Posted November 3, 2011 If you want to know when to go for the kill I suggest attempting to keep the enemy hill visible and count the number of ants around it. Then start sending over ants until the number you have watching the hill is greater then the number you can see near it. This is the strategy I have seen implimented in some games, it seems to work good if you ants can avoid the enemy ants while waiting. Link to comment Share on other sites More sharing options...
LeaRae Posted November 3, 2011 Share Posted November 3, 2011 is there a way to see how many ants are near one of your ants? If you know where your ants are, and you know how many ants are near you ants, you could make a rough estimate of how dense the enemy ant population is.Once you form the 'gradient' of enemy ant density, you could make estimates and decisions based on it…(just pondering while knowing nothing of what you can really do) Link to comment Share on other sites More sharing options...
Rithy58 Posted November 3, 2011 Share Posted November 3, 2011 I keep track of the enemy hill, however you can't really keep track of your enemy ants because it's always changing. Keep track of the ants near the hill is even harder. Unless you're keeping one ant to scout that hill. Instead, this is how I do things. I group the ants and once it's more than 50, all are going for the kill. I guess I can improve that "50" by changing it throughout the game. Still working on it.Sincerely,Rithy Link to comment Share on other sites More sharing options...
RyokuHasu Posted November 3, 2011 Share Posted November 3, 2011 @LeaRae:> is there a way to see how many ants are near one of your ants? If you know where your ants are, and you know how many ants are near you ants, you could make a rough estimate of how dense the enemy ant population is.> > Once you form the 'gradient' of enemy ant density, you could make estimates and decisions based on it…> > (just pondering while knowing nothing of what you can really do)If you are using VB.NET i can give you what I use to check my local ant numbers vs Enemy local numbers.This Is the code I use to count the near-by ants, both mine and the enemy.**as my bot is defunct with order reading, This has yet to be tested properly.```dim good as integerdim bad as integer 'Calculate Battle Risk For Each BadAnt As Location In a.EnemyAnts If (BadAnt.Col >= antLoc.Col And (BadAnt.Col - antLoc.Col) <= a.ViewRadius2) Or (BadAnt.Col < antLoc.Col And (antLoc.Col - BadAnt.Col) <= a.ViewRadius2) Or (BadAnt.Row >= antLoc.Row And (BadAnt.Row - antLoc.Row) <= a.ViewRadius2) Or (BadAnt.Row < antLoc.Row And (antLoc.Row - BadAnt.Row) <= a.ViewRadius2) Then bad = bad + 1 End If Next For Each GoodAnt As Location In a.MyAnts If (GoodAnt.Col >= antLoc.Col And (GoodAnt.Col - antLoc.Col) <= a.ViewRadius2) Or (GoodAnt.Col < antLoc.Col And (antLoc.Col - GoodAnt.Col) <= a.ViewRadius2) Or (GoodAnt.Row >= antLoc.Row And (GoodAnt.Row - antLoc.Row) <= a.ViewRadius2) Or (GoodAnt.Row < antLoc.Row And (antLoc.Row - GoodAnt.Row) <= a.ViewRadius2) Then good = good + 1 End If Next```@ Rithy:just remember to limit the time you spend on reading your stored data, you only have a second for your turn. but your AI sounds like its getting better =D* * *as for me, I messed up my orders storage and check and then I could only move 1 ant at a time, I'm trying to fix this.other than that I have ALL the basic AI down, including a pseudo problem solving that lets them move around obstacles in the way of its target. Link to comment Share on other sites More sharing options...
westin444 Posted November 3, 2011 Share Posted November 3, 2011 Seeing that people were looking for A*….Here is a snippet of AStar in use with my game engine that I converted to this. Note: This code also acts as if ants are impassible.[http://pastie.org/2802840](http://pastie.org/2802840)Its just has a static method findPath(Ants ants, Tile start, Tile end) that returns an array of tiles. Link to comment Share on other sites More sharing options...
Stach Posted November 4, 2011 Share Posted November 4, 2011 I'm extremely retarded. I have no idea how to make my ant move other than up and down lol. I've never attempted to make an AI and this is however very interesting. Link to comment Share on other sites More sharing options...
Robin Posted November 4, 2011 Share Posted November 4, 2011 @Tael:> I'm extremely retarded. I have no idea how to make my ant move other than up and down lol. I've never attempted to make an AI and this is however very interesting.Steal the AI system from Origins. Guaranteed to win. Link to comment Share on other sites More sharing options...
RyokuHasu Posted November 4, 2011 Share Posted November 4, 2011 ^_^I finally won a match! Though its only because the enemy timed-out. XDANY WAY. I've been making my AI though trial and error. I finally created an AI capable of battle and path-finding!;D Slowly it's getting there.T_T sadly I cant run local test for the life of me… it's all online testing >.< Link to comment Share on other sites More sharing options...
westin444 Posted November 4, 2011 Share Posted November 4, 2011 Lol why can't you local test? Link to comment Share on other sites More sharing options...
RyokuHasu Posted November 4, 2011 Share Posted November 4, 2011 O.o i just can't … I'm to stupid too local test.unless you make a video on how to local test I can't do it XDHowever, I'm making a good bot with out the need for local testing XDI can make an AI but I'm too stupid to run the tests on it, How does that work? Link to comment Share on other sites More sharing options...
westin444 Posted November 4, 2011 Share Posted November 4, 2011 [http://aichallenge.org/starter_packages.php](http://aichallenge.org/starter_packages.php)> You will need to download the tools in addition to the starter pack. Choose [Windows](http://aichallenge.org/tools.zip) or [Linux / MacOS](http://aichallenge.org/tools.tar.bz2)Download that, get yourself python, and run-game-once-live or whatever is in the tools folder. If you want to use your *own* bot, then open up the script and find the code in the quotes. EX: "python ""%~dp0sample_bots\python\LeftyBot.py""" and replace with the launch code for your own: "java -cp mybot MyBot" Link to comment Share on other sites More sharing options...
RyokuHasu Posted November 4, 2011 Share Posted November 4, 2011 that doesn't help!I can read, and I followed the directions, BUT I DON'T UNDERSTAND THEM. either make a video or leave me to my online testing!I've tried every thing on the setup and tools pages, I've tried the solutions on the forum, I CAN'T do it. Link to comment Share on other sites More sharing options...
Robin Posted November 4, 2011 Share Posted November 4, 2011 Probably shouldn't be trying to write an AI if you can't run a local python program. Link to comment Share on other sites More sharing options...
RyokuHasu Posted November 4, 2011 Share Posted November 4, 2011 Hey, I understand the code, I don't understand the local testing.Having the ability to write AI and the ability run a python program are 2 separate things.I have understanding of the code, a way to test it, and understanding to improve the AI. There is no reason I shouldn't. Link to comment Share on other sites More sharing options...
Robin Posted November 4, 2011 Share Posted November 4, 2011 @Ryoku:> -snip-How's that autism doing for you? Link to comment Share on other sites More sharing options...
Rithy58 Posted November 5, 2011 Share Posted November 5, 2011 I'm stealing Origin's AI system for my VB.Net AI and also using 314piwm for my Java AI.Thanks for that.Ryoku, using the local testing tools is easy. You need to install python and make sure you set up your environmental variable so terminal understand the command python. Then you just have to edit the arguments in Play_One_Game.cmd(or .bat. not sure) I'm guessing you're using VB.Net on Windows. So You just gotta change one of the "python ""…"" " to like "sample_bot\vb\MyBot.exe" with MyBot.exe being your compiled AI.I'm using Mono on Ubuntu so not sure if I told you correctly. But you should look up on how the game engine work so you know how your AI and the game actually communicate.Sincerely,Rithy Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now