"Simulation" ruleset (2.5) - v1.0 released

Contribute, display and discuss rulesets and modpacks for use in Freeciv here.
User avatar
Alien Valkyrie
Elite
Posts: 513
Joined: Sun Feb 10, 2013 10:21 pm
Location: Stuttgart, Germany

Re: Corbeau's ruleset (2.5)

Post by Alien Valkyrie »

Yes, when buildings are automatically sold due to obsoletion, you do get money.
Corbeau wrote:Also, about balance: the building shouldn't really be too cheap, but if it's more expensive, once it's sold for being obsolete, it will be a source of a lot of money, too much in my opinion. Any idea about how to get around this?
I was going to say this should be possible using lua scripting (script.lua), defining a function to take some of that gold away when that specific building is sold, but it turns out that there is no such signal as "building_lost", so this would require some voodoo coding.

However, things still wouldn't be necessarily balanced if that one building is the only building giving back less gold when selling it, so you'd probably need to expand that to other buildings.

Here's a thought (though I don't know how well the AI would cope with that): Don't obsolete the building, but instead make it a requirement to build a factory. Maybe make the factory a bit cheaper to balance out the Manufaktur's costs. You could lessen its effects with Industrialization and completely deactivate it with a factory. Also, if you're going to do that, you could lower the factory's upkeep by one (again, to balance out the Manufaktur).

Also, while we're at it, I believe you should do this just for forwards compatibility:

Code: Select all

[building_manufaktur]
// ...
graphic   = "b.manufaktur"
graphic_alt   = "b.barracks_i"
// ...
That way, if someone includes a graphic for it in their tileset, they won't need to change your ruleset in order to use it.
~ AVL
User avatar
Corbeau
Elite
Posts: 1292
Joined: Mon Jan 13, 2014 11:13 pm

Re: Corbeau's ruleset (2.5)

Post by Corbeau »

Good ideas! Thanks!
--
* Freeciv LongTurn, a community of one-turn-per-day players and developers
* LongTurn Blog - information nexus with stuff and stuff and stuff
* Longturn Discord server; real-time chatting, discussing, quarrelling, trolling, gaslighting...
User avatar
JTN
Elite
Posts: 473
Joined: Wed Jan 30, 2013 12:15 am

Re: Corbeau's ruleset (2.5)

Post by JTN »

