Joshua

Come in here to talk about your sky-net style world-destroying super bots!

Moderator: Defcon moderators

User avatar
Ace Rimmer
level5
level5
Posts: 10803
Joined: Thu Dec 07, 2006 9:46 pm
Location: The Multiverse

Postby Ace Rimmer » Mon Feb 22, 2010 8:59 pm

I've put some thought into it, but you're right, wrapping my head around even simple combat is difficult, at best.

My first thought was have the bot constantly keep track of what units it's come into contact with, but that raised the issue of how to remove from the lists units that it killed. I am stuck there.

My second thought was to have naval units stay just outside or just inside (depending on the units themselves) enemy naval radar range and fight. So, a constant dance.

Example: (false values)

Radar for carrier = 20
Radar for BB's = 15

With combined fleets (CV's, BB's) have the fleet line up (perhaps multiple lines) in perfect formation at 19.9 (just inside the range) and get bombers to run parallel to the forward line or just inside the max firing range.

With only BB's, have the fleet at a constant 14.9 distance from the enemy ships.

The closest enemy ship that is visible would be the target distance calculator, when it dies, move closer till contact. Of course, there'd be something to account for naval nuking (avoidance code) and then re-form the line quickly.

I also plan to have something to take into consideration the total number of nukes and when it + number of ships (mine, theirs) + scores reaches a certain point, move back to the coast for defense or if the score difference is high enough be aggressive and go kill the enemy to end the game.
Smoke me a kipper, I'll be back for breakfast...
User avatar
martin
level5
level5
Posts: 3210
Joined: Fri Nov 19, 2004 8:37 pm
Location: ::1
Contact:

Postby martin » Mon Feb 22, 2010 9:24 pm

Regarding sharing code, you can find mine on google code in an svn:

http://code.google.com/p/joshua-bot/

Anyone can download that, at the moment I'm not going to accept other contributors.

Regarding order of development, at the moment I'm laying out an architecture for the bot, I got the style of development pretty much wrapped up today, I just need to rewrite a few little bots more (it's mostly done).

I'm working in a pseduo OOP fashion using the tables as prototype objects (ok, rereading this post, I guess that doesn't make sense to anyone else, but dammit that's what google is for!). After this I'm going to have a look at placement, I'm going to do some research on metaballs, as I think I can come up with an interesting algorithm for placement based on them (the outcome of the algorithm would probably naturally be a circle shape, which I understand is a pretty good shape for silos). Once placement is done, I'm going to work on civil air patrols, and trying to design a system for tracking incoming shots and estimating unit positions - for example the CAP gets shot from the sea, so I reshape the patrol to avoid the danger zone, and send scouts to investigate. Once this code is done I can apply exactly the same code to Naval air patrols guarding fleets at sea (yay for reusable code ;) )
GENERATION 22:The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment.
User avatar
roflamingo
level3
level3
Posts: 404
Joined: Fri Jan 19, 2007 10:25 am

Postby roflamingo » Mon Feb 22, 2010 9:28 pm

I've thought about that.... maybe later this week I can get to that.

Right now I'm trying to algorithmically find good places for forward radar. Silo-defense radar is relatively easy (just use my circle placement code to drop in some radar close to the silos and airbases).

Then comes intelligently placing subs (D5) and then ships (D4), just based on who the enemies are. Will have to do some ocean-finding there too.

I agree on combat part. Lots of checking, lots of target selection!!


In D3 and D2 - Optimally, I think the bot has as many units in the air (bombers and fighters) as possible...to use it's microing skills to put as much firepower against enemy units as possible.

Thoughts?

Just thinking out loud here for a Fighter Routine:

if mission is 'scout' and "enemies I want to shoot = 0"
do i have fuel?
if fuel = lots then
keep flying
else
land closest
end
else
mission = kill stuff
dont care about my fuel anymore
prioritize shooting
1. target enemy subs
2. target enemy bomberz
3. target enemy carrierz
4. target enemy battleshipz
5. target enemy fighters
end/end/end



Bomber Routine for D3 and D2 (argh)

If fuel < lots then
Land
else

Stay out of shooting range of Battleships and Silos (assuming we know where any truly are)
Target
1. Carriers
2. Battleships
User avatar
Ace Rimmer
level5
level5
Posts: 10803
Joined: Thu Dec 07, 2006 9:46 pm
Location: The Multiverse

