Codename: Gamma

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

Moderator: Defcon moderators

User avatar
trickser
level5
level5
Posts: 1823
Joined: Thu Mar 06, 2008 2:15 pm
Location: The Senate ; GMT+1
Contact:

Postby trickser » Tue Jun 29, 2010 12:08 am

Somebody mentioned somewhere: the nuke damage is also done by chance. In the middle its 100% chance for damage, becoming lower at the outside. I hardly noticed this in game, I guess the zone where it goes from 0% to 95% (or so) must be pretty small.

Dunno if this is actually right.
User avatar
Ace Rimmer
level5
level5
Posts: 10803
Joined: Thu Dec 07, 2006 9:46 pm
Location: The Multiverse

Postby Ace Rimmer » Tue Jun 29, 2010 3:41 pm

Interesting. The API quickstart guide doesn't mention nukes in it's chart of attacker/target %'s.

Speaking of silos, I'm trying to wrap my head around some kind of way to perfectly sync every volley of nukes silos launch, and just can't seem to make any progress.

Currently, my code maps out nearly every possible 'safe' position to place something. Safe meaning not too close to a city. Next, it pseudo-randomly places a single silo and then clusters the rest around that silo starting with a tight ring and fanning out till all silos are placed. This seems to give a good cluster at a decent speed (1.2~1.5 on the clock at 20x) and in a good enough variation that nobody can easily predict silo placement. I.e. it does a fairly decent job simulating human placement. In addition, it will work with totally random cities (even 50).

The problem lies with isolating the silo furthest away from Target1, firing only one nuke, and then linking all the rest of the silos to that nuke and its Target1 (each next silo firing at the appropriate time). Repeat for Target2 (and the first firing silo may not be the same).

I have a master table of all units and can (thanks to Montyphy and Martin) grab all units of a type and team (all my silos) and I also have a master table of all cites (again can filter), but can't seem to link the two. Edit: I can fire my silos and tell them to target the same cities, but can't stagger the launch (fire in proper sequence).

In short:
Image

Imagine I want to hit the three circled cities and have all six silos land their nukes at the exact same time on each city. For New York, I would start with the silos on the left and fire in sequence to the right. I would do the opposite for San Francisco (fire from right to left). For Houston (?), I would fire from top to bottom.

And yes, the bot did place the silos above. I've abandoned perfectly stacked double row placement as dynamically synced launching will make that unnecessary.
User avatar
tllotpfkamvpe
level5
level5
Posts: 1768
Joined: Fri Aug 31, 2007 12:04 am
Contact:

Postby tllotpfkamvpe » Tue Jun 29, 2010 5:27 pm

I can't offer any code but this is the way I see the answer:

First you need the flight time from each silo to target. for the targets you've higlighted its a very short distance so you could probably go with the twice bomber speed rule. Ie nukes will take half the time it would take a bomber to travel from the silo coordiante, in a straight line, to the city coordiante. Using the x,Y coordiantes and some pythag work out the distance from the silo to target then work out the nuke flight time. If you wanted a longer range launch you can't use the twice bomber speed for nuke speed because that won't be accurate enough. I would instead use the quadratic or cubic formula knocking around somewhere on the forum.

http://img341.imageshack.us/img341/5411/silos.png

Second arrange all the flight times in decreasing order. For example 40,37,37,35,32,30. Then fire the first one, next two 3 seconds later, fourth after 2 more seconds etc.
Last edited by tllotpfkamvpe on Wed Jun 30, 2010 8:09 am, edited 1 time in total.
User avatar
martin
level5
level5
Posts: 3210
Joined: Fri Nov 19, 2004 8:37 pm
Location: ::1
Contact:

Postby martin » Tue Jun 29, 2010 6:43 pm

tllotpfkamvpe has the basic idea. I'd extend it a little further to plot a firing timetable. You want to work out the optimal way to pack your launch orders so nukes from silos land at all your targets as clsoe to simultaneously as possible.

