Page 1 of 1

Obligatory hard action requirements you want dropped

Posted: Mon Feb 22, 2021 8:33 pm
by sveinung
Thanks to the obligatory hard requirement support for actions in Freeciv 3.0 you now know why that awesome rule you had planned to implement via an action enabler didn't work. It had a conflict with a hard requirement for the action it enabled. But you want that conflict gone!

List the hard requirements you want gone here and why you want it gone. Bonus points if you can show that it won't be much work. (Example: Dropping NoHome for "Home City" enablers only needed 5 lines in the auto help system.)

I don't want people to accuse me of playing favorites: The amount of work needed to drop a hard requirement varies. The amount of work to verify that a solutions someone suggest works varies too. Unit type flags are typically relatively easy to check since they can be searched for. Other requirements may have subtle interactions in areas that don't even mention the requirement.

If you didn't understand what was said above, see my explanation of hard requirements here.

Re: Obligatory hard action requirements you want dropped

Posted: Mon Feb 22, 2021 11:21 pm
by Caedo
All the ones I've found require at least some amount of effort (more than just five lines in the autohelp), and sometimes decisions on how something should be done.
In ascending order of projected effort:

Tl;dr: Some effort, some possible info leak.
"Airlift Unit" requires the actor unit to not be transporting anything. As far as I can tell, the primary issue (that isn't ruleset authors' problem) would be making sure that, if transporting one ally's units and airlifting to a different ally's city, those transported units are allowed to enter that destination city (i.e. your two allies are also allied with each other). This could lead to info leak in the case where you don't have an embassy with either of those players.

Tl;dr: Some effort, and depending on implementation, some possible info leak or unhappy allies.
"Paradrop Unit" requires the actor to not be transporting any units. One could imagine a scenario where a strike team is launched deep into enemy territory in some kind of vehicle.
Like Airlift, this necessitates the question of whether transported units are allowed to enter the destination tile. Unlike Airlift, Paradrop is known to occasionally kill the actor unit when dropping into unknown territory, which your allies might not like if you're transporting their units.

Note that both of the above are basically no problem if the actor is only transporting units of the same player.

Tl;dr: Quite a bit of effort.
Unhardcoding the "CanOccupyCity" unit class flag.
Unfortunately, there seems to be a shocking amount of places in the code that just look for the UCF, not for whether units are capable of any "Conquer City" action. This also includes places involving auto-conquering of cities (e.g. when teleporting a unit). One option would be to just remove the flag as an obligatory requirement for "Conquer City" actions, which would change its role to "CanAutoConquerCity", but at that point we're reworking quite a bit of code.
Note: At the moment, there seem to be some places (particularly AI-wise) that assume any military unit of a CanOccupyCity class is, in fact, capable of conquering cities on demand – this is a problem in and of itself, if any ruleset author ever decides to violate that assumption.

Tl;dr: Probably not gonna happen due to required effort.
"Upgrade Unit" currently requires the target city to be domestic. One could imagine a ruleset where upgrading units is also possible in cities controlled by your allies.
Granted, flat out dropping this requirement would mean that, if ruleset authors don't enforce things like requiring an embassy for upgrades in foreign cities, there might be some info leak (as described in detail in a comment in actions.c).
Digging deeper into the code, it looks like this would probably be a change that requires quite a bit of work; not the least of which being the question of whether unit upgrade cost effects should be computed against the unit's owner, or the city's owner.


Any others ould usually require a huge amount of reworking, like "what would it take to get rid of the Settlers utyf?" or "what if animals could conquer cities?", which is way outside the scope of this.

Re: Obligatory hard action requirements you want dropped

Posted: Tue Feb 23, 2021 12:52 pm
by Ignatus
I think, the best goal of the mentioned is paradropping in a tank (well, unhardcoding the UCF is also necessary but it really needs a lot of attention). The leak of diplomatic states between allies hardly is a problem, so just check the cargo and say _("Can't paradrop %s with %s's %s aboard into this territory due to diplimatical reasons."). For sure, you must own the toplevel unit to paradrop. Really, aside of the hard reqs question, there should be a ruleset control around what happens if you get into a peaceful territory, as well as can you paradrop into an unknown tile or an unseen tile with terrain remembered to be unsuitable, and is it really plausible that a worker of a nation at peace with you will put your cool paratrooper down seeing him in the sky above...

