Problem with variable city radius

Contribute, display and discuss rulesets and modpacks for use in Freeciv here.
Post Reply
Jacew
Posts: 23
Joined: Thu Apr 30, 2015 8:45 am

Problem with variable city radius

Post by Jacew »

Hello from Finland.

I've been building up a Freeciv mod some time now. One thing I've added is the variable city radius depending of numerous reqs.

For some reason, everytime I add following lines to effects.ruleset, game crashes during first 10 turns or so. Remove them and game works just fine, though I can't find anything wrong with them.

Code: Select all

; City radius under Republic - radius is sqrt(n +2) (2,83 - 3,74)
[effect_city_radius_republic_1]
type    = "City_Radius_Sq"
value   = 2
reqs    =
    { "type", "name", "range"
	"Building", "Courthouse", "City"
	"Gov", "Republic", "Player"
    }
nreqs    =
    { "type", "name", "range"
	"Building", "Palace", "City"
    }

; City radius under Republic - radius is sqrt(n +3) (2,83 - 4)
[effect_city_radius_republic_2]
type    = "City_Radius_Sq"
value   = 3
reqs    =
    { "type", "name", "range"
	"Building", "Palace", "City"
	"Gov", "Republic", "Player"
    }

; City radius under Democracy - radius is sqrt(n +5) (3 - 4,24)
[effect_city_radius_democracy_1]
type    = "City_Radius_Sq"
value   = 5
reqs    =
    { "type", "name", "range"
      "Building", "Courthouse", "City"
	"Gov", "Democracy", "Player"
    }
nreqs   =
    { "type", "name", "range"
      "Building", "Palace", "City"
    }

; City radius under Democracy - radius is sqrt(n +5) (3,16 - 4,24)
[effect_city_radius_democracy_2]
type    = "City_Radius_Sq"
value   = 5
reqs    =
    { "type", "name", "range"
      "Building", "Palace", "City"
	"Gov", "Democracy", "Player"
    }
I have Freeciv 2.5.0 GTK2 on WIndows
User avatar
Alien Valkyrie
Elite
Posts: 513
Joined: Sun Feb 10, 2013 10:21 pm
Location: Stuttgart, Germany

Re: Problem with variable city radius

Post by Alien Valkyrie »

In README.effects it says that City_Radius_Sq can only usefully have "MinSize", "Building", or "Tech" requirements. Maybe it just doesn't work with "Gov" requirements.
Is there any error message when the game crashes?
~ AVL
cazfi
Elite
Posts: 3077
Joined: Tue Jan 29, 2013 6:54 pm

Re: Problem with variable city radius

Post by cazfi »

Just adding those effects to 2.5 classic ruleset seems not to be enough to reproduce the problem. Is it your server or client crashing? Do you have both human and AI players in game? Does it need all these four effects for the crash to take place, or could you remove some of them to limit problem search further?

The reson README.effects says that reqs other than MinSize, Buildin,g and Tech are not (fully) supported is that city radius updates do not necessarily take place immediately after the state of other reqs change (at some point it worked so that city radius updated only when city growed next time - maybe dozens of turns after the req had been enabled). Certainly it should not crash with any reqs.
sveinung
Elite
Posts: 548
Joined: Wed Feb 20, 2013 4:50 pm

Re: Problem with variable city radius

Post by sveinung »

I just added your effects to classic in a debug build of what will become 2.5.1 on Debian. I then started an AI only game. It got to turn 100 before I stopped it. Many assertion failures were reported. (The code that reports problems in the debug build may have prevented the crash)
Jacew
Posts: 23
Joined: Thu Apr 30, 2015 8:45 am

Re: Problem with variable city radius

Post by Jacew »

I play against AI with phasemode "PLAYER". I recall that caused a pile of error messages In beta version, so could it be something in there?

It seems problem is clearly linked with "gov" requisite for City Radius changes. Every test has ended in crash when I've tried to apply it.

It's client that crashes, with traditional error message "program has done illegal operation and must be terminated" or something like that.
cazfi
Elite
Posts: 3077
Joined: Tue Jan 29, 2013 6:54 pm

Re: Problem with variable city radius

Post by cazfi »

Jacew wrote:It's client that crashes
I managed to reproduce related server assert now.

When the AI tests what would happen if it switched to another government, something goes wrong in the city worker placement, presumably because the city radius (tiles to place workers to) is not what some part of the code assumes.
cazfi
Elite
Posts: 3077
Joined: Tue Jan 29, 2013 6:54 pm

Re: Problem with variable city radius

Post by cazfi »

cazfi wrote:I managed to reproduce related server assert now.
bug #23591
Post Reply