Page 2 of 2

Re: Problem starting with a ruleset

Posted: Sun Nov 12, 2017 3:56 pm
by Corbeau
Here it is.

For the record, just after Founders there is the Settlers definition.

When I load the ruleset with this, I get three Settlers at the start of the game (setting ic "cccwwwxxxx", Workers and Explorers are there). When I simply delete "NoBuild" (and the comma before it) and reload the ruleset, the game starts with three Founders (and Ws and Xs).

Code: Select all

[unit_founders]
name          = _("Founders")
class         = "Small Land"
tech_req      = "None"
obsolete_by   = "None"
graphic       = "u.settlers"
graphic_alt   = "-"
sound_move    = "m_settlers"
sound_move_alt = "m_generic"
sound_fight   = "f_settlers"
sound_fight_alt = "f_generic"
build_cost    = 40
pop_cost      = 1
attack        = 0
defense       = 1
hitpoints     = 20
firepower     = 1
move_rate     = 3
vision_radius_sq = 5
transport_cap = 0
fuel          = 0
uk_happy      = 0
uk_shield     = 1
uk_food       = 1
uk_gold       = 0
flags         = "Settlers", "NonMil", "AddToCity", "Cities", "IgTer", "NoBuild"
; No veteran levels (level name is never displayed)
veteran_names = _("green")
veteran_raise_chance = 0
veteran_work_raise_chance = 0
veteran_power_fact = 100
veteran_move_bonus = 0
roles         = "Cities"
helptext      = _("\
Settlers are one of the key units in the game, as they are your main\
 means of founding new cities.\
"), _("\
Settlers can also perform some of the same terrain alterations as\
 Workers.\
"), _("\
Upkeep for Settlers is in food as well as production, and a Settler\
 can die if its supporting city runs out of food. Settlers in a\
 Republic or Democracy require twice as much food per turn, and in\
 Fundamentalist societies, three times as much.\
")

Re: Problem starting with a ruleset

Posted: Sun Nov 12, 2017 4:53 pm
by Caedo
I think somewhere in the server code, there's a check to make sure there's a "Cities" unit you can build. It might be possible that for whatever reason, that unit will be the preferred starting unit.

I'll check the source for any traces of that. In the meantime, you could try fixing your problem with some voodoo coding, e.g. a lua script that runs at the beginning of the first game turn and replaces each and every unit of Settlers with a unit of Founders. Alternatively, you could have Founders obsoleted by Settlers with a tech that cannot be researched (i.e. a tech that's its own root_req), then remove the NoBuild flag from founders but immediately give the tech to every player that doesn't have it at the beginning of every turn.

EDIT: I've found the problem, right here. Only buildable units are valid starting units.

Re: Problem starting with a ruleset

Posted: Sun Nov 12, 2017 5:01 pm
by wieder
Weird... Also can't get it working. I copied the founders to the ruleset and switched the following likes from settlers to founders and from founders to settlers.

[unit_settlers]
name = _("Settlers")

[unit_founders]
name = _("Founders")

As a result I get settlers but I can still build those while founders are not on the list.

However once I added also the "NoHome" flag, it started working. You probably should add that and it should work.

Re: Problem starting with a ruleset

Posted: Sun Nov 12, 2017 5:12 pm
by Caedo
wieder wrote:However once I added also the "NoHome" flag, it started working. You probably should add that and it should work.

Hm, that surprises me. I mean, of course, it works for the GameLoss, but still. I can't find any reference to NoHome that would make it do that.

Oh well, maybe GitHub's search feature just sucks.

EDIT: Alright, the thing with King working is because there is no other GameLoss unit that can be built, so it resorts to ones you can't build yet.
Again, this would allow a voodoo solution by adding a non-researchable tech required to build settlers. It wouldn't even be necessary to make the founders obsoleted by settlers.

Re: Problem starting with a ruleset

Posted: Sun Nov 12, 2017 7:09 pm
by cazfi
Yeah, you have to wait for freeciv-2.6 to make cleaner separation of startunit roles and other roles.

Re: Problem starting with a ruleset

