What is your strategy with scouts?

Describe your experience with the latest version of FreeOrion to help us improve it.

Moderator: Oberlus

Forum rules
Always mention the exact version of FreeOrion you are testing.

When reporting an issue regarding the AI, if possible provide the relevant AI log file and a save game file that demonstrates the issue.
Post Reply
Message
Author
User avatar
mem359
Dyson Forest
Posts: 214
Joined: Sun Jun 08, 2014 1:18 am

What is your strategy with scouts?

#1 Post by mem359 »

Looking through the python code, I'm realizing that making the AI any smarter is a lot of work. :mrgreen:
But I think scouting/exploration can be tweaked. Not a huge gain, but it should be an easier project.

I have some ideas about modifications, but I thought I'd ask how other people decide to use scouts during the game.
(Maybe the AI players would be better off doing something else than what I have in mind.)

I try to have 4 or 5 scouts as soon as possible, and replenish them as they get crushed by wandering monsters or Sentinels. Explore, and early warning for incoming attackers. But I use them less after Active Radar (especially with planetary Scanning Facilities), even less after Neutron Scanner, and not at all by the time I have Sensors. By mid-game, I can do enough "exploration" by conquering/colonizing planets in sight, then building a Scanning Facility if I want a range boost.

By contrast, some AI players have no interest (0 priority) in scouts in the early game. (One AI had 3 scouts in the build queue *after* a colony base, even though the base could not possibly be useful until a lot of research was done first.) They also seem to want to build more scouts (instead of less) after each spy detection tech boost. That algorithm is probably why a fair number of conquered planets seem to have armadas of scouts in orbit.

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: What is your strategy with scouts?

#2 Post by Dilvish »

mem359 wrote:By contrast, some AI players have no interest (0 priority) in scouts in the early game.
That's probably because I force a fair number of scouts to be produced at the very outset of the game, and that might well meet all their assessed needs for a while.
(One AI had 3 scouts in the build queue *after* a colony base, even though the base could not possibly be useful until a lot of research was done first.)
One of the areas the AI needs improvement is dealing with relative priorities of things on the build queue. Some things might get moved to the top, and I am pretty sure that there is at least a little bit of code for a couple of things that tries to assess a relative priority to things at the top of the queue, but overall there is much more work needed there. And I don't think the priority it gives to colony ships/bases is currently dependent on an assessment of research levels. If you want to come up with some changes for those things that would be great. Rather than trying to do a specific assessment of tech to determine placement of the colony ship/base in the build queue, I think it would work out better for it to be based in some fashion on its colonization evaluation score(s) for the current top target planet(s); that will indirectly take into account various relevant techs plus other useful info.
They also seem to want to build more scouts (instead of less) after each spy detection tech boost.
I haven't looked up the code just now, but I expect the idea was something like 'Once the AI gets Radar, build a few new scouts having Radar', not some intent to specifically increase the total number of scouts (as far as I recall).
That algorithm is probably why a fair number of conquered planets seem to have armadas of scouts in orbit.
That seems to happen pretty rarely in my experience, but if you want to work on some improvements please do.

A couple related thoughts-- Mat has pointed out he thinks I have the AI be to careful with scouts. Certainly once the AI is making a more advanced scout then it would be fine for it to be more risk-taking with its older model scouts (i.e., not be worried about moving them out past fuel range of return, and possibly being willing to scrap them once they become stranded).
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
mem359
Dyson Forest
Posts: 214
Joined: Sun Jun 08, 2014 1:18 am

Re: What is your strategy with scouts?

#3 Post by mem359 »

I haven't looked at the production algorithm yet, but in PriorityAI, the exploration priority (with Industry always being assigned 50, and higher number being more urgent:
scoutsNeeded = max(0, min( 4+int(milShips/5), 4+int(fo.currentTurn()/50) , 2+ numUnexploredSystems**0.5 ) - numScouts - queuedScoutShips )
explorationPriority = int(40*scoutsNeeded)
If I'm not overlooking something, I think that "min" should also be a "max". It seems strange that if there were a lot of unexplored systems, that the AI wouldn't want more scouts just because it is an early turn.

And it does seem strange that the number of scouts needed would increase as the game goes on. (I gave my reasoning in the initial post for that number to go down, not up, as the turn increases.)

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: What is your strategy with scouts?

#4 Post by Dilvish »

mem359 wrote:
scoutsNeeded = max(0, min( 4+int(milShips/5), 4+int(fo.currentTurn()/50) , 2+ numUnexploredSystems**0.5 ) - numScouts - queuedScoutShips )
If I'm not overlooking something, I think that "min" should also be a "max". It seems strange that if there were a lot of unexplored systems, that the AI wouldn't want more scouts just because it is an early turn. And it does seem strange that the number of scouts needed would increase as the game goes on. (I gave my reasoning in the initial post for that number to go down, not up, as the turn increases.)
No, the intent there was to be a min. The following is a comment I'll add once I finish getting myself set up with the new github repo:

Code: Select all

    # intent of the following calc is essentially 
    # new_scouts_needed = min(need_cap_A, need_cap_B, base_need) - already_got_or_queued
    # where need_cap_A is to help prevent scouting needs from swamping military needs, and 
    # need_cap_B is to help regulate investment into scouting while the empire is small.
    # These caps could perhaps instead be tied more directly to military priority and 
    # total empire production.