Postby Ace Rimmer » Mon Feb 22, 2010 9:39 pm

Regarding using incoming shots, I think there's a potential flaw in that; you don't want to 'wait' till you get shot to 'do something'. Rather, you want to be the one shooting first.

Example scenario: enemy carrier come on the scene, but without planes. What do you do? No shots are fired.

Also, you two seem to be thinking too vaguely (maybe that's good, not convinced though).
User avatar
martin
level5
level5
Posts: 3210
Joined: Fri Nov 19, 2004 8:37 pm
Location: ::1
Contact:

Postby martin » Mon Feb 22, 2010 9:50 pm

I have 2 different kinds of patrols in the air Ace.

Civil Air Patrol
This is a ring of planes, assigned to defend certain areas from aerial attack, these planes will avoid incoming fire unless it's directed at their targets or directed at them quite close to a target. If, for example, part of the CAP wanders too near an enemy fleet it will avoid it, however then some

Offensive planes
Are launched (or more likely the CAP will be converted into an attack wing, and new planes will be launched to fill the gaps in the CAP), these planes head to the source of the attack and kill it. Enemy ships will be shot by bombers while fighters stay out of range, as soon as enemy bombers or fighters are sighted allied fighters will attack the enemy fighters.

As a response to being too reactive, possibly that's a flaw in the way _I_ play the game, but it's one Joshua will suffer from too (at least initially). Joshua is designed to play Survivor score mode, so defensive play is acceptable ;)
GENERATION 22:The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment.
User avatar
roflamingo
level3
level3
Posts: 404
Joined: Fri Jan 19, 2007 10:25 am

Postby roflamingo » Mon Feb 22, 2010 9:53 pm

Ace Rimmer wrote:Regarding using incoming shots, I think there's a potential flaw in that; you don't want to 'wait' till you get shot to 'do something'. Rather, you want to be the one shooting first.

Example scenario: enemy carrier come on the scene, but without planes. What do you do? No shots are fired.

