<< Back to Classic Forum   Search

Posts 117 - 136 of 565   <<Prev   1  2  3  4  5  6  7  ...  17  ...  28  29  Next >>   
WarLight AI Challenge: 2014-04-05 18:37:25


Norman 
Level 59
Report
OK, I found a solution on how to debug the bot locally. The disadvantage is that you don't have the graphical output of the server.


Here are the steps necessary to debug your bot locally using my solution. It shouldn't bother which language you wrote your bot in but if you used a language other than Java you have to adapt the argument for executing your bot.
Step 1: Download the game engine modified by me (game engine was released under the Apache license so me uploading modified stuff should be fine):
http://www.file-upload.net/download-8786734/WarlightBotEngine.zip.html
Step 2: Import my modified game engine as an eclipse project (I created an eclipse project out of the files).
Step 3: Export your Java bot to JAR files. Since two bots are playing together you need two JAR files.
Step 4: RunGame.java contains the two strings bot1Dir and bot2Dir. Currently the paths are pointing to my Desktop. Modify them so that they are pointing to your two JAR files.


How it works:
There are two classes with main methods, namely RunGame.java and NormanMain.java. Running the main method from RunGame let's your bots play a single game against each other. NormanMain contains a loop letting your bots play a couple hundred games against each other.
In RunGame I created the method named printDebugStuff. The only thing that method does is printing the stderr stream to the console after the game has finished. So if you write in your bot something like System.err.println("Hello World"); it will appear on the console. Here is some debug output that is comming from my bot:

=============== Round Nr: 5 ===============
Possible super regions last turn: North America, South America, Europe,
Opponent deployed visible: 7
Guessed opponent income: 7
Guessed opponent SuperRegions: South America,
Guessed opponent Regions: Peru, Egypt, Argentinia, Venezuela, Brazil,
Guessed game state: armiesAdvantage
Guessed opponent deployment: 7 armies to Egypt
WarLight AI Challenge: 2014-04-05 23:15:31


125ch209 
Level 58
Report
wow thank you very much. I tried to do what you said, but i think your bot is smarter than me, because i can't get it to work. When i modify the direction to the jar files, i get this:
java -jar C:/Users/Hugo/Desktop/gadz.jar
java -jar C:/Users/Hugo/Desktop/gadz2.jar
Error: Invalid or corrupt jarfile C:/Users/Hugo/Desktop/gadz2.jar

it is weird because the real path would be C:\Users\Hugo\Desktop\gadz.jar , but it doesn't compile when i use "\" instead of "/"
also when i export the bor to JAR file, it says "exported with compile warnings"...any thoughts?
WarLight AI Challenge: 2014-04-06 08:16:08


Norman 
Level 59
Report
'/' as separator should be fine. Works on Windows. Your compiler warnings point out probable problems in your code but should be irrelevant for the task of generating the JAR. Those yellow markers in eclipse represent the compiler warnings.

I guess your JAR file isn't executable. This is how I export my JARs using eclipse:
1. Export runnable JAR file.
2. In the launch configuration I specify my main file (= BotStarter).
WarLight AI Challenge: 2014-04-06 13:04:54


Hitchslap
Level 56
Report
...

Edited 2014-04-06 13:05:16
WarLight AI Challenge: 2014-04-06 15:41:05


125ch209 
Level 58
Report
Thanks it worked (i wasn't exporting as runnable JAR...)! but can't we see the output for each round like there is on theaigame website?
WarLight AI Challenge: 2014-04-06 15:49:18


ps 
Level 61
Report
to debug where my bot was crashing the sim i also had to get the conquest engine working (i call it the sim).

My code is online at:
https://github.com/psenough/warlight_ai_challenge

I made the /sim/main/RunGame.java saveGame() function output the error and message dump of bot1 to the command line

System.out.println("bot1 stdErr...");
System.out.println(bot1.getStderr());

System.out.println("bot1 dump...");
System.out.println(bot1.getDump());


And then when i call the sim i just pipe the result to a log file (you have to use a > on the command line), like so:

"C:\Program Files\java\jre8\bin\java.exe" main.RunGame 0 1 2 "..\..\temp\mybot.exe" "..\..\temp\mybot.exe" >"..\..\temp\log.txt"

Also made a few batch files to compile and run available on /scripts/

Don't know if it helps you or not but they're online on my repo if you want to check them.
WarLight AI Challenge: 2014-04-06 23:43:17


ps 
Level 61
Report
couple more bugs fixed, starting to climb through the ranks :) Hope to reach you guys within a couple of days. Won't have much time to implement anything new during this week though, but hopefully will have some time again during next week to debug a few more issues and implement some more advanced tactics :) Not that i ever got any mail back from dead piggy, that useless scoundrel, but i still have quite a few ideas of my own left to implement and hedja's tips to go over.
WarLight AI Challenge: 2014-04-06 23:45:24


