Make all colonies/outposts to start with 6/3 def. troops

For what's not in 'Top Priority Game Design'. Post your ideas, visions, suggestions for the game, rules, modifications, etc.

Moderator: Oberlus

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

Re: Make all colonies/outposts to start with 6/3 def. troops

#16 Post by Oberlus »

This is what's going on:

Turn 213: Red empire has attacked system H and flattened all shields, defenses and infrastructure. Some troopers there are ordered to invade, but with insufficient forces. Others arrive next turn.

Turn 214: Red empire has attacked system H again. New troopers are ordered to invade Asteroids H, with enough forces. Last turn that Asteroids H were attacked by ship was 213. Green empire forces arrive next turn.

Turn 215: Red troopers successfully invade Asteroids H. Green ships destroy all red ships in the system but do not target Asteroids H because it has all meters zeroed. Last tusn Asteroids H were attacked was still 213. So troop regen (base and the ones from Garrison techs) takes place and the now Red Asteroids H start with 6.16 troopers. This should not work like that. I'm testing using LastTurnColonized < CurrentTurn - 1, which seems to work, but I don't know if that will backfire. I'll keep testing stuff.

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

Re: Make all colonies/outposts to start with 6/3 def. troops

#17 Post by Oberlus »

If 30 troops invade a planet with 27.84 troops, the invaded planet will have 2.16 troops after invasion?

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

Re: Make all colonies/outposts to start with 6/3 def. troops

#18 Post by Ophiuchus »

Oberlus wrote: Sat Oct 17, 2020 1:08 pm Turn 215: Red troopers successfully invade Asteroids H. Green ships destroy all red ships in the system but do not target Asteroids H because it has all meters zeroed.
I thought we always trigger combat by unconditionally ensuring a infrastructure at least one.
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: 5716
Joined: Mon Apr 10, 2017 4:25 pm

Re: Make all colonies/outposts to start with 6/3 def. troops

#19 Post by Oberlus »

Ophiuchus wrote: Sun Oct 18, 2020 8:48 am I thought we always trigger combat by unconditionally ensuring a infrastructure at least one.
Same.

Since planet invasion happens before combat (AFAICT), the green ships not attacking just-conquered asteroids might make sense for turn 215. But I can't make any sense of turn 214...

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

Re: Make all colonies/outposts to start with 6/3 def. troops

#20 Post by Geoff the Medio »

Oberlus wrote: Sat Oct 17, 2020 1:35 pm If 30 troops invade a planet with 27.84 troops, the invaded planet will have 2.16 troops after invasion?
Before troop level growth, yes. But troops may grow post-invasion. See these planets before invasion, between turns after invasion before troop growth, and on the next turns.
Invasion_Troop_Math.png
Invasion_Troop_Math.png (116.21 KiB) Viewed 710 times
I'm testing using LastTurnColonized < CurrentTurn - 1
Note that LastTurnColonized and LastTurnConquered are not the same...

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

Re: Make all colonies/outposts to start with 6/3 def. troops

#21 Post by Oberlus »

OK, so the problem is that the planet invaded at the start of turn 214 will not have infrastructure when the Green forces arrive and thus will not be attacked, so it will regen troops and whatnot at the end of that turn 214, which is wrong.

Since the planet was attacked on turn 213, it did not regenerate construction or shields at the end of that turn. Then, on turn 214 it is targetted for invasion (which succeeds), the Green fleet arrives, and combat ensues. Since the effects for that turn have not yet been processed, the planet has no construction, shields or defense, so it is not targetted by Green ships during combat. When effects are processed, the planet has not been attacked in current turn and so can regenerate shields, defense and troops, and so the planet starts turn 215 with 8 shields, 9 defense and some troops apart from the invading troops surplus. Planet should have been attacked this turn.

Colonies regenerate construction with their species effect STANDARD_CONSTRUCTION, when not just conquered or attacked. Outposts regenerate 1 construction with the tech OUTPOSTS, always.
At first I thought the solution could be changing the tech/construction/OUTPOST.focs.txt effect to also apply to colonies, so that they regenerate that minimum of 1 construction for consistent planet participation in combat regardless of being just conquered or not. It didn't work because the issue with invasion, fleet movement, combat and effects processing ordering.

(How) Can we ensure in the backend a minimum of 1 construction at the start of every turn? (that is, before Colonisation, etc.)

/Edit: my guess is such a change would go in ServerApp::PreCombatProcessTurns() somewhere after HandleScrapping()/

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

Re: Make all colonies/outposts to start with 6/3 def. troops

#22 Post by Oberlus »

Alternatively, we can gate all shield, defense and troop regeneration not only LastTurnAttackedByShip but also LastTurnConquered. Regardless of combat, just-invaded colonies would not regenerate the turn they are invaded, which would be a change to current behaviour. Would this be better than the above suggestion?

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

Re: Make all colonies/outposts to start with 6/3 def. troops

#23 Post by Ophiuchus »

Oberlus wrote: Mon Oct 19, 2020 11:06 am Alternatively, we can gate all shield, defense and troop regeneration not only LastTurnAttackedByShip but also LastTurnConquered. Regardless of combat, just-invaded colonies would not regenerate the turn they are invaded, which would be a change to current behaviour. Would this be better than the above suggestion?
The first suggestion sounds like adding another hack on top of a hack.

We could also instead change the target condition to include planets if LastTurnConquered. But then we would attack that planet a lot, not only a single bout.

I like your second suggestion implementation wise better. Game wise the change is ok I think.
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: 5716
Joined: Mon Apr 10, 2017 4:25 pm

Re: Make all colonies/outposts to start with 6/3 def. troops

#24 Post by Oberlus »

Ophiuchus wrote: Mon Oct 19, 2020 4:28 pm I like your second suggestion implementation wise better. Game wise the change is ok I think.
Agree.
Current state of the PR uses that.

Post Reply