Preventing boxed in starts

Creation, discussion, and balancing of game content such as techs, buildings, ship parts.

Moderators: Oberlus, Committer

Message
Author
wobbly
Cosmic Dragon
Posts: 1880
Joined: Thu Oct 10, 2013 6:48 pm

Preventing boxed in starts

#1 Post by wobbly »

wobbly wrote: Sat May 14, 2022 7:41 am
Oberlus wrote: Wed May 11, 2022 9:05 am
LienRag wrote: Wed May 11, 2022 6:32 am But with it, getting rid of early Maintenance Ships is much more difficult, for example.

Another thing : on many of the test games either me or other players were boxed in a small subset of systems, is the starting position generator well calibrated ?
That's as expected. It happens too on SP games. In the last two weeks I started six games (played for 30 to 120 turns), all settings to medium. Sometimes I had plenty of natives around readily accessible, sometimes I had just one in 10 hops around my world and protected by a monster. Only once I had nothing to invade/colonize until I killed a Maintenance Ship, I was Chato and used symb zortrium arc disruptors (level 2), pilling up some troopers in the meantime, then I was able to catch up in the planets race with Colonization policy and quickly invading some natives after freeing myself. I understand players like Magnate being against playing with monsters, when that clashes so hard with their playstyle and don't feel comfortable having to adjust or to face this kind of disadvantage at game start. In my case, I don't mind, it brings spice to the games, whether I am the one with free colonization at start or the one enclosed in a pocket with nothing to colonize. I was more like Magnate a year ago, feeling frustration when I had an unlucky start, but experience in MP games, watching what other players can do, made me change my mind.
It is possible to check distance to nearest capital in scripting. In theory you could have a game rule setting the minimum distance for specials/monsters.
So my idea here would be to add in a game rule: Minimum monster distance from Capital. Defaults to 3, ranges from 1 - 9.
Change monster_guards.macro to always spawn ancient guardians or stealth special within that distance.
Nests already have minimum distances, maybe change this to Max[current, game rule]?
BiegeGoo, FiftySeven and Acirema can all spawn guards. Disallow them within that distance?
monster_fleets.inf already has minimum distances, same as nests, Max[current, game rule]?

Any ways of monster spawn I've missed?

Edit: I can see that some specials (ancient ruins) add monsters direct. So this is a choice between not spawning ancient ruins in that distance, or replacing it with a different guard.

Ophiuchus
Programmer
Posts: 3433
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Preventing boxed in starts

#2 Post by Ophiuchus »

I think the idea is good. re ancient ruins: i would put those further away.

Another way would be to mitigate boxed in starts.

One thing which was possible in the past was escaping the box using stealth e.g. with a flux bubble colony or by breaking the blockade for a turn.
But i think that is too far away with the current content, as non-connection to capital is too punishing for most empires.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

User avatar
Oberlus
Cosmic Dragon
Posts: 5715
Joined: Mon Apr 10, 2017 4:25 pm

Re: Preventing boxed in starts

#3 Post by Oberlus »

Check this out:
easy_honeycomb.png
easy_honeycomb.png (428.06 KiB) Viewed 1573 times
An unguarded honeycomb, not even a monster in the way there!

Or...
Honeycombs have [[CHANCE_OF_GUARD_2]]
It should have a SM_GUARD_2 (Sentinel) because the conditions are met:
https://github.com/freeorion/freeorion/ ... os#L37-L67

Sentinels have hull SH_GUARD_MONSTER_BODY, which has [[UNOWNED_OWNED_VISION_BONUS(MODERATE,40,30)]], which gives it +40 detection strength when unowned.
My ship at the honeycomb system has stealth 25 (5 +20 from the nebula). The monster should have detection 20 (40 -20 from the nebula). What a nice coincidence...

I can't try it now, but I guess colonization or outposting of that honeycomb will fail until the Sentinel is killed, right?

wobbly
Cosmic Dragon
Posts: 1880
Joined: Thu Oct 10, 2013 6:48 pm

Re: Preventing boxed in starts

#4 Post by wobbly »

I'm having trouble working out how to use a game rule inside a maximum:

Code: Select all

max(2, (GameRule name = "RULE_MINIMUM_MONSTER_DISTANCE_CAPITAL"))
complains that its not an integer.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Preventing boxed in starts

#5 Post by Geoff the Medio »

wobbly wrote: Sun Jul 03, 2022 7:57 amSo my idea here would be to add in a game rule: Minimum monster distance from Capital. Defaults to 3, ranges from 1 - 9.
Sounds like you mean jumps, not direct line "distance". Also, consider how the minimum jumps / distance might need to depend on the starlane frequency; fewer lanes per system means less branching pathes means more likely boxing in.
wobbly wrote: Sun Jul 17, 2022 9:24 amI'm having trouble working out how to use a game rule inside a maximum:

Code: Select all

max(2, (GameRule name = "RULE_MINIMUM_MONSTER_DISTANCE_CAPITAL"))
complains that its not an integer.
How is the rule defined? Where is the max(...) expression being used?

