[Freeciv-tickets] [freeciv] #42659: Unhardcode autoupgrade

Back to archive index
OSDN Ticket System norep****@osdn*****
Thu Apr 14 02:45:18 JST 2022


#42659: Unhardcode autoupgrade

  Open Date: 2021-07-23 01:19
Last Update: 2022-04-13 19:45

URL for this Ticket:
    https://osdn.net//projects/freeciv/ticket/42659
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=42659

---------------------------------------------------------------------

Last Changes/Comment on this Ticket:
2022-04-13 19:45 Updated by: alienvalkyrie

Comment:

Reply To ihnatus
My idea that mostly has inspired this group of tickets was to make it possible to use different buildings for upgrading different unit classes (it's only one way you can improve Leonardo, maybe it's also natural that it works only in native cities etc.). AI should have a hint that such buildings have positive effects, that without much code rewriting is done by supplying the old Leonardo effect but doing a bit different thing on the gameboard.
I actually had my own idea for that kind of thing a while back (involving the Upgrade_Unit effect being evaluated at unit level, rather than at player level), but I didn't act on it, since it becomes moot when unhardcoded anyway.
the "gimmicks" like Leonardo or Internet effects, should be written in a script engine to be easily replaced by some other gimmick a ruleset author may invent
Oh yeah, long-term, absolutely; I'm just not convinced the short-term advantages of having half a solution now outweigh the long-term difficulties from having half a solution in the way when trying to put in a new, full solution.
I had some ideas about binding sophisticated ruleset features to AI tactics. (...)
We're topic drifting a bit here (I'll open a separate AI hinting metaticket later when I'm less busy), but I feel like a bespoke solution might be called for here; I was thinking attaching special hints to user-defined stuff like unit type/class and terrain flags, and (when we add them) custom user actions, custom effect types etc. That might strike the balance between expressiveness and ease-of use for ruleset authors.

---------------------------------------------------------------------
Ticket Status:

      Reporter: ihnatus
         Owner: (None)
          Type: Feature Requests
        Status: Open
      Priority: 5 - Medium
     MileStone: S3_1 d3f
     Component: General
      Severity: 5 - Medium
    Resolution: None
---------------------------------------------------------------------

Ticket details:

Autoupgrade (Leonardo effect) is a gimmick bonus, like hut findings, but it is now hardcoded. The result is, we can't have any good way for adding flexibility to it (e.g., upgrade only units in domestic borders, or have wonders that upgrade different classes separately). So, the logical solution is: write autoupgrade code into a Lua callback in default.lua, and the effect "Upgrade_Unit" will just be used by AI and autohelp as it is, and the default callback looks at it but some other one might not. To do it, we must develop in separate tickets:
"phase_end" signal (called in srv_main.c when we now deal with this effect, after do_tech_parasite_effect() and before  player_restore_units() from which we cut do_upgrade_effects());
API to do the things do_upgrade_effects() does:
void (Unit):transform(Unit_Type to_what, bool dont_lose_veteranship) -- maybe the second parameter may be unhardcoded further?
an API for unit_upgrade_test(punit, TRUE). Suggestion:
string (Unit):transform_blocker(Unit_Type tf_to) -- possible values: nil, "cargo", "transport", "tile"; maybe numeric results and constants table for less garbage
Unit_Type (Unit_Type):upgrade_type(Player owner) --for can_upgrade_unittype(), maybe also a shortcut Unit_Type (Unit):upgrade_type(); nil if can't yet upgrade
maybe as more low-level control of the previous: Unit_Type (Unit_Type).obsoleted_by and bool (Player):can_build_direct(Unit_Type utype).

-- 
Ticket information of Freeciv project
Freeciv Project is hosted on OSDN

Project URL: https://osdn.net/projects/freeciv/
OSDN: https://osdn.net

URL for this Ticket:
    https://osdn.net/projects/freeciv/ticket/42659
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=42659



More information about the Freeciv-tickets mailing list
Back to archive index