ps 
Level 61
Report
Weird that it's mostly warlight folks on top positions, was expecting a little more from random computer science university students, but seems they all suck or didn't bother taking it seriously.
WarLight AI Challenge: 2014-04-07 00:15:29

RvW 
Level 54
Report
125ch209 wrote:
it says "exported with compile warnings"

That means "the code you wrote is technically valid, but are you sure it's correct, it looks rather suspicious". This could be if statements which are never executed ( "if 0 == 1" for instance; in a real case, it will probably not be so obvious the condition is always false (or always true!)), loops which never get executed ( "while 1 < 0" for instance; also in this case the example is intended to be obvious, in practice the concept will be the same, but the actual code more complex), functions which never get called, and a gazillion other things.

Note that not all warnings are in fact errors! Especially (utility) functions you used in a previous version, don't use in the current version, but want to keep around for future versions can trigger a warning. Likewise, some debugging techniques can lead to code which the compiler will give warnings over, but which you should not fix. However, in general it is a good idea to either fix warnings, or explain to yourself why a particular warning is okay.

(Apologies for the less-than-detailed examples; I'm not a Java programmer myself.)
WarLight AI Challenge: 2014-04-07 16:26:33

{rp} pedrito 
Level 48
Report
Just wondering...How many hours have you guys put into your bots on average?

Me probably some 50 or more, but it's my first time writing PHP so it's a bit of a learning experience. Enjoying every bit of it too.
WarLight AI Challenge: 2014-04-07 22:25:14


125ch209 
Level 58
Report
i've probably spend more than 50h too, and i spent at least 20hours reading about Java before i even started programming the bot. I found out yesterday that if i was writing my bot as a project, oracles would points out automatically my syntax errors...lol (so i found out about the compile warnings, wich were some imported packages that were never used)

I have a question for you guys, how do you print out the values of an arraylist?

for example, i have an arraylist of regions, and i want to print their id. i tried:

for (Region region : arrayListOfRegions){
System.out.println(region.getId());
}

but it doesn't work. any thought?

Edited 2014-04-07 22:28:12
WarLight AI Challenge: 2014-04-08 06:42:14


Norman 
Level 59
Report
@125ch209:
Change
System.out.println(region.getId());
to
System.err.println(region.getId());

System.out will break your code since then the result is written to the same stream to which your bot sends his moves.

@predito:
50 hours would mean about 3.5 hours per day for me. Don't think it took me that long.

During the first weak of coding I wrote some dirty code making my bot perform his moves.

Since then I didn't make my bot (visibly) act much smarter but I added quite complex functionality to make my bot understand what is going on on the board (what SuperRegions does opponent have?, is game in stalemate, won, lost, ,...?, where will opponent deploy?).

Next step is to rewrite the dirty code making my bot move so that he uses his model of what is going on on the board to perform some smart moves.
WarLight AI Challenge: 2014-04-08 11:10:58


ps 
Level 61
Report
i think i invested around 20 hours so far.
WarLight AI Challenge: 2014-04-08 16:25:20


125ch209 
Level 58
Report
Awesome, thanks Norman!
WarLight AI Challenge: 2014-04-09 04:02:17

{rp} pedrito 
Level 48
Report
To be honest, half of the time is spent watching the bot play... :)

I hope Fizzer incorporates one of these bots into Warlight at some point. I'm quite sure any of the top 10 beats the good old standard AI hands down. I would take a little rewriting to adapt it to teamgames and more varied maps, but definitely worth the trouble.
WarLight AI Challenge: 2014-04-09 20:19:18