Posted: Sun Nov 12, 2017 8:07 pm
by Corbeau
Huh, ok, "NoHome" didnt work and I wasn't in the mood for learning LUA and also "giving all players a tech" was a bit too much work, so in the end I did the following:

1. Founder can be built, but costs 60 shields (Settler is 30)
2. Settler obsoletes Founder
3. Requirement for Settler is tech called "City Building" (may rethink the name)
4. "City Building" has no requirements, is not a prerequisite for anything and costs 1 bulb. Yes, there will be start settings where this cost is ignored, but what the hell.

In the end, it's a bit clumsy solution and I'm not too happy with it, but it works and until I think of something better, it will do.

Thanks for the replies and ideas.

Re: Problem starting with a ruleset

Posted: Sun Nov 12, 2017 8:13 pm
by wieder
Did you try the same I did when I got it working? I made settlers with NoHome and NoBuild and the game started with the player having settlers. However the player can't build those but only Founders. Maybe there is some hard coded stuff in 2.5 (just a guess) that requires the player to have settlers in the start?

This is how it worked for me:

[unit_founders]
name = _("Founders")
class = "Small Land"
tech_req = "None"
obsolete_by = "Colonists"
graphic = "u.settlers"
graphic_alt = "-"
sound_move = "m_settlers"
sound_move_alt = "m_generic"
sound_fight = "f_settlers"
sound_fight_alt = "f_generic"
build_cost = 30
pop_cost = 2
attack = 0
defense = 1
hitpoints = 20
firepower = 1
move_rate = 3
vision_radius_sq = 18
transport_cap = 0
fuel = 0
uk_happy = 0
uk_shield = 1
uk_food = 0
uk_gold = 1
flags = "Settlers", "NonMil", "Cities"
; No veteran levels (level name is never displayed)
veteran_names = _("green")
veteran_raise_chance = 0
veteran_work_raise_chance = 0
veteran_power_fact = 100
veteran_move_bonus = 0
roles = "Cities"
helptext = _("\
Settlers are one of the key units in the game, as they are your main \
means of founding new cities.\
"), _("\
Settlers can also perform some of the same terrain alterations as \
Workers.\
"), _("\
TIP: optimal production of Settlers occurs in cities of at most \
size 4, or cities with a Granary of at most size 6.\
")



[unit_settlers]
name = _("Settlers")
class = "Small Land"
tech_req = "None"
obsolete_by = "None"
graphic = "u.settlers"
graphic_alt = "-"
sound_move = "m_settlers"
sound_move_alt = "m_generic"
sound_fight = "f_settlers"
sound_fight_alt = "f_generic"
build_cost = 40
pop_cost = 1
attack = 0
defense = 1
hitpoints = 20
firepower = 1
move_rate = 3
vision_radius_sq = 5
transport_cap = 0
fuel = 0
uk_happy = 0
uk_shield = 1
uk_food = 1
uk_gold = 0
flags = "Settlers", "NonMil", "AddToCity", "Cities", "IgTer", "NoHome" ,"NoBuild"
; No veteran levels (level name is never displayed)
veteran_names = _("green")
veteran_raise_chance = 0
veteran_work_raise_chance = 0
veteran_power_fact = 100
veteran_move_bonus = 0
roles = "Cities"
helptext = _("\
Settlers are one of the key units in the game, as they are your main\
means of founding new cities.\
"), _("\
Settlers can also perform some of the same terrain alterations as\
Workers.\
"), _("\
Upkeep for Settlers is in food as well as production, and a Settler\
can die if its supporting city runs out of food. Settlers in a\
Republic or Democracy require twice as much food per turn, and in\
Fundamentalist societies, three times as much.\
")

Re: Problem starting with a ruleset

Posted: Sun Nov 12, 2017 8:27 pm
by Corbeau
Hm, I copy/pasted this into the ruleset and firt I got a warning that there are no "Colonists". Then I changed that to "Settlers" and got Founders at the start.

Re: Problem starting with a ruleset

Posted: Sun Nov 12, 2017 8:40 pm
by wieder
Oh, right. I did the edit on LT40 ruleset. This gets confusing :)