Dumb question on terrain identifiers... Case Sensitive?

Various topics about the game, the website, or anything else Freeciv related that doesn't fit elsewhere.
Post Reply
omero
Posts: 48
Joined: Fri Mar 31, 2023 10:43 am

Dumb question on terrain identifiers... Case Sensitive?

Post by omero »

I did some research around but could not find a definitive answer, hence the dumb questions:
1) are identifiers case sensitive?
2) if not, what prevents adding a 'upper case' identifier to allow _more_ resources/specials?

I am interested in 'distribution/placement' as discussed here: https://forum.freeciv.org/f/viewtopic. ... 6a#p104733

I am somehow wary of recurring to the 'trick' of listing a resource several times to allow it to appear more 'easily'... Thus, how about having a more resources, identified by ... uhm... a different identifier?

In other words: 'u' and 'U' and of course 'i' and 'I'.

Example follows. Does that makes sense?

EDIT: for sake of discussion, I am using my terrain.ruleset as a base for the example.

Code: Select all

[omero@naldvras:~/freeciv269/share/freeciv/orxperimental]
$egrep identifier terrain.ruleset | sed -e 's@identifier.[[:blank:]]*=@identifier =@'

Code: Select all

; Roughly sorted by identifier.
; identifier = single-character identifier used in savegames. This
identifier = "i"
identifier = "+"
identifier = " "
identifier = ":"
identifier = "a"
identifier = "d"
identifier = "f"
identifier = "g"
identifier = "h"
identifier = "j"
identifier = "m"
identifier = "p"
identifier = "s"
identifier = "t"
; Roughly sorted by identifier.
; identifier = single-character identifier used in savegames.  This
identifier = "$"
identifier = "/"
identifier = "e"
identifier = "d"
identifier = "u"
identifier = "c"
identifier = "y"
identifier = "f"
identifier = "g"
identifier = "h"
identifier = "b"
identifier = "j"
identifier = "o"
identifier = "O"
identifier = "a"
identifier = "p"
identifier = "r"
identifier = "i"
identifier = "L"
identifier = "s"
identifier = "t"
identifier = "T"
identifier = "S"
identifier = "v"
identifier = "U"
identifier = "P"
identifier = "w"
identifier = "x"
EDIT2:

Code: Select all

$egrep reserved terrain.ruleset
; "h" reserved for strategic horses
; "k" reserved for (cane) sugar
; "l" reserved for tobacco
; "m" reserved for marble
; "r" reserved for rubber
; "u" reserved for uranium
Thus... What would happen when one uses 'H', 'K', 'M'...
I have been 'orxperimenting' a little and so far... all seems fine (v2.6) but unsure of potential consequences/conflicts in case of modpack release?

I want deserts to offer Barrel Cacti (plural of a cactus) and Barrelcactiplus (yes, its a codeword for ... more Cacti). I would like swamps to offer more than Peat and Spice (Marshplant and Marshplantplus)... That would help with more diverse distribution of resources.

All that is needed is ... More identifiers? Instead of LUA tricks.
Attachments
terrain.png
terrain.png (248.74 KiB) Viewed 7467 times
cazfi
Elite
Posts: 3111
Joined: Tue Jan 29, 2013 6:54 pm

Re: Dumb question on terrain identifiers... Case Sensitive?

Post by cazfi »

Resources are not known by identifiers, but by names. In savegames extras are known by their number, but I'm not sure what's the situation in 2.6 where resources did not count as extras.

Freeciv-3.2 (and later) also have the resource frequency defined separately: osdn #43563
omero
Posts: 48
Joined: Fri Mar 31, 2023 10:43 am

Re: Dumb question on terrain identifiers... Case Sensitive?

Post by omero »

cazfi wrote: Sat May 06, 2023 7:44 am Resources are not known by identifiers, but by names. In savegames extras are known by their number, but I'm not sure what's the situation in 2.6 where resources did not count as extras.

Freeciv-3.2 (and later) also have the resource frequency defined separately: osdn #43563
I am (somewhat) relieved to hear (read) that resources are not depending on that 'identifier' ... field? ... in the terrain.ruleset datafile... And at the same time confused for the reason having that 'identifier' field there. With comments suggesting some of those identifiers were "reserved" (as in do not use this identifier, its meant for future pourposes).

That 'resource frequency/distribution' thing ... It's been on my personal wishlist for a while, like this 'resource' is common/uncommon/RARE, should be limited in places like 'shores' or 'deep within a forest' ... Etcetera, Etcetera.

Thank you for the answer!
cazfi
Elite
Posts: 3111
Joined: Tue Jan 29, 2013 6:54 pm

Re: Dumb question on terrain identifiers... Case Sensitive?

Post by cazfi »

omero wrote: Thu May 11, 2023 12:28 pmI am (somewhat) relieved to hear (read) that resources are not depending on that 'identifier' ... field? ... in the terrain.ruleset datafile... And at the same time confused for the reason having that 'identifier' field there. With comments suggesting some of those identifiers were "reserved" (as in do not use this identifier, its meant for future pourposes).
The documentation about resource identifiers say:

; identifier = single-character identifier used in old savegames. This
; must be unique for each resource, and changing it will
; break loading those old savegames.

If those old savegames really are the only reason resource identifiers (still) exist, then we wouldn't even need them for any new resources. That's not to say that the ruleset loading code would allow ruleset author to leave them out, but we should be able to drop that requirement from the code level.
Just don't change existing ones.

I'll try to look deeper in to this coming weekend.
cazfi
Elite
Posts: 3111
Joined: Tue Jan 29, 2013 6:54 pm

Re: Dumb question on terrain identifiers... Case Sensitive?

Post by cazfi »

omero
Posts: 48
Joined: Fri Mar 31, 2023 10:43 am

Re: Dumb question on terrain identifiers... Case Sensitive?

Post by omero »

cazfi wrote: Thu May 11, 2023 1:39 pm -> osdn #48020
Very nice!
Essentially, in order to avoid conflicts and maintain reverse compatibility with old savefiles, I just just filled the 'identifier' field with (unused) upper case letters (like "O" for the Oasisplus, for instance)... Good that in fact, resources/terrains use already a proper naming now, thus no troubles ahead :-D

Sincerely yours,
Omero (The Troublemaker)
Post Reply