ROFLBot Progress
Moderator: Defcon moderators
- roflamingo
- level3
- Posts: 404
- Joined: Fri Jan 19, 2007 10:25 am
ROFLBot Progress
My code will never be as beautiful or fast as Martin's... and my strategy will never be as good as Ace's
Up to this point, the bot will:
Tick 1 - Defcon 5
1. [DONE] Enumerate important things (who am I , who are they)
2. [DONE] Determine where it wants to start placing ground units, based on what I consider to be the core ( the city that has the most close neighbors, unweighted by pop)
3. [DONE] Deploy 3-4 'forward radar' (= radars positioned to look at neighboring lands and oceans, not intended to be used in defense).
- The forward radar can be anywhere that is not within 1.8 units of a city.
- The code starts at the core city, jumps out 90 units, and starts coming back in 5 units at a time circularly. If it can place a radar, it does. The compass is divided into sectors depending on the # of forward radar chosen. Once a forward radar has been deployed into a sector (which will be either 72 or 90 degrees wide - either 5 or 4 forward radar), that 'sector' will not be reused. Thus forward radar is spread out properly in multiple directions.
4. [Not written yet] Deploying forward subs and sending on their way
5. [DONE] Deploying scout battleships and sending on their way to the best scouting position
Tick 1 - Defcon 4
1. [DONE]Start trying to place the silos.
- Start at the core and work way out. a position is valid if
a. there is no city within 1.8 units
b. enemy territory is not within 20 units
2. [DONE]Repeat process for airbases
3. [DONE]Repeat process for remaining radar (= defensive radar).
[ Note: these parts really suck if the bot is Europe with Africa and Russia as playing opponents ]
4. [Not written yet] Fleet placement
Screenshots:
I can post code if you guys want...or forget it if you are already way ahead!
Up to this point, the bot will:
Tick 1 - Defcon 5
1. [DONE] Enumerate important things (who am I , who are they)
2. [DONE] Determine where it wants to start placing ground units, based on what I consider to be the core ( the city that has the most close neighbors, unweighted by pop)
3. [DONE] Deploy 3-4 'forward radar' (= radars positioned to look at neighboring lands and oceans, not intended to be used in defense).
- The forward radar can be anywhere that is not within 1.8 units of a city.
- The code starts at the core city, jumps out 90 units, and starts coming back in 5 units at a time circularly. If it can place a radar, it does. The compass is divided into sectors depending on the # of forward radar chosen. Once a forward radar has been deployed into a sector (which will be either 72 or 90 degrees wide - either 5 or 4 forward radar), that 'sector' will not be reused. Thus forward radar is spread out properly in multiple directions.
4. [Not written yet] Deploying forward subs and sending on their way
5. [DONE] Deploying scout battleships and sending on their way to the best scouting position
Tick 1 - Defcon 4
1. [DONE]Start trying to place the silos.
- Start at the core and work way out. a position is valid if
a. there is no city within 1.8 units
b. enemy territory is not within 20 units
2. [DONE]Repeat process for airbases
3. [DONE]Repeat process for remaining radar (= defensive radar).
[ Note: these parts really suck if the bot is Europe with Africa and Russia as playing opponents ]
4. [Not written yet] Fleet placement
Screenshots:
I can post code if you guys want...or forget it if you are already way ahead!
Last edited by roflamingo on Fri Feb 26, 2010 10:22 pm, edited 2 times in total.
- roflamingo
- level3
- Posts: 404
- Joined: Fri Jan 19, 2007 10:25 am
- Ace Rimmer
- level5
- Posts: 10803
- Joined: Thu Dec 07, 2006 9:46 pm
- Location: The Multiverse
Code: Select all
Me = TeamIDMe
You = TeamIDYou
If IsValidTerritory(Me, x, y, isSeaAreaTrue) Then
If IsValidTerritory(You, x, y, isSeaAreaTrue) Then
SendChat("Is double Ocean)
else
SendChat("my prehchous!")
SendBotAction(Stroke Ring)
end
end
- roflamingo
- level3
- Posts: 404
- Joined: Fri Jan 19, 2007 10:25 am
That's the code to find out if a particular ocean piece is shared. I'm already using that and placing battleships there
I'm looking for a different kind of algorithm here. SA, NA, Asia, Africa, Russia all have 2 discontiguous ocean areas for placing fleets in.
Say you were SA vs. Russia and you were placing fleets - 2 separate oceans to start from and coasts to defend... and 2 separate starting points for launching an attack on Russia....
I'm looking for a different kind of algorithm here. SA, NA, Asia, Africa, Russia all have 2 discontiguous ocean areas for placing fleets in.
Say you were SA vs. Russia and you were placing fleets - 2 separate oceans to start from and coasts to defend... and 2 separate starting points for launching an attack on Russia....
- Ace Rimmer
- level5
- Posts: 10803
- Joined: Thu Dec 07, 2006 9:46 pm
- Location: The Multiverse
- roflamingo
- level3
- Posts: 404
- Joined: Fri Jan 19, 2007 10:25 am
I was thinking something like that. What do you think of this?
Start at an arbitrary point in your known ocean space. x1,x2. This is in ocean 1.
Now iterate through the rest of your points. (x2,y2....)
If a point is within an arbitrary distance then not a separate ocean (this avoids little bumps and nubs of land between 2 points)
If it's outside of the arbitrary distance then check the midpoint. If that midpoint is land then the 2nd point is in a differnt ocean.
Need to find formula for calculating midpoint of (x1,y1) and (x2,y2).... got 1 handy?!
nvm... should be x3,y3 = (x1+x2)/2, (y1+y2)/2
Start at an arbitrary point in your known ocean space. x1,x2. This is in ocean 1.
Now iterate through the rest of your points. (x2,y2....)
If a point is within an arbitrary distance then not a separate ocean (this avoids little bumps and nubs of land between 2 points)
If it's outside of the arbitrary distance then check the midpoint. If that midpoint is land then the 2nd point is in a differnt ocean.
Need to find formula for calculating midpoint of (x1,y1) and (x2,y2).... got 1 handy?!
nvm... should be x3,y3 = (x1+x2)/2, (y1+y2)/2
- Ace Rimmer
- level5
- Posts: 10803
- Joined: Thu Dec 07, 2006 9:46 pm
- Location: The Multiverse
- roflamingo
- level3
- Posts: 404
- Joined: Fri Jan 19, 2007 10:25 am
Montyphy wrote:If you're going to hard code a known part of ocean you may as well hard code the knowledge of how many oceans there are. It's not like a bot is even really able to tell if a land mod is installed.
I'm not hardcoding anything, exactly with what you said in mind (I think). Every co-ordinate is dynamically calculated every game and I have no static data points, because land/ocean definitions are not guaranteed from game-to-game.
- Ace Rimmer
- level5
- Posts: 10803
- Joined: Thu Dec 07, 2006 9:46 pm
- Location: The Multiverse
Just remember when placing fleet:
Even if you use separate PlaceFleet (longitude, latitude, type1 [, type2 [, type3 [, type4 [, type5 [, type6]]]]]) commands, if you place multiple ships in the same cycle or tick, you end up with One Fleet. Therefore, you CAN place one ship in the Atlantic and another ship in the Pacific, and those two ships be in the Same Fleet. This means you can't give the two ships different movement targets (only one movement target per fleet).
E.g.
Tick1
PlaceFleet (x, y, BattleShip)
PlaceFleet (c, d, Carrier)
Tick2
is = to:
PlaceFleet(x/c, y/d, BattleShip, Carrier)
You are given something like:
BB ObjectID = 25, FleetID = 1
CV ObjectID = 26, FleetID = 1
On the other hand
Tick1
PlaceFleet (x, y, BattleShip)
Tick2
PlaceFleet (c, d, Carrier)
is = to:
BB ObjectID = 25, FleetID = 1
CV ObjectID = 26, FleetID = 2
Even if you use separate PlaceFleet (longitude, latitude, type1 [, type2 [, type3 [, type4 [, type5 [, type6]]]]]) commands, if you place multiple ships in the same cycle or tick, you end up with One Fleet. Therefore, you CAN place one ship in the Atlantic and another ship in the Pacific, and those two ships be in the Same Fleet. This means you can't give the two ships different movement targets (only one movement target per fleet).
E.g.
Tick1
PlaceFleet (x, y, BattleShip)
PlaceFleet (c, d, Carrier)
Tick2
is = to:
PlaceFleet(x/c, y/d, BattleShip, Carrier)
You are given something like:
BB ObjectID = 25, FleetID = 1
CV ObjectID = 26, FleetID = 1
On the other hand
Tick1
PlaceFleet (x, y, BattleShip)
Tick2
PlaceFleet (c, d, Carrier)
is = to:
BB ObjectID = 25, FleetID = 1
CV ObjectID = 26, FleetID = 2
Smoke me a kipper, I'll be back for breakfast...
martin wrote:Oh really? Why's that?
Generally speaking, x and y are variables, while x_n and y_n are specific values that those variables take on. When finding the midpoint of a line segment, you take the average of the x and y values of the endpoints. You would label one endpoint (x_1, y_1), and the other endpoint (x_2, y_2), then take the average coordinate-wise. Hence the midpoint is given by (x_m, y_m) = ((x_1+x_2)/2, (y_1+y_2)/2).
xander
Who is online
Users browsing this forum: No registered users and 13 guests