Caedo wrote:I was going to say this should be possible using lua scripting (script.lua), defining a function to take some of that gold away when that specific building is sold, but it turns out that there is no such signal as "building_lost", so this would require some voodoo coding.
(Raised hrm #695007 about this. Also it feels like we should give more ruleset control over building remuneration, but I haven't come up with a coherent design for that so haven't raised a ticket about it.)
User avatar
Corbeau
Elite
Posts: 1292
Joined: Mon Jan 13, 2014 11:13 pm

Re: Corbeau's ruleset (2.5)

Post by Corbeau »

Ok, I spent too much time on adding one building which is basically a minor and not a conceptual change so I'll just drop the code here (feel free to check if I got everything right) and move on to other things. Will update the file later.

The intention:
- Manufaktur costs 40 shields, 1 upkeep and gives 2 shields per turn
- once Industrialization is discovered, Manufaktur stops producing, upkeep remains, output is now 2 Trade (because it's effectively a museum), Factory in a city with M. costs 110 (instead of 140)
- M. is not a requirement for a factory, but it gives a 30 shields discount

Code: Select all

[building_manufaktur]
name		= _("Manufaktur")
genus		= "Improvement"
reqs	=
    { "type", "name", "range"
      "Tech", "Monarchy", "Player"
    }
graphic	= "b.manufaktur"
graphic_alt	= "b.barracks_i"
obsolete_by	= "None"
build_cost	= 40
upkeep		= 1
sabotage	= 100
sound		= "b_generic"
sound_alt	= "b_generic"
; /* xgettext:no-c-format */
helptext	= _("\
Increases production in the city by 2 Shields.\
With the onset of Industrialization, it becomes\
a museum and produces 2 Trade instead.
")

[building_factory]
name		= _("Factory")
genus		= "Improvement"
reqs	=
    { "type", "name", "range", "negated"
      "Tech", "Industrialization", "Player", FALSE
      "Building", "Manufaktur", "City", TRUE
    }
(...)
build_cost	= 140
(...)

[building_factory_mf]
name		= _("Factory")
genus		= "Improvement"
reqs	=
    { "type", "name", "range"
      "Tech", "Industrialization", "Player"
      "Building", "Manufaktur", "City"
    }
(...)
build_cost	= 110
(...)

Code: Select all

[effect_manufaktur]
type    = "Output_Add_Tile"
value   = 2
reqs    =
    { "type", "name", "range", "negate"
      "CityTile", "Center", "Local", FALSE
      "OutputType", "Shield", "Local", FALSE
      "Building", "Manufaktur", "City", FALSE
      "Tech", "Industrialization", "Player", TRUE
    }

[effect_manufaktur2]
type    = "Output_Add_Tile"
value   = 2
reqs    =
    { "type", "name", "range"
      "CityTile", "Center", "Local"
      "OutputType", "Trade", "Local"
      "Building", "Manufaktur", "City"
      "Tech", "Industrialization", "Player"
    }
Also, one general question. With "negate", the nreqs field is basically obsolete, correct?
--
* Freeciv LongTurn, a community of one-turn-per-day players and developers
* LongTurn Blog - information nexus with stuff and stuff and stuff
* Longturn Discord server; real-time chatting, discussing, quarrelling, trolling, gaslighting...
User avatar
JTN
Elite
Posts: 473
Joined: Wed Jan 30, 2013 12:15 am

Re: Corbeau's ruleset (2.5)

Post by JTN »

I think you'll need to give your two Factories different rule_names? (Maybe you already did) The "name" presented to the user can be the same for both, though.
Corbeau wrote:Also, one general question. With "negate", the nreqs field is basically obsolete, correct?
Correct. They will be gone by 3.0.
User avatar
Corbeau
Elite
Posts: 1292
Joined: Mon Jan 13, 2014 11:13 pm

Re: Corbeau's ruleset (2.5)

Post by Corbeau »

I thought rule_name is optional? At least that's what it says at the beginning of the file...
--
* Freeciv LongTurn, a community of one-turn-per-day players and developers
* LongTurn Blog - information nexus with stuff and stuff and stuff
* Longturn Discord server; real-time chatting, discussing, quarrelling, trolling, gaslighting...
cazfi
Elite
Posts: 3095
Joined: Tue Jan 29, 2013 6:54 pm

Re: Corbeau's ruleset (2.5)

Post by cazfi »

Corbeau wrote:I thought rule_name is optional? At least that's what it says at the beginning of the file...
It does default to name so you often don't need to give it, but internally it's not optional. In this case you have to give it explicitly as you don't want both of them to get same value from the same name (ruleset won't load)
Remember to add also separate effects for both types.
cazfi
Elite
Posts: 3095
Joined: Tue Jan 29, 2013 6:54 pm

Re: Corbeau's ruleset (2.5)

Post by cazfi »

JTN wrote:
Corbeau wrote:Also, one general question. With "negate", the nreqs field is basically obsolete, correct?
Correct. They will be gone by 3.0.
...but in 2.5 negate does not work for effect requirements as well as nreqs. Especially AI will just ignore the negate flag. This is fixed in 2.6.
User avatar
Corbeau
Elite
Posts: 1292
Joined: Mon Jan 13, 2014 11:13 pm

Re: Corbeau's ruleset (2.5)

Post by Corbeau »

...and when I think I'm out, they pull me back in :P Ok, will do :)

As for this:
in 2.5 negate does not work for effect requirements as well as nreqs
Please clarify "as well".

For the record, I don't care about AIs.
--
* Freeciv LongTurn, a community of one-turn-per-day players and developers
* LongTurn Blog - information nexus with stuff and stuff and stuff
* Longturn Discord server; real-time chatting, discussing, quarrelling, trolling, gaslighting...
User avatar
JTN
Elite
Posts: 473
Joined: Wed Jan 30, 2013 12:15 am

Re: Corbeau's ruleset (2.5)

Post by JTN »

If you don't care about AIs, as I recall, the main thing that used nreqs as a hint was the bit of UI that crosses out Power Plant in your city's building list as obsolete once you have a Nuclear Plant. I think some of the autogenerated help will be a bit odd too if you use 'negated' rather than 'nreqs'. (But I haven't gone back over the old discussion in detail.)
Post Reply