Going wild with animals

Contribute, display and discuss rulesets and modpacks for use in Freeciv here.
Dino the Dinosore
Hardened
Posts: 171
Joined: Sun Dec 31, 2017 3:41 am

Going wild with animals

Post by Dino the Dinosore »

To use the new wild animals feature available in 2.6 you need a customized ruleset. Here's a write-up of what you have to do. Maybe I should add this to the Wiki - but where?

1 You need the animal graphics. I used the (amplio2) "animals.png" file, link -
http://forum.freeciv.org/f/download/fil ... &mode=view
This file goes in "...share/freeciv/amplio2/animals.png"

2 Need a new file "..share/freeciv/amplio2/animals.spec" which refers to that "animals.png" file with these lines -

Code: Select all

[file]
gfx = "amplio2/animals"
You can download the "animals.spec" file from the same link.

3 That file needs to be referenced by the "...share/freeciv/amplio2.tilespec" file, which needs lines -

Code: Select all

files =
  "amplio2/animals.spec",
or you can download the "amplio2.tilespec" file from the same link.

In the next steps, "dino" is the name of my custom ruleset, substitute it with the name of yours.

4 Edit "..share/freeciv/dino/terrain.ruleset" and add the terrain(s) for each animal. For example, under [terrain_deep_ocean] edit the line

Code: Select all

animal               = "Kraken"
You can have only one animal per terrain type, but can have the same animal on multiple terrains.

5 Edit "..share/freeciv/dino/units.ruleset" to add the animal units. The Kraken example -

Code: Select all

[unit_animal_kraken]
name          = _("Kraken")
class         = "Sea"
tech_req      = "None"
obsolete_by   = "None"
graphic       = "u.kraken"
graphic_alt   = "None"
sound_move    = "m_generic"
sound_move_alt = "m_generic"
sound_fight   = "f_generic"
sound_fight_alt = "f_generic"
build_cost    = 10
pop_cost      = 0
attack        = 2
defense       = 1
hitpoints     = 10
firepower     = 1
move_rate     = 2
vision_radius_sq = 2
transport_cap = 0
fuel          = 0
uk_happy      = 0
uk_shield     = 1
uk_food       = 0
uk_gold       = 1
flags         = "NoBuild", "Cant_Fortify", "Unbribable", "IgZOC"
roles         = ""
helptext      = _("\
Watch out for wild animals.\
"), _("\
Krakens live in Deep Oceans, and can attack adjacent tiles.\
")
6 To stop the animals from quickly disappearing, edit "..share/freeciv/dino/effects.ruleset". The section [effect_barb_disappear] needs a line added so it looks like this -

Code: Select all

[effect_barb_disappear]
type    = "Retire_Pct"
value   = 10
reqs    =
    { "type", "name", "range", "present"
      "NationGroup", "Barbarian", "Player", TRUE
      "Nation", "Animal Kingdom", "Player", FALSE
      "Age", "5", "Local", TRUE
      "CityTile", "Center", "Local", FALSE
    }
7 Edit your "..share/freeciv/dino/README.dino"

Optional stuff:

8 If you would like to have killing an animal give a bonus, edit your "..share/freeciv/dino/script.lua" and add a unit_lost_callback(). See this link -

http://forum.freeciv.org/f/viewtopic.ph ... 556#p98995

9 Since the start of the game is now more dangerous, I like to add a strong defender to the start units. In file "..share/freeciv/dino/game.ruleset" -

Code: Select all