wobbly
Cosmic Dragon
Posts: 1880
Joined: Thu Oct 10, 2013 6:48 pm

Re: Preventing boxed in starts

#6 Post by wobbly »

Geoff the Medio wrote: Sun Jul 17, 2022 1:33 pm Sounds like you mean jumps, not direct line "distance". Also, consider how the minimum jumps / distance might need to depend on the starlane frequency; fewer lanes per system means less branching pathes means more likely boxing in.
Yes I meant jumps. Regarding starlane frequency, the minimum jumps would be a game rule. I was figuring on the default being based on average settings and players adjusting the number to their personal taste/settings.
Geoff the Medio wrote: Sun Jul 17, 2022 1:33 pm How is the rule defined?

Code: Select all

GameRule(
    name="RULE_MINIMUM_MONSTER_DISTANCE_CAPITAL",
    description="RULE_MINIMUM_MONSTER_DISTANCE_CAPITAL_DESC",
    category="BALANCE",
    type=int,
    default=3,
    min=1,
    max=10,
)
Geoff the Medio wrote: Sun Jul 17, 2022 1:33 pm Where is the max(...) expression being used?

Code: Select all

Special
    name = "KRAKEN_NEST_SPECIAL"
    description = "KRAKEN_NEST_SPECIAL_DESC"
    spawnrate = 0.0
    location = And [
        (GalaxyMonsterFrequency >= 1)
        Planet
        Planet type = GasGiant
        Not WithinStarlaneJumps jumps = max(2, (GameRule name = "RULE_MINIMUM_MONSTER_DISTANCE_CAPITAL")) condition = And [
            System
            Contains And [
                Planet
                OwnedBy affiliation = AnyEmpire
            ]
        ]
    ]
and monster_fleets.inf

Code: Select all

MonsterFleet
    name = "SM_KRILL_1"
    ships = [
        "SM_KRILL_1"
    ]
    spawnrate = 0.5
    spawnlimit = 9999
    location = And [
        Not Contains Monster
        Not WithinStarlaneJumps jumps = max(2, (GameRule name = "RULE_MINIMUM_MONSTER_DISTANCE_CAPITAL")) condition = Contains And [
            Planet
            OwnedBy affiliation = AnyEmpire
        ]
    ]

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Preventing boxed in starts

#7 Post by Geoff the Medio »

I'm not sure what the problem with the parser is, but try wrapping the rule in a NamedInteger?

wobbly
Cosmic Dragon
Posts: 1880
Joined: Thu Oct 10, 2013 6:48 pm

Re: Preventing boxed in starts

#8 Post by wobbly »

Geoff the Medio wrote: Sun Jul 17, 2022 8:04 pm I'm not sure what the problem with the parser is, but try wrapping the rule in a NamedInteger?
Thanks this worked for nests (untested for monster.inf)

There's a 2nd change I'm working on as with high specials and high minimum monster jumps you get too many ancient guardians. My opinion is Raagh's would be perfectly fine guards on terrans and stealthy natives would be fine on their relevant enviros. I just haven't worked out how to script a bunch of different native guards for different enviros in a clean fashion.

User avatar
Oberlus
Cosmic Dragon
Posts: 5715
Joined: Mon Apr 10, 2017 4:25 pm

Re: Preventing boxed in starts

#9 Post by Oberlus »

Maybe randomly choose a native species then reset the planet's environment?

wobbly
Cosmic Dragon
Posts: 1880
Joined: Thu Oct 10, 2013 6:48 pm

Re: Preventing boxed in starts

#10 Post by wobbly »

Oberlus wrote: Mon Jul 18, 2022 9:19 am Maybe randomly choose a native species then reset the planet's environment?
This would give the wrong environment for some specials.

There's a line in monster_guards.macro

Code: Select all

SetSpecies name = "SP_ANCIENT_GUARDIANS"
What I suspect I want is something like:

Code: Select all

SetSpecies name = NATIVE_GUARD
with native guard set depending on environment. Here NATIVE_GUARD should be a string? I'm not seeing anything like NamedString used elsewhere in the scripting...

Ophiuchus
Programmer
Posts: 3433
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Preventing boxed in starts

#11 Post by Ophiuchus »