Also, you two seem to be thinking too vaguely (maybe that's good, not convinced though).


It has to be mildly vague - the main reason being I don't know what it's doing yet, or if that code structure has any hope of working. In which way could it be more specific?
User avatar
roflamingo
level3
level3
Posts: 404
Joined: Fri Jan 19, 2007 10:25 am

Postby roflamingo » Mon Feb 22, 2010 10:00 pm

martin wrote:I have 2 different kinds of patrols in the air Ace.

Civil Air Patrol

Offensive planes



On 2nd though maybe it should be 3 different types of missions for fighters:
1. Scout/Patrol (return to a base/carrier)
2. Scout/Suicide (for when you need to explore - e.g you are Asia and are looking for Russian silos, you cant turn the planes around after flying 45%, or you will never find anything.
3. Shoot stuff we see, by priority.
User avatar
Ace Rimmer
level5
level5
Posts: 10803
Joined: Thu Dec 07, 2006 9:46 pm
Location: The Multiverse

Postby Ace Rimmer » Mon Feb 22, 2010 10:13 pm

I think the three options are better than two, although from looking at the original AI's (CPU) scouting methodology, it'd better be a 'smart' scout. That is, keep track of what's been scouted, what hasn't - all possible units, and be able to change course based on possible AA (don't scout East Coast USA (from under Mexico City) if AA comes from west coast, for example.

Also, what about instances where a bomber or fighter comes into view but it's on a landing mission, thus doesn't engage, or vice versa (your plane while landing passes by enemy)?

Edit: I bring this up because these are common flaws of human players that can be game changing, which the AI should be able to take advantage of. Call it a 'impossibility of distraction' code.

Edit2: Also, any time the Bot is scouting land and doesn't see all silos, it should also be triangulating them, which I believe is entirely possible based on OnEvent and the SourceID (gunshot) first seen and last seen location.
Last edited by Ace Rimmer on Mon Feb 22, 2010 10:30 pm, edited 2 times in total.
Smoke me a kipper, I'll be back for breakfast...
User avatar
roflamingo
level3
level3
Posts: 404
Joined: Fri Jan 19, 2007 10:25 am

Postby roflamingo » Mon Feb 22, 2010 10:26 pm

point well taken...and my head just assploded.
User avatar
martin
level5
level5
Posts: 3210
Joined: Fri Nov 19, 2004 8:37 pm
Location: ::1
Contact:

Postby martin » Mon Feb 22, 2010 10:44 pm

I do actually have a third class of planes for scouting enemy facilities, but I didn't write about that because it's nothing to do with combat :wink:

I think once I have some base placement code worked out, I shall just send all my planes on suicide mission into enemy territory, and work on triangulation.
GENERATION 22:The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment.
User avatar
roflamingo
level3
level3
Posts: 404
Joined: Fri Jan 19, 2007 10:25 am

Postby roflamingo » Mon Feb 22, 2010 10:49 pm

martin wrote:I do actually have a third class of planes for scouting enemy facilities, but I didn't write about that because it's nothing to do with combat :wink:

I think once I have some base placement code worked out, I shall just send all my planes on suicide mission into enemy territory, and work on triangulation.


I would love to see that.

You can use my placement code if you like, if you can backport from LUA to C++ :D
User avatar
Ace Rimmer
level5
level5
Posts: 10803
Joined: Thu Dec 07, 2006 9:46 pm
Location: The Multiverse

Postby Ace Rimmer » Mon Feb 22, 2010 10:58 pm

In what way will the suicide planes be bound to the scouting mission?

My original thoughts were to:
  1. Pick appropriate scouting point of origin (avoiding high risk areas)
  2. Make sure forward radar is removed before scouting party arrives (pre-scout)
  3. Move into location
  4. Determine bounds of territory
  5. Send in preliminary nukes, to distract AA
  6. Assign scouting routes, launch planes
    1. Keep track of 'outer edges of radar 'on the go'
    2. Adjust course to view non-scouted areas as needed
    3. Triangulate silo positions, if applicable
    4. Ready bomber wave, if able and area 'secure'
  7. Strike targets (cities and/or ground units)
User avatar
martin
level5
level5
Posts: 3210
Joined: Fri Nov 19, 2004 8:37 pm
Location: ::1
Contact:

Postby martin » Tue Feb 23, 2010 12:43 am

I haven't thought of a full strategy yet for Joshua, I don't play defcon very often, so I'm keeping the design flexible enough for me to watch Joshua play and improve him as I go.

Rough outline:

a) Civil air patrol intercepts incoming bombers and detects incoming fleets (acts like a radar extension)
b) Naval air patrol performs the same actions, but around my navy
c) Navy moves towards enemy shore, using Naval air patrol to detect and engage enemy fleets, battleships and subs engage, while carriers are preserved at all costs
d) Carriers move towards enemy coast, and sit just out of fighter detection range
e) Subs move in and sit right on the coast
f) Bomber wing is maintained over the carriers, just outside of enemy radar detection range, naval air patrol offers fighter cover
g) As soon as the enemy launches, subs surface and attack silos. First wave of bombers moves in on silos, as soon as a radar is detected it is shot at as a high priority target. Second wave of bombers moves in and hits airbases and radars (since silos have been launching for such a long time, radar and airbases now have a higher priority than silos). Carriers and subs begin moving back to home
h) Eventually, once we're sure the coast is clear (literally) silos go into launch mode, launching one by one, or in triplets, depending on how many enemy silos survived.

That's how *I* generally play a game of defcon, any criticisms?

@roflamingo I could convert Lua into C++, but Joshua is written in Lua...
GENERATION 22:The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment.
User avatar
roflamingo
level3
level3
Posts: 404
Joined: Fri Jan 19, 2007 10:25 am

Postby roflamingo » Tue Feb 23, 2010 1:42 am

martin wrote:but Joshua is written in Lua...


My bad, I misread. I thought you were in C++ and had abandoned LUA. Lack of sleep.
User avatar
martin
level5
level5
Posts: 3210
Joined: Fri Nov 19, 2004 8:37 pm
Location: ::1
Contact:

Postby martin » Tue Feb 23, 2010 12:18 pm

hehe, no worries, Joshua was originally written in C++, then I changed to Lua, then I decided to try and write a C++ bot which would interact with an AI module written in C#, then I decided I couldn't be bothered and that I'd just write it in Lua. I guess that could be a bit confusing ;)
GENERATION 22:The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment.

Return to “AI Bots”

Who is online

Users browsing this forum: No registered users and 1 guest