Ticket #47737

civ2civ3: "Aerial" unit class flag

Open Date: 2023-04-01 23:36 Last Update: 2023-10-02 23:17

Reporter:
Owner:
Type:
Status:
Closed
Component:
MileStone:
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
Fixed
File:
3

Details

civ2iv3 would benefit from "Aerial" user unit class flag. So long requirement lists to exclude every other unit class except "Air" and "Helicopter" could be turned to just to requirement of one unit class flag.

There's also other long requirement lists where user flags might help.

Ticket History (3/11 Histories)

2023-04-01 23:36 Updated by: cazfi
  • New Ticket "civ2civ3: "Aerial" unit class flag" created
2023-04-06 22:06 Updated by: bard
Comment

Good to know.

There are also cases where a "ground" or "naval" flag would be useful, like the following:

[effect_mountains_vision]
type    = "Unit_Vision_Radius_Sq"
value   = 4
reqs    =
    { "type", "name", "range", "present"
      "Terrain", "Mountains", "Local", TRUE
;      "UnitClass", "Land", "Local", FALSE
;      "UnitClass", "Small Land", "Local", FALSE
;      "UnitClass", "Big Land", "Local", FALSE
;      "UnitClass", "Merchant", "Local", FALSE
      "UnitClass", "Sea", "Local", FALSE
      "UnitClass", "Trireme", "Local", FALSE
      "UnitClass", "Helicopter", "Local", FALSE
      "UnitClass", "Air", "Local", FALSE
      "UnitClass", "Missile", "Local", FALSE
    }

I did not know the performance was noticeable in those cases. Btw, if flags are not used, what would be better for performance: 1 single effect with 5 requirements, or 4 effects with 1 requirement each one? There are cases with 6 and 3; or even 7 and 2 too.

2023-04-06 22:27 Updated by: cazfi
Comment

Reply To bard

what would be better for performance: 1 single effect with 5 requirements, or 4 effects with 1 requirement each one?

Note: Had to use word "non-expensive" in the following, as my original comment got rejected as spam-like.

I don't think it makes sense to try to optimize on that level. What would be best on one freeciv version can very well be worse one with the next version because of some internal changes. In extreme cases you could gain something by ordering requirements smartly (if you have a requirement that is likely not to be fulfilled + non-expensive to check & another that is likely fulfilled + expensive to check, by placing the former first you make the requirement checking to terminate most of the time after performing just the non-expensive check) - and again, the "expensive checks" are what we most likely try to improve internally, so it can turn to be the least expensive one, e.g., just a lookup from some cache, on the next release.

2023-06-09 07:13 Updated by: cazfi
2023-09-24 01:37 Updated by: cazfi
Comment

There are some cases where "Missile" should be included, and others where it should not be. Likely we need two separate Unit Class Flags, and term "Aerial" sounds like it includes Missiles. Maybe have the other by name "AirVehicle"?

2023-09-24 01:42 Updated by: cazfi
Comment

Ground -> #48711
Naval -> #48712

2023-09-28 02:57 Updated by: cazfi
  • Owner Update from (None) to cazfi
  • Resolution Update from None to Accepted
2023-10-02 23:17 Updated by: cazfi
  • Status Update from Open to Closed
  • Resolution Update from Accepted to Fixed

Edit

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login