New Bot: Defender

AI discussion, ideas, and SDK help.
User avatar
SunTzu
Lux Cartographer
Posts: 1586
Joined: Sat Jan 14, 2006 1:48 am
Location: Maryland

New Bot: Defender

Post by SunTzu » Tue Jul 24, 2007 6:45 pm

Defender

Image

Defender was specifically designed for starting scenarios. He will not try to win the game, but he will work hard to protect the countries he was assigned at the beginning of the game.

http://sillysoft.net/wiki/?Defender

Please let me know what you think, and if you have any suggestions for improvement, let me know!

User avatar
moe
fnnnarrrr
Posts: 1316
Joined: Wed Nov 17, 2004 3:53 pm
Location: passed out in a church parking lot
Contact:

Post by moe » Wed Jul 25, 2007 7:19 am

can't wait to use it.

kudos for the effort.

User avatar
guest
Luxer
Posts: 189
Joined: Fri Dec 17, 2004 9:17 pm
Location: Southern NH

Post by guest » Wed Jul 25, 2007 11:38 am

I'm guessing he tries to retake lost territory?

User avatar
SunTzu
Lux Cartographer
Posts: 1586
Joined: Sat Jan 14, 2006 1:48 am
Location: Maryland

Post by SunTzu » Wed Jul 25, 2007 11:54 am

guest wrote:I'm guessing he tries to retake lost territory?
Yes. Even if the lost territory is at the other side of the map, Defender will try to find the best path to it and re-conquer it's territory.

User avatar
my wife hates me
Lux Elder
Posts: 2664
Joined: Fri Sep 22, 2006 4:45 am
Location: I TOOK MY BED BACK
Contact:

Post by my wife hates me » Wed Jul 25, 2007 4:18 pm

Awesome that you got through your project. Can't wait to see how he plays.

User avatar
dustin
Lux Creator
Lux Creator
Posts: 10998
Joined: Thu May 15, 2003 2:01 am
Location: Cascadia
Contact:

Post by dustin » Wed Jul 25, 2007 5:25 pm

Defender is in the plugin manager, so you can all install him and try him out right now...

User avatar
Bertrand
Reaper Creator
Posts: 568
Joined: Mon Nov 28, 2005 4:35 pm
Location: Montreal

Post by Bertrand » Wed Jul 25, 2007 5:59 pm

You did that pretty quickly for someone with no prior java knowledge. Good show. I hope that you enjoyed the experience.

I confess I never have tried scenarios. Can you suggest a good one to try out your creation?

User avatar
SunTzu
Lux Cartographer
Posts: 1586
Joined: Sat Jan 14, 2006 1:48 am
Location: Maryland

Post by SunTzu » Wed Jul 25, 2007 9:42 pm

Well, I had to teach myself JavaScript earlier this year, so I was somewhat familiar with programming basics.

I definitely enjoyed the experience, and I'm looking forward to making a bot that will try to win, but for now I have a long list of maps I need to make...

As far as which starting scenarios to try Defender with, I would recommend Cube Wars, Anglo-Celtic Isles, and definitely The Dark Ages. I usually play with 5 bots: Reaper, BotOfDoom, Sparrow, Killbot, and Defender.

One reason I came up with Defender is to use him in map scenarios as a "Switzerland" player. They're neutral, but you still have the option to take over the land if it fits your strategic goals.

User avatar
Drifter
Semiholy Rambler
Posts: 6770
Joined: Sun Nov 20, 2005 5:06 pm
Location: An undisclosed location... for reasons of security, and therefore... insecurity...
Contact:

Post by Drifter » Wed Jul 25, 2007 10:09 pm

Well done SunTzu, I am very impressed. MB should be very thankful to you for bringing a bot creator into the pickle cult. I am curious to see how Defender plays in a non scenario game.

User avatar
dustin
Lux Creator
Lux Creator
Posts: 10998
Joined: Thu May 15, 2003 2:01 am
Location: Cascadia
Contact:

Post by dustin » Thu Jul 26, 2007 3:43 am

random start 5,5,5 classic (or duex) games played against 5 defenders is an interesting exercise.

:smt105

User avatar
Blind Willie
Lux Veteran
Posts: 1144
Joined: Fri May 20, 2005 3:06 am
Location: Satellite of Love

Post by Blind Willie » Thu Jul 26, 2007 2:55 pm

dustin wrote:random start 5,5,5 classic (or duex) games played against 5 defenders is an interesting exercise.
I was wondering if anyone else tried that. That was the first setup I used when I downloaded Defender. Now I want those 30 minutes of my life back.
:lol:


Anyway, great bot Sun. It definitely makes scenarios more interesting, and it also works quite well on maps without continents like Chess.

Thanks for another cool contribution to Lux.

:smt023

User avatar
SunTzu
Lux Cartographer
Posts: 1586
Joined: Sat Jan 14, 2006 1:48 am
Location: Maryland

Post by SunTzu » Wed Aug 01, 2007 11:10 pm

Here's a quick question...

Should I make Defender try to win the game if he gets an enormous advantage?