Once you have a basic system worked out firing at a single target, try taking a look at something like topological sorting for working out a firing timetable.
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
trickser
level5
level5
Posts: 1823
Joined: Thu Mar 06, 2008 2:15 pm
Location: The Senate ; GMT+1
Contact:

Postby trickser » Tue Jun 29, 2010 6:49 pm

Maybe you have troubles with the ready-to-fire timer. If you target NY 1st and Housten (NewOrelans?) 2nd you would start both times with the top left silo. For Housten the second silo is the top right silo, but if you fire the top left, just when its ready, the top right will still be in countdown mode.

I hope you get what I mean. (should make myself more clear with a picture)

Simple solution wait for all silos to be ready.
Better solution

turn your list of sorted flight-times

Code: Select all

40,37,37,35,32,30


into flight-time differences relative to the farest silo)

Code: Select all

0,-3,-3,-5,-8,-10


and add the actual timer value to it

Code: Select all

90,100,85,105,105,95 ->
90,97,82,100,97,85


Do this until all values are zero or below, then start your firing sequence, using the relative flight times as start-time offsets.
User avatar
Ace Rimmer
level5
level5
Posts: 10803
Joined: Thu Dec 07, 2006 9:46 pm
Location: The Multiverse

Postby Ace Rimmer » Tue Jun 29, 2010 10:44 pm

trickser wrote:...Simple solution wait for all silos to be ready.
Better solution...

I actually do understand what you mean because for now my solution (still trying to get the sequence bit to work, but thinking ahead) is to wait for all silos to become ready again (all state timers at zero).

I'm not sure I can get into the complicated suggestions above, but I'm working on it.

Edit: still working on this, but it appears that nukes start off at some variable less than 0.1 (e.g. 0.05) and slow down, come nearly to a stop, then speed back up ending at some variable close to (in some cases) 0.1959 (carried to 14 digits). The quick start guide states a nuke speed is 0.2.