set =
    { "name", "value", "lock"
      "startunits", "cwxD", FALSE
      ...
10 File "..share/freeciv/dino/game.ruleset" can also change the default # of animals, which is usually set to 20. For example, to change it to 30, use

Code: Select all

set =
...
      "animals", 30, FALSE
XYZ
Elite
Posts: 432
Joined: Fri Jan 31, 2014 12:00 pm

Re: Going wild with animals

Post by XYZ »

Cool that you give this a new spin! A long time ago I added a few new animals and completed the missing beasts. You might wanna use these sprites since I also made the animals for trident.

I wouldn't bother with the "shadow" and duplicate animals. The explanation for that is here:
Re: Art wanted for showcasing game engine features (2.6+)
Postby bard » Fri Sep 21, 2018 5:56 pm

XYZ wrote:
Can someone explain me these columns/rows?

I see 2 bears, columns not matching, a black panther and a leopard that look pretty much the same (for the last 2 rows). Are the 3 other rows above even relevant?

Added a polar bear btw...

I need about 5 min to add a new animal for Amplio (all pictures CC0). Shall I get a hippo, rhino and an elephant? I made a black panther for trident so cougar and leopard out?

Is my row now correct?

bard wrote:
If you plan to add the units to amplio tileset, then the 3th row is the only one relevant (4th line is the same without shadows).
The 2 first rows where made for chess tileset that I like to use sometimes. You may ignore them.

I like the black panther to replace leopard/cougar, this way it can appear in both asian and american maps.
The selection of animals in your version with polar bear looks good to me, but I suggest to use the gfx from the 3th row (with shadows) that look much better in game.
civ2civ3 Earth (Ruleset for v2.6)
Attachments
Animals-finished-trident.png
Animals-finished-trident.png (7.26 KiB) Viewed 7014 times
Animals-finished-amplio.png
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: Going wild with animals

Post by Ignatus »

Dino the Dinosore wrote:To use the new wild animals feature available in 2.6 you need a customized ruleset. Here's a write-up of what you have to do. Maybe I should add this to the Wiki - but where?
Likely, to the Barbarians page.

BTW, have you tried playing for animals? Their unit can't enter cities but likely you can obtain some from huts and siege the another to starvation.
Dino the Dinosore
Hardened
Posts: 171
Joined: Sun Dec 31, 2017 3:41 am

Re: Going wild with animals

Post by Dino the Dinosore »

The wiki says
Freeciv barbarians are represented by special AI players that have some special rules (e.g. they do not enter huts and can not build units without "BarbarianBuild" or "BarbarianBuildTech" role).
If so, this must be hard-coded since units.ruleset has no relevant unit flag value.

Thanx for the better image files.
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: Going wild with animals

Post by Ignatus »

Dino the Dinosore wrote:The wiki says
Freeciv barbarians are represented by special AI players that have some special rules (e.g. they do not enter huts and can not build units without "BarbarianBuild" or "BarbarianBuildTech" role).
If so, this must be hard-coded since units.ruleset has no relevant unit flag value.
Barbarian type is in their nation ruleset file.

It's hardcoded that animals can't attack cities but that barbarians don't enter huts it's AFAIK just an AI constraint.
Dino the Dinosore
Hardened
Posts: 171
Joined: Sun Dec 31, 2017 3:41 am

Re: Going wild with animals

Post by Dino the Dinosore »

Much as I enjoy the animals, I'm concerned that having them is a disadvantage for the AI players. My testing shows that, even given an extra phalanx to start with, the AI's lose a lot of units to land animals early, and even more to sea animals later in the game. Since the AI is not that great already, I'd like to minimize this extra harm. I expect the AI's algorithm for moving units doesn't know to beware of terrain that might contain animals, and would have to be rewritten to do so - maybe someone knows more about this?

My first idea is to make animals more visible to AI's - have the animal nation give shared vision to all the AI's. I expect the AI's algorithm for moving units would know to avoid barbarians. But there's no way for ruleset files or lua scripting to do anything dealing with the state of diplomatic relations between players. That also rules out my 2nd idea - make the animal nation at peace with all the AI's. 3rd idea is to use a unit_lost_callback() in script.lua (which I referred to in my previous post) to replace any lost AI units with a cloned replacement by calling edit.create_unit(). This should work, but there's a bug - the result is a zombie remnant of the killed unit. It sometimes appears and sometimes disappears, when it appears its health bar is empty, it can't be moved, the disband menu option is there but doesn't do anything, it gets counted in the units screen. Maybe I should file a bug report.

Anyone have other ideas of how to save the AI's from the animals?
XYZ
Elite
Posts: 432
Joined: Fri Jan 31, 2014 12:00 pm

Re: Going wild with animals

Post by XYZ »

2nd idea - make the animal nation at peace with all the AI's. 3rd idea is to use a unit_lost_callback() in script.lua (which I referred to in my previous post) to replace any lost AI units with a cloned replacement by calling edit.create_unit(). This should work, but there's a bug - the result is a zombie remnant of the killed unit. It sometimes appears and sometimes disappears, when it appears its health bar is empty, it can't be moved, the disband menu option is there but doesn't do anything, it gets counted in the units screen. Maybe I should file a bug report.
What bothers me here is that the Ai won't fight the animals who block advantageous settling positions. He also looses the chance to train troops in case animals give veterancy levels.
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: Going wild with animals

Post by Ignatus »

Dino the Dinosore wrote:My first idea is to make animals more visible to AI's - have the animal nation give shared vision to all the AI's. I expect the AI's algorithm for moving units would know to avoid barbarians. But there's no way for ruleset files or lua scripting to do anything dealing with the state of diplomatic relations between players. That also rules out my 2nd idea - make the animal nation at peace with all the AI's. 3rd idea is to use a unit_lost_callback() in script.lua (which I referred to in my previous post) to replace any lost AI units with a cloned replacement by calling edit.create_unit(). This should work, but there's a bug - the result is a zombie remnant of the killed unit. It sometimes appears and sometimes disappears, when it appears its health bar is empty, it can't be moved, the disband menu option is there but doesn't do anything, it gets counted in the units screen. Maybe I should file a bug report.

Anyone have other ideas of how to save the AI's from the animals?
AI is normally omniscent, you can't make units present in the game from the start more visible to it. Avoiding terrain with animals is hardly a good strategy, animals are to be hunted rather than avoided, and they won't bother units stationed in cities (the latter fact AIs hardly do know though). Maybe we should do it like in Civ4 - a) animals can't enter civ borders at all and b) they appear gradually before normal barbarians, the initial map is clean.

Zombie units??? It's surely a bug. Describe well how you get them and file it. The same callback is activated for getting merc from huts and I haven't seen troubles with it.
Dino the Dinosore
Hardened
Posts: 171
Joined: Sun Dec 31, 2017 3:41 am

Re: Going wild with animals

Post by Dino the Dinosore »

Thanx - I didn't know about AI being omniscient, or about animals not attacking cities. I like the idea of having them appear gradually.

I have filed a bug report. I suspect that getting called from the unit_lost_callback() is the difference.

Also updated the wiki Barbarians page.

In version 3.0, there's supposed to be a new "action_started_unit_unit event" and a new action value for "attack" that I can try out.
Dino the Dinosore
Hardened
Posts: 171
Joined: Sun Dec 31, 2017 3:41 am

Re: Going wild with animals

Post by Dino the Dinosore »

Found a mistake in my original post. The link to -
ttp://forum.freeciv.org/f/download/file.php?id=1491&mode=view
should be -
http://forum.freeciv.org/f/viewtopic.ph ... 34#p100439
Post Reply