Like nearly all the AI approaches, this is just one possible approach; I'm open to any changes that you find work better.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
mem359
Dyson Forest
Posts: 214
Joined: Sun Jun 08, 2014 1:18 am

Re: What is your strategy with scouts?

#5 Post by mem359 »

Dilvish wrote:No, the intent there was to be a min. The following is a comment I'll add once I finish getting myself set up with the new github repo:

Code: Select all

    # intent of the following calc is essentially 
    # new_scouts_needed = min(need_cap_A, need_cap_B, base_need) - already_got_or_queued
    # where need_cap_A is to help prevent scouting needs from swamping military needs, and 
    # need_cap_B is to help regulate investment into scouting while the empire is small.
    # These caps could perhaps instead be tied more directly to military priority and 
    # total empire production.
Like nearly all the AI approaches, this is just one possible approach; I'm open to any changes that you find work better.
Thanks for the feedback.

That's one reason why I was asking how other people actually use scouting.
If most players are like me (spam scouts early, fewer scouts as the game goes on), then the current AI approach is backwards to that kind of strategy. But if people find they are using more scouts in the mid-game (and proportional to the size of their military force), then this calculation makes more sense than what I have in mind.

This could easily change after ship hulls and weapons are rebalanced (sometime in the future), but right now scouts are around 10-15% of the cost of a warship or an outpost ship. As long as the number of scouts is capped at something reasonable, I don't see exploration swamping military needs, especially in the early game (before Laser and Robotic Hulls are researched).

User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

Re: What is your strategy with scouts?

#6 Post by MatGB »

I pretty much take the same approach, in the early to mid game I want lots of scouts, in the end game I only want advance notice. I spam scouts early, barely building any warships until I absolutely need them and I've got passable tech.

In the very late game, if I haven't got eyes on the whole map (I tend to play low planets/large map) then I build some large warship hulls with a sensor in place of a weapon—so much so I tend to use either Trith or Laenfa as backup shipbuilders over Mu Ursh or Eaxaw.

I like to see as much of the map as possible, I like to have advance warning of fleet movements, partially as I tend to have a relatively small number of warships deployed very carefully, I rarely actually have a defensive fleet, merely newbuild ships that can be used defensively, but for that to work I need advance warning. Virtually all my actual warships will be deployed attacking, fairly constantly, but you can't fight too many enemies at once, until you're relatively secure, anyway.

So yes, agree with the main thrust, in the mid to late game the AI builds too many scouts, and the scouts it does build are frequently used in a sub optimal manner.

The whole approach of withdrawing back to supply lines and never risking running out of fuel is a waste, their job is to find places to which you can and will extend supply. If the objective is to conquer the map, then any ship that ends up out of supply will a)slowly regain fuel and b) end up in supply again when the empire expands.

Scouts are cheap. If they die, or end up stuck, then they die or end up stuck.
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: What is your strategy with scouts?

#7 Post by Dilvish »

mem359 wrote:If most players are like me (spam scouts early, fewer scouts as the game goes on), then the current AI approach is backwards to that kind of strategy.
I spam scouts early myself, and if you'll pay a little more attention I think you'll see the AI approach does as well, though perhaps not as many as you or I do, nor in exactly the same patterns. I mentioned above that the AI starts out building a bunch of scouts; I think at the moment it works out to something like 4 or 5 scouts or so, before it scales back to relying on the exploration priority for further construction. It's pretty much just at a point that seems reasonable without too often overproducing a crazy amount of scouts. So, you might want to look at extending that initial surge, but then also be careful to still allow it to be responsive to other needs during that time; the longer that surge is the more important that responsiveness is. And yes, it would also make sense to have exploration priority tail off later (it seems to me that once you have Neutron Scanner then scouting needs usually slow down quite a bit and a pretty small number of scouts can do the job).

I agree (mostly) with Mat about being willing to have scouts get stranded; the qualification is because I would not want the AI to do that until it had explored everything it could without stranding any scouts. That should not really be hard to code up if you want to try that; I simply haven't gotten around to it.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

Morlic
AI Contributor
Posts: 296
Joined: Tue Feb 17, 2015 11:54 am

Re: What is your strategy with scouts?

#8 Post by Morlic »

When I read through the scouting code, my thought was that the most important improvement consists in implementing an intelligent decision-making on which scout to use and/or where to put each scout.
The building etc. is not optimal but also not that decisive I think.

The AI loses a lot of time by moving scouts that are "obviously" bad choices, e.g. not using the scout directly next to the system but pulling one from the homeworld.
Also, even if currently all unexplored systems are covered, the scouts should move to a space closer to the unexplored territory instead of sitting at the homeworld while trying not to clump up (this basically holds for any ship type, but why not start with scouts and use the code later for other types / use it in a more general framework).

Mathematically this could be (relatively easily) realized by having some sort of repellant potential for each scout in the system and an attractive potential for unexplored systems, each decaying by either number of starlane jumps or actual starlane distance. This could then also be (relatively) easily extended so threats would yield another repellant potential and strategic scouting systems (not for exploring but scouting the enemy) get some bonus, too.

Just some thoughts I had back then. So if after your first, simpler approaches you finally end up wanting to recode the scouting system, maybe that is some inspiration :D
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: What is your strategy with scouts?

#9 Post by Dilvish »

Morlic wrote:...Just some thoughts I had back then...
Those sound like some good ideas to try out...
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

Post Reply