wobbly wrote: Mon Jul 18, 2022 1:53 pm [There's a line in monster_guards.macro

Code: Select all

SetSpecies name = "SP_ANCIENT_GUARDIANS"
What I suspect I want is something like:

Code: Select all

SetSpecies name = NATIVE_GUARD
with native guard set depending on environment. Here NATIVE_GUARD should be a string? I'm not seeing anything like NamedString used elsewhere in the scripting...
probably you can make a SET_NATIVE_GUARD macro which can choose based on planet type.

probably as a series of If else effects; maybe using OneOf

Code: Select all

If condition = Planet type = Terran
 effects = SetSpecies name = OneOf("SP_RAAAGH","SP_ANCIENT_GUARDIANS") else = SetSpecies name = "SP_ANCIENT_GUARDIANS"
re NamedString: no that does not (yet) exist. I am not sure what string ValueRefs do exist - you need some working calculation before referring to it. There is string concatenation and OneOf which I know of.
two ways this could work if it existed

Code: Select all

// version 1 -  with string concatenation valueref
NamedString name = "NATIVE_GUARD_TERRAN" value = OneOf("SP_RAAAGH","SP_ANCIENT_GUARDIANS")
// in the effects group
effects = SetSpecies name = StringLookup name = "NATIVE_GUARD_" + Source.PlanetType

// version 2 - with something similar to statistics a valueref 'Strings', returning a string instead of a number
NamedString name = "NATIVE_GUARD" value = Strings If condition = Planet type = Terran string = OneOf("SP_RAAAGH","SP_ANCIENT_GUARDIANS")
// in the effects group
effects = SetSpecies name = StringLookup name = "NATIVE_GUARD"
edit2: or you split the effectsgroup(s) by planet type (so one effectgroup for Terran targets, one effectgroup for ...)
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

Ophiuchus
Programmer
Posts: 3433
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Preventing boxed in starts

#12 Post by Ophiuchus »

wobbly wrote: Mon Jul 18, 2022 1:53 pm...
NamedString and NamedStringLookup are now available in PR-3987
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

wobbly
Cosmic Dragon
Posts: 1880
Joined: Thu Oct 10, 2013 6:48 pm

Re: Preventing boxed in starts

#13 Post by wobbly »

Ok 1st part is here:

https://github.com/freeorion/freeorion/pull/3988

I'll handle the 2nd idea with Raagh later. I also had a crazy idea to make asteroid coating attract snails, I didn't add that in, I just stopped the special spawning within that range.

Ophiuchus
Programmer
Posts: 3433
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Preventing boxed in starts

#14 Post by Ophiuchus »

wobbly wrote: Wed Jul 20, 2022 6:25 pm Ok 1st part is here:

https://github.com/freeorion/freeorion/pull/3988
Not sure I get everything happening there. So some remarks:

Not Homeworld and distance to capital very different. Natives also have homeworlds. So I think you allow extra monsters on homeworlds?

Also the distance to capital macro is misnamed - it is minimum distance to empire. (even if that is the same in the first turn). So the rule name is fine, the macro name is not (or use capital in the macro).

I didnt know that fiftyseven spawn a dragon. I think that dragons simply roam around (which is a quite a bad planet guard) - maybe they could spawn something which keeps lurking around in the area (and even better is actively hunting for ships in that area).

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

Look, ma... four combat bouts!

wobbly
Cosmic Dragon
Posts: 1880
Joined: Thu Oct 10, 2013 6:48 pm

Re: Preventing boxed in starts

#15 Post by wobbly »

Ophiuchus wrote: Thu Jul 21, 2022 8:48 am
Not sure I get everything happening there. So some remarks:

Not Homeworld and distance to capital very different. Natives also have homeworlds. So I think you allow extra monsters on homeworlds?
The only place I can see where I've used Not Homeworld is for the condition to place ancient guardians in monster_guard.macros

Old version
If (Homeworld or 60%) place guardship else if 80% place ancient guardians else place cloud cover
e.g. if the special (containing chance of guard macro) spawned on a navite it always spawned a guardship (this was unintended, they were always meant to have a chance at stealth when I added it). If kept this way (with the dist check added), 80% of close in natives on specials would be replaced by ancient guards.

New version
If (60% and not min. dist check) place guardship else if (Not Homeworld and 70%) place ancient guardians else place cloud cover
e.g. Natives on special can now be stealthed instead of having guardship and are always stealthed if within the minimum distance.
Ophiuchus wrote: Thu Jul 21, 2022 8:48 am Also the distance to capital macro is misnamed - it is minimum distance to empire. (even if that is the same in the first turn). So the rule name is fine, the macro name is not (or use capital in the macro).
I'll change the macro name. I used empire because I copied the already existing checks that stop specials spawning on the starting planet. May as well keep the distance checks consistent.
Ophiuchus wrote: Thu Jul 21, 2022 8:48 am I didnt know that fiftyseven spawn a dragon. I think that dragons simply roam around (which is a quite a bad planet guard) - maybe they could spawn something which keeps lurking around in the area (and even better is actively hunting for ships in that area).

else looks good to me.
Hasn't existed for long, same with the dyson forest on biege goo. I got fed up in multiplayer with Biege Goo or Fiftyseven = instant win (I'm exaggerating) and didn't want them to be another sentry or another great troops or another big planet defenses... I would of used something that hunts ships if it had existed, and wont be offended if someone changes the guard type on them. In my own head-cannon the dragon is actually the 57s great space god who'll happily wonder off or occasionally come bombard them. I haven't seen it in-game (apart from super tester), it probably doesn't guard them that well, but it probably guards them better then the nothing that was there before. Technically the dyson forest probably should be checking for correct star colour, I didn't realize that was a thing at the time.

Post Reply