RvW 
Level 54
Report
I'm not sure it's that easy pedrito. If you look at Norman's post (http://warlight.net/Forum/Thread?ThreadID=34646&Offset=116) it tries to work out what's going on behind the fog. That becomes much harder (and not anywhere nearly as reliable) as soon as there are more than two players. For instance, if you deduce (in the AI Challenge) that the opponent has Asia, from that point forward you know it has, and will keep, Asia..., until you break it. That logic already goes entirely out the window in a 1vs1vs1, and those aren't even the most complex games you can run on WL.

There are countless other problems: using (at least) reinforcement cards; cooperating with team mates (including sometimes using "attack team mate" to complete a bonus); dealing with wastelands (either existing from the start, created by cards or due to a booted or surrendered player turning Neutral); etc; etc; etc.

And that's only the problems I see no easy solutions for. Depending on how a bot is written (how deeply some assumptions are embedded into the core of the logic), even giving it support for something as simple as non-standard kill rates could require a serious amount of work.



I agree it would be cool if Fizzer, when he has time to work on "AI 2.0", could take a look at these bots and see if there are ideas worth using. But transplanting a bot from the AI Challenge straight into WL does not seem like a workable idea to me.

Unless an option is added to choose between different AIs. In that case it might be possible to add (some of) these AIs and only make them selectable in games with rules suitable for them (only 1vs1, for instance).
WarLight AI Challenge: 2014-04-10 00:17:39

{rp} pedrito 
Level 48
Report
Completely agree with your post RvW. Coding a bot that takes into account all of the customization options is a huge task for sure. As you said though, an option to choose a different AI whenever the custom settings allow it would solve this problem.

As for the more advanced stuff like "bonus guessing" or "deployment prediction": don't need it. I could rip all of that code out of my bot and it would not lose a great deal of positions on the leaderbord. Before my bot started guessing how many armies an enemy would deploy, he was just assuming the enemy would always deploy its maximum amount. And it worked pretty well.

The questions is:
How much coding is needed to get my current bot to perform decently in a Europe 3 vs 3, for instance?
I don't know, but probably less that what I've done so far for the challenge, and certainly less hours than many of the user created maps on WL.

I'd do it for free too.

But in the end it's up to Fizzer. I do completely understand that AI is not a great priority for WL, because playing with people is the idea. Sometimes though, when playing a teamgame and someone gets booted or loses connection just when things are heating up, it's a shame to scrap a game just because the current AI _always_ attacks neutrals before enemies, doesn't defend, makes suicide attacks, etc... All of them pretty simple issues really.
WarLight AI Challenge: 2014-04-10 20:35:23

RvW 
Level 54
Report
I think the strength of the AI might be by design. Unless somebody really doesn't get this game at all, just about any human player should still outperform the AI. In team games, that means everybody should prefer their human team members to keep playing, over booting them (and turning them into an AI). If beginning players were regularly booted so a (stronger) AI could take over... that would not be very motivating.

How about you first finish the AI Challenge and then we can brainstorm about how to make WL itself benefit from your results later? :)
WarLight AI Challenge: 2014-04-10 21:14:26


Ⓖ. Ⓐrun 
Level 57
Report
If beginning players were regularly booted so a (stronger) AI could take over... that would not be very motivating.


Very good point. The AI should (to some extent) be poor at WL because it is only generally used when players are booted (it should be a penalty to that player to have a crappy replacement). If a stronger bot was made, it should only be for Single Player IMO.
WarLight AI Challenge: 2014-04-10 22:22:48


Wenyun 
Level 60
Report
because it is only generally used when players are booted (it should be a penalty to that player to have a crappy replacement).

EDIT: Well, you don't have to make the bots perfect.

In teams; a crappy AI bot is a disadvantage to the team - in FFA's, a crappy AI bot is an advantage to those near.

It would be best for the game creator to decide what kind of AI they would want (but make it a high-level unlock). The default should be the crappy/current AI, though, so that beginners/low levels will have an easier time sliding in.

Edited 2014-04-10 22:24:08
Posts 117 - 136 of 565   <<Prev   1  2  3  4  5  6  7  ...  17  ...  28  29  Next >>