User avatar
dustin
Lux Creator
Lux Creator
Posts: 10998
Joined: Thu May 15, 2003 2:01 am
Location: Cascadia
Contact:

Post by dustin » Thu Aug 02, 2007 12:12 am

Yes. If you want a really easy way to do it, look at the attackHogWild() method in SmartAgentBase.

User avatar
newbeslaya
Slayer of Newbs
Posts: 190
Joined: Fri Oct 06, 2006 5:59 pm
Location: California

Post by newbeslaya » Fri Aug 10, 2007 10:46 pm

I played with a few defenders and I felt the game was a bit too simple.... Once you get any bonus, the defenders are useless because they cant keep up with the amount of men you have. Just a thought... :?:

User avatar
SunTzu
Lux Cartographer
Posts: 1586
Joined: Sat Jan 14, 2006 1:48 am
Location: Maryland

Post by SunTzu » Mon Aug 13, 2007 11:59 am

newbeslaya wrote:I played with a few defenders and I felt the game was a bit too simple.... Once you get any bonus, the defenders are useless because they cant keep up with the amount of men you have. Just a thought... :?:
Just so you know, Defender doesn't try to win the game, he just tries to protect it's own territories.

I'll be updating Defender soon so that it tries to win the game if it gets a huge advantage, but it still won't actively try to win the game like a normal bot.

User avatar
Black Pope
Lux Exorcist
Posts: 3878
Joined: Tue Sep 06, 2005 5:36 pm
Location: God's Right Hand

Post by Black Pope » Mon Aug 13, 2007 12:07 pm

The interesting thing for me when playing against a defender bot is that if he gets a good start, he can really make things difficult. I played a classic game where he started with oz; he would rack up armies and charge to win back territories in NA that he lost; it really was fun.
In my mind, you've created a really fun, unique bot. My only suggestion is the same as the others; if you can and want, if you convinced the bot to go for and hold a continent, he can really make things difficult for others attempting to hold a continent where he had a previous territory.
Thanks for all you do, man...you rock.

User avatar
RandomGuy
Lux Veteran
Posts: 1463
Joined: Mon Mar 05, 2007 12:02 am
Location: Central American Jungle
Contact:

Post by RandomGuy » Fri Aug 17, 2007 9:59 am

FYI: I think Defender is getting tripped up by one-way connections.

I got the following error when someone took one of his countries, but he couldn't get back to it directly:

oops. Defender called attack() with two countries that don't touch.
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Unknown Source)
at com.sillysoft.lux.B.A(Unknown Source)
at com.sillysoft.lux.Board.attack(Unknown Source)
at com.sillysoft.lux.Board.attack(Unknown Source)
at com.sillysoft.lux.agent.Defender.safeAttack(Defender.java:964)
at com.sillysoft.lux.agent.Defender.attackWeakestTarget(Defender.java:898)
at com.sillysoft.lux.agent.Defender.attackPhase(Defender.java:261)
at com.sillysoft.lux.B.Z(Unknown Source)
at com.sillysoft.lux.B.P(Unknown Source)
at com.sillysoft.lux.B.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

User avatar
SunTzu
Lux Cartographer
Posts: 1586
Joined: Sat Jan 14, 2006 1:48 am
Location: Maryland

Post by SunTzu » Fri Aug 17, 2007 10:50 am

Thanks for the tip RD... is there any way you could let me know the specifics of what was happening at the time?

I though I had one-way connections taken care of, but there may be instances I've missed.

FYI, there's also a bug whenever there's only one continent on the map.

I'm almost finished coding a new set of general methods that I can use for any bots I eventually make. I'll soon be rebuilding Defender from scratch using these new methods.

User avatar
RandomGuy
Lux Veteran
Posts: 1463
Joined: Mon Mar 05, 2007 12:02 am
Location: Central American Jungle
Contact:

Post by RandomGuy » Fri Aug 17, 2007 11:29 am

I was playing djdee's organ grinder map, which has a series of one way connections through the "heart". 1 -> 2 -> 3 -> 4. Where many points on the map connect to 1, and 4 connects to many others while through the middle it is one way.

In the starting scenario, I think Defender started with 4 - but that got taken by the person in 3. And he got stuck spinning his wheels trying to figure out (I presume) how to take 4 back...considering he had to go through 1, 2 and 3 which he never owned.

Hope that helps.

User avatar
newbeslaya
Slayer of Newbs
Posts: 190
Joined: Fri Oct 06, 2006 5:59 pm
Location: California

Post by newbeslaya » Fri Aug 17, 2007 5:02 pm

I think the bot would be even better if it was made to take a continent and then play its defender game :smt102 Just a thought

User avatar
SunTzu
Lux Cartographer
Posts: 1586
Joined: Sat Jan 14, 2006 1:48 am
Location: Maryland

Post by SunTzu » Fri Aug 17, 2007 5:45 pm

newbeslaya, I know you're trying to suggest ways that Defender could be stronger, but this bot was built starting scenarios (where it most likely already has continents) and not regular play.

I'm in the process of making maps that will use Defender's special attributes... 8)

User avatar
Cuarto
Lux Wunderkind
Posts: 706
Joined: Fri Jun 01, 2007 10:21 am
Location: Alabama
Contact:

Post by Cuarto » Fri Aug 17, 2007 6:20 pm

newb, this way you don't have a bot that [img]thinks[/img] it is doing something strategical by popping that continent you worked so hard to get.

User avatar
newbeslaya
Slayer of Newbs
Posts: 190
Joined: Fri Oct 06, 2006 5:59 pm
Location: California

Post by newbeslaya » Fri Aug 17, 2007 6:48 pm

Well it could easily spice up the game :lol:

User avatar
Cuarto
Lux Wunderkind
Posts: 706
Joined: Fri Jun 01, 2007 10:21 am
Location: Alabama
Contact:

Post by Cuarto » Fri Aug 17, 2007 8:24 pm

i guess your one of those people who laughs when they gets hit instead of crying

User avatar
newbeslaya
Slayer of Newbs
Posts: 190
Joined: Fri Oct 06, 2006 5:59 pm
Location: California

Post by newbeslaya » Fri Aug 17, 2007 8:29 pm

:smt021 Newbeslaya bashes Cuarto's head

User avatar
enjoymoreradio
Lux Addict
Posts: 552
Joined: Mon Apr 30, 2007 5:47 pm
Location: Walking uphill both ways in the snow

Post by enjoymoreradio » Sat Aug 25, 2007 11:50 am

How enormous is "enormous?" I only ask, because I've got a map in the conception stages that will make extensive use of Defender and he will be fairly powerful as a player and I don't want him to go on a rampage and kill everything on his first turn.

emr

User avatar
SunTzu
Lux Cartographer
Posts: 1586
Joined: Sat Jan 14, 2006 1:48 am
Location: Maryland

Post by SunTzu » Sat Aug 25, 2007 1:02 pm

enjoymoreradio wrote:How enormous is "enormous?"
If he has enough armies on his borders to be 99% sure that he can conquer the rest of the map, he will do so in the next version.

Off the top of my head, I think a simple approximation would be about 2-3 times the number of enemy armies on the board.

For testing purposes, I can email you a beta version of the next Defender.
enjoymoreradio wrote:I've got a map in the conception stages that will make extensive use of Defender and he will be fairly powerful as a player and I don't want him to go on a rampage and kill everything on his first turn.
You could always split up Defender into two players if you don't want Defender to go berserk.

User avatar
enjoymoreradio
Lux Addict
Posts: 552
Joined: Mon Apr 30, 2007 5:47 pm
Location: Walking uphill both ways in the snow

Post by enjoymoreradio » Sat Aug 25, 2007 11:36 pm

Well, I'd do that but Defender needs a steady stream of income to function the way I want him to.

(Ultimately, the best thing for the map would be a kind of Empty/Defender hybrid, that acted like Empty when it controlled its allotment of countries, but like Defender when it needed to reconquer something.)

User avatar
SunTzu
Lux Cartographer
Posts: 1586
Joined: Sat Jan 14, 2006 1:48 am
Location: Maryland

Post by SunTzu » Mon Aug 27, 2007 11:13 am

Check out this feature request! A new Defender feature is in the works...


FYI - Since some starting scenarios will give Defender such a huge advantage , I'm going to make it an option for players as to whether Defender will try to win the game or not.

User avatar
SunTzu
Lux Cartographer
Posts: 1586
Joined: Sat Jan 14, 2006 1:48 am
Location: Maryland

Post by SunTzu » Wed Oct 03, 2007 11:05 am

Defender has been updated!

Defender now has several default preferences you can set by editing Defender.txt in a text editor, which is located in the Lux/Support/Agents/ folder. The options are:
  • winGame = true or false - Determines whether Defender will try to win the game if he gets an enormous advantage.
  • popContinents = true or false - Determines whether Defender will try to pop continents.
  • killForCards = true or false - Determines whether Defender will try to kill players for cards.
  • farmForCards = true or false - Determines whether Defender will try to farm easy countries for cards.
  • chat% = 0-100 - Determines the percentage of Defender's turns that he will chat.
The options for Defender can also be changed via the chat box, but they will revert back to the default settings found in Defender.txt every time a new game is started.

Typing 'Defender help' will bring up the following help screen:

Code: Select all

 Type the following commands in the chat box to change how Defender will play this game.
 The default settings can be set in Defender.txt, located in the Lux > Support > Agents folder.

   Defender help  	-->  This message will appear in the chat
   Defender status	-->  View the current Defender settings
   Defender reset 	-->  Reset all options to defaults
   Defender win   	-->  Defender will try to win the game
   Defender nowin 	-->  Defender will not try to win the game
   Defender pop   	-->  Defender will pop continents
   Defender nopop 	-->  Defender will not pop continents
   Defender kill     	-->  Defender will kill players for cards
   Defender nokill	-->  Defender will not kill players for cards
   Defender farm  	-->  Defender will farm for cards
   Defender nofarm	-->  Defender will not farm for cards
   Defender chat  	-->  Defender will chat
   Defender nochat	-->  Defender will not chat

Post Reply

Who is online

Users browsing this forum: No registered users and 46 guests