Page 1 of 1

Problem with variable city radius

Posted: Thu Apr 30, 2015 9:03 am
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

Re: Problem with variable city radius

Posted: Thu Apr 30, 2015 4:02 pm
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?

Re: Problem with variable city radius

Posted: Thu Apr 30, 2015 4:45 pm
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.

Re: Problem with variable city radius

Posted: Thu Apr 30, 2015 4:48 pm
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)

Re: Problem with variable city radius

Posted: Mon May 11, 2015 5:50 pm
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.

Re: Problem with variable city radius

Posted: Tue May 12, 2015 3:43 pm
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.

Re: Problem with variable city radius

Posted: Tue May 12, 2015 5:13 pm
by cazfi
cazfi wrote:I managed to reproduce related server assert now.
bug #23591