These are the trajectories I checked: (though it wasn't a strict test of speed, so the above are lose figures)

Image

On a side note, it appears the bot has a potential for some interesting 'art'.
Smoke me a kipper, I'll be back for breakfast...
User avatar
trickser
level5
level5
Posts: 1823
Joined: Thu Mar 06, 2008 2:15 pm
Location: The Senate ; GMT+1
Contact:

Postby trickser » Thu Jul 01, 2010 1:23 am

Ace Rimmer wrote:On a side note, it appears the bot has a potential for some interesting 'art'.


Image
Yes, its great how easy you can visualize code. This is my attempt for a silo placement algorithm.
User avatar
Ace Rimmer
level5
level5
Posts: 10803
Joined: Thu Dec 07, 2006 9:46 pm
Location: The Multiverse

Postby Ace Rimmer » Thu Jul 01, 2010 10:01 pm

Until I can prove my arrangement with actual combat, here is what I've settled on:

Image

  1. A number of hard-coded x,y coordinates are given, all based on 1v1 territory set-ups.
  2. Once the 1v1 situation is resolved (takes about one tick), the bot picks a coordinate randomly and then creates a circle of placement for Silo#1.
  3. The radius is set to 3.6.
  4. The bot marks the radius with a circle.
  5. The bot randomly picks a new x,y coordinate within this radius that is less than 2.5 from any given city (to stay out of the nuke blast radius). If the initial x,y are not valid or too close to a city, it begins randomly fanning out till it finds a 'safe' spot.
  6. The bot places Silo#1 here.
  7. The bot marks Silo#1 with an 'x'
  8. The bot creates a bounding box around the original hard-coded x,y and scans the entire box for new 'safe' and valid placement locations. (temp table)
  9. The bot marks the bounding box.
  10. The bot scans the table and tries to place each subsequent silo as close as possible to Silo#1, fanning outward until all six are placed.


This seems to provide a decent variety of tightly clustered silo configurations (avoiding predictability) as well as compensates for any city layout. I've tested it against 50 cities (max) with Totally Random through Equalized populations at 200 (max). The pic above was taken before I tightened up some of the numbers to group them as close as possible.

Also, you might notice the initial silo is outside the original radius set; this is due to the extra randomizing (if the initial point is 'bad') vs a straightforward 'fan out' or 'circle around' method. I don't want the bot to place the same way every time.

Now I can fully concentrate on timing of the launches, at least until somebody joins and shows my placement code to be non-working. I have a good method of changing the state of all silos and launching only one (others wait), but can't seem to figure out how to jump start Silo#2. If I can do that, the code to rotate through the rest and restart the sequence is there. Currently, I'm trying to base Silo#2 firing on two things:

1. Distance between ICMB#1 and target#1: ND
2. Distance between Silo#2 and target#1: SD

(when SD <= ND, fire #2, repeat for Silo#3, etc)

I'm assuming if I can work this out it will be a good place to either start working out a more sound method, or stopping. I'm hoping distance will be good enough and I can ignore estimated flight times.
GreenTom
level0
Posts: 1
Joined: Sat Jul 17, 2010 1:55 am

Timing launches

Postby GreenTom » Sat Jul 17, 2010 2:07 am

Hi all,

New here, very much enjoying the bot writing conversation, wanted to see if this old fogey ex-programmer can be any help...

To the problem a few posts back, on how to synch the launches so they all hit at the same time, have you thought about something like this:

PlanLaunches
max_flight_time = 0
for each silo
Range = GetDistance(silio[i], silos_target[i]);
silo_flight_time[i] = GetFlightTime (Range) // For starters, just dummy this function as Range * 2, later on refine it
if (silo_flight_time[i] > max_flight_time) then max_flight_time = silo_flight_time[i]
next silo

impact_time = now + max_flight_time + 2 // add two so we don't start firing before the next tick, which is at most 2 seconds away

for each silo
silo_launch_time[i] = impact_time - silo_flight_time[i]
next silo
done PlanLaunches

On each tick:
for each silo
if haven't fired already and now >= silo_launch_time[i] then launch
next silo


Pardon my free verse psudeo code--does the idea make sense? Basicly, the longest flight time sets your impact time, then delay all the shorter flight times so they hit at that moment.
User avatar
xander
level5
level5
Posts: 16866
Joined: Thu Oct 21, 2004 11:41 pm
Location: Riverside, CA, USA
Contact:

Re: Timing launches

Postby xander » Sat Jul 17, 2010 3:44 am

GreenTom wrote:PlanLaunches
max_flight_time = 0
for each silo
Range = GetDistance(silio[i], silos_target[i]);
silo_flight_time[i] = GetFlightTime (Range) // For starters, just dummy this function as Range * 2, later on refine it
if (silo_flight_time[i] > max_flight_time) then max_flight_time = silo_flight_time[i]
next silo

That was, basically, what I suggested. The problem is that flight times are non-linearly related to distance between the silo and the target. Thus the code that you suggest doesn't solve the real problem which is calculating the flight time (assuming that I am understanding what Ace has written). It seems that you implicitly acknowledge this problem, as well, given the dummy GetFlightTime() function.

xander
User avatar
martin
level5
level5
Posts: 3210
Joined: Fri Nov 19, 2004 8:37 pm
Location: ::1
Contact:

Postby martin » Tue Jan 18, 2011 4:19 pm

So..... any chance of Gamma coming back to life? ;)
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
Ace Rimmer
level5
level5
Posts: 10803
Joined: Thu Dec 07, 2006 9:46 pm
Location: The Multiverse

Postby Ace Rimmer » Tue Jan 25, 2011 4:12 pm

Yes, yes there is. The reason it's gone quiet is due to the fact I can no longer put any effort into it while at work. It'll come back because I at least want to have a StarBot up, someday.
Smoke me a kipper, I'll be back for breakfast...

Return to “AI Bots”

Who is online

Users browsing this forum: No registered users and 1 guest