My own idea:
Allow capturing a transporting unit. As long as we can't capture a caravel full of caravans, the piracy is just boring.

Re: Obligatory hard action requirements you want dropped

Posted: Tue Feb 23, 2021 8:14 pm
by sveinung
Caedo wrote:Tl;dr: Quite a bit of effort.
Unhardcoding the "CanOccupyCity" unit class flag.
Unfortunately, there seems to be a shocking amount of places in the code that just look for the UCF, not for whether units are capable of any "Conquer City" action. This also includes places involving auto-conquering of cities (e.g. when teleporting a unit). One option would be to just remove the flag as an obligatory requirement for "Conquer City" actions, which would change its role to "CanAutoConquerCity", but at that point we're reworking quite a bit of code.

Working on it. It may not look that way but a lot of my recent work on Freeciv has been aimed at it. Today I spent most of my Freeciv-time working on making it possible for ruleup to cut out unused crap from the ruleset so the output of the ruleset upgrade code for splitting Paradrop Unit could be readable enough for me to send in my patch that splits Paradrop Unit so one CanOccupyCity reference can move to the ruleset - as a hard obligatory requirement at first. The next big CanOccupyCity related task I have started to work on - mostly planning - is to handle the Lua API (that currently decides if Lua teleport move can occupy based on the flag) in a backwards compatible way that allows dropping the hard coded reference to CanOccupyCity for 3.2.

Caedo wrote:Note: At the moment, there seem to be some places (particularly AI-wise) that assume any military unit of a CanOccupyCity class is, in fact, capable of conquering cities on demand – this is a problem in and of itself, if any ruleset author ever decides to violate that assumption.

Paches welcome (from any reader)! Since I'm currently in the CanOccupyCity "area" mentally I would probably be quick to review them. If you use utype_can_do_action_result() in the 3.1 patches you won't delay generalized actions. Feel free to use utype_can_do_action() if you don't want to create a separate 3.0 patch.

Re: Obligatory hard action requirements you want dropped

Posted: Thu Feb 25, 2021 4:59 pm
by Caedo
sveinung wrote:Paches welcome (from any reader)! Since I'm currently in the CanOccupyCity "area" mentally I would probably be quick to review them. If you use utype_can_do_action_result() in the 3.1 patches you won't delay generalized actions. Feel free to use utype_can_do_action() if you don't want to create a separate 3.0 patch.

I made a patch for the AI and advisor stuff in hrm#921005 (can't reassign the ticket or change its status tho). As far as grep can tell, this only leaves the Paradrop and Lua API stuff you mentioned above.

Ignatus wrote:My own idea:
Allow capturing a transporting unit. As long as we can't capture a caravel full of caravans, the piracy is just boring.

I've thought about that too, and I really like the idea, but I figure we should probably put that off until after we've figured out how transported units defending their transport works. I mean, when you've got a capturable transport full of capturable cargo, sure, everything's obviously gonna work, but boarding an enemy ship is gonna get significantly harder when they've got a score of legionnaires on board.

Re: Obligatory hard action requirements you want dropped

Posted: Thu Feb 25, 2021 7:28 pm
by Ignatus
Caedo wrote:I've thought about that too, and I really like the idea, but I figure we should probably put that off until after we've figured out how transported units defending their transport works. I mean, when you've got a capturable transport full of capturable cargo, sure, everything's obviously gonna work, but boarding an enemy ship is gonna get significantly harder when they've got a score of legionnaires on board.

"Capture units" is an action versus units, as long as it's so we won't be able to capture a transport with a single Diplomat on board if he is not capturable, so I don't see any problem with removing the hard req. Changing this behaviour with some desk fight possible or at least throwing the defenseless diplo to the sharks is another question.