City_Vision_Radius_Sq effect and init_vis_radius_sq

Contribute, display and discuss rulesets and modpacks for use in Freeciv here.
Post Reply
Dino the Dinosore
Hardened
Posts: 171
Joined: Sun Dec 31, 2017 3:41 am

City_Vision_Radius_Sq effect and init_vis_radius_sq

Post by Dino the Dinosore »

First I edited the https://freeciv.fandom.com/wiki/Editing_Effects page entry for the City_Radius_Sq effect, adding that the initial value is set by the "init_city_radius_sq = X" in game.ruleset. Then, thinking that the City_Vision_Radius_Sq did something similar with the init_vis_radius_sq setting, I editing the City_Vision_Radius_Sq effect to say that. But when my experimenting convinced me that was wrong, I searched the source code for init_vis_radius_sq and found that it is only used in file gamehand.c function place_starting_unit(), to show visible area around a start unit.

Meanwhile I started getting assert errors

Code: Select all

in map_change_seen() [../../freeciv-3.0.0/server/maphand.c::957]: assertion 'plrtile->seen_count[V_INVIS] + !game.info.fogofwar <= plrtile->seen_count[V_MAIN]' failed.
Please report this message at https://osdn.net/projects/freeciv/ticket/
in city_refresh_vision() [../../freeciv-3.0.0/server/citytools.c::3117]: assertion '(pcity->server.vision)->radius_sq[V_MAIN] >= (pcity->server.vision)->radius_sq[V_INVIS]' failed.
Please report this message at https://osdn.net/projects/freeciv/ticket/
which I eventually figured out were caused by my ruleset file effects.ruleset not having a City_Vision_Radius_Sq effect with no reqs. Every other ruleset I have looked at has a City_Vision_Radius_Sq effect with no reqs, so I figured it was my mistake and not a bug. So I re-edited the wiki page City_Vision_Radius_Sq entry to say that there needs to be one of these with no requirements to set the initial value.

Now that entry has been edited again to refer to init_vis_radius_sq, so I'm confused.

If init_vis_radius_sq really only affects start units, it would be good to update the comment line in game.ruleset. It now is

Code: Select all

; Square of initially visible radius (true distance).
Suggest

Code: Select all

; Square of initially visible radius for start units (true distance).
And, should I file a ticket for the assert errors when there's no City_Vision_Radius_Sq effect with no reqs? It only happens when semi-competent ruleset changers like me push the envelope.
cazfi
Elite
Posts: 3227
Joined: Tue Jan 29, 2013 6:54 pm

Re: City_Vision_Radius_Sq effect and init_vis_radius_sq

Post by cazfi »

Dino the Dinosore wrote:If init_vis_radius_sq really only affects start units, it would be good to update the comment line in game.ruleset. It now is

Code: Select all

; Square of initially visible radius (true distance).
Suggest

Code: Select all

; Square of initially visible radius for start units (true distance).
Maybe "Square of initially revealed map area radius (true distance)". I don't think it has anything to do with units (you could get it even if you had no start units but only start city), nor is it technically a "vision" (the area will be revealed, but fogged, if no unit actually gives the vision).
This would be one ticket.
Dino the Dinosore wrote:And, should I file a ticket for the assert errors when there's no City_Vision_Radius_Sq effect with no reqs? It only happens when semi-competent ruleset changers like me push the envelope.
Yes, please. Ideally we should have ruleset loading time sanity check for this.
Dino the Dinosore
Hardened
Posts: 171
Joined: Sun Dec 31, 2017 3:41 am

Re: City_Vision_Radius_Sq effect and init_vis_radius_sq

Post by Dino the Dinosore »

Did some testing with no start units and a start city, and found changing the init_vis_radius_sq value did not affect what's visible, but changing the value of the City_Vision_Radius_Sq effect with no reqs did. So I think init_vis_radius_sq does only affect start units.

Filed ticket for 'no City_Vision_Radius_Sq effect with no reqs' problem.
cazfi
Elite
Posts: 3227
Joined: Tue Jan 29, 2013 6:54 pm

Re: City_Vision_Radius_Sq effect and init_vis_radius_sq

Post by cazfi »

Dino the Dinosore wrote:Did some testing with no start units and a start city, and found changing the init_vis_radius_sq value did not affect what's visible
Seems so, but it's definitely a bug. For rulesets with vision_reveal_tiles = FALSE, there's nothing visible in the beginning of the game and the start city can't work any tiles.
Dino the Dinosore
Hardened
Posts: 171
Joined: Sun Dec 31, 2017 3:41 am

Re: City_Vision_Radius_Sq effect and init_vis_radius_sq

Post by Dino the Dinosore »

Still wondering what the https://freeciv.fandom.com/wiki/Editing_Effects wiki page entry for the City_Vision_Radius_Sq effect should say. I think this is most correct -
Increase city vision radius in squared distance by amount. There needs to be one of these with no requirements to set the inital value.
Post Reply