[Freeciv-Dev] Terrain specials via ruleset: a sketch
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Back after a few weeks off, I'm thinking about completing the work to
define terrain entirely via ruleset, as opposed to hardcoding it. The
next step I'm starting coding is to have the terrain specials defined
via ruleset; this is obviously intricated since it has an effect of
lots of things (including unit activities), but I think the benefits
could be worth it.
The approach I've started coding is the following:
- terrain specials are now defined via ruleset, what is now hardcoded
is a number of flags that each terrain special can have. For
instance, pollution would generate anything with S_POLLUTION set,
and you could have a number of alterations, from "Car remains" to
"Acid rains", affecting diversely the tile outputs. Just an example
to settle the ideas:
[alteration_farmland]
name = "Farmland"
food = 2 # Food bonus
flags = "Irrigation", "Infrastructure"
requires = "Irrigation"
excludes = "Mine"
- this means that the settler/engineer actions need also be defined
via ruleset. I've sketched this definition as a "chain rule",
where the first matching link of the chain is applied. For
instance, let's say that there would be something like
[transform_irrigate]
name = "Irrigate"
effect = {
# Terrain / Cost / Action / Argument
"Swamp", 10, "Change", "Grassland"
# default action: farmland if available, else irrigation
"" , 4, "Build" , "Farmland"
"" , 4, "Build" , "Irrigation"
}
[transform_terraform]
name = "Terraform"
effect = {
"Desert", 6, "Change", "Plains"
...
}
(this is merely an example, I don't have the correct values in mind
now).
- but this also means that unit_activity whould be redesigned! In my
opinion, this means that ACTIVITY_IRRIGATION, _TRANSFORM and so on
should be merged within ACTIVITY_TRANSFORM, the argument of which
would no longer be a "target terrain" but a "target transformation"
(which would be slightly more wide-scoped).
- there are a few special cases that should (in my opinion) be
treated separately, namely:
. natural features (that is, only rivers right now), because there
would be an ad-hoc ALT_RIVER flag in the flag list, which I do not
considerate as a good design. It would even be cleaner to hardcode
them.
. huts: this could be developed into various types of lairs, for
instance the present-day huts, plus the Civ3 barbarian camps, (just
think for a second of the possibilities of this in a fantasy-like
setting! Troll nests and haunted crypts !). Well, separating it
from the other specials would provide enough room to someday do
this.
Before I start some quite heavy coding, what do you think of the
design ? (I agree that the transform chains in particular are somewhat
cumbersome, but that's the best I could think of to mimic the Civ
behaviour).
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] Terrain specials via ruleset: a sketch,
Jérôme Plût <=
|
|