How to add a base

Contribute, display and discuss rulesets and modpacks for use in Freeciv here.
Post Reply
phoenix84
Posts: 4
Joined: Sat Sep 27, 2014 11:30 pm

How to add a base

Post by phoenix84 »

Newbie question :)

I do not get how to add a new any item. Simple example:

1. I copy default ruleset to another directory
2. I made a file ruleset.serv so it is visible within the game
3. I edit as example: terrain.ruleset
4. I copy fortress rules so I get 2 fortresses (with different names) like this:
[base_fortress]
name = _("Fortress")
graphic = "base.fortress"
graphic_alt = "-"
activity_gfx = "unit.fortress"
reqs =
{ "type", "name", "range"
"Tech", "Construction", "Player"
"TerrainClass", "Land", "Local"
"UnitFlag", "Settlers", "Local"
}
gui_type = "Fortress"
build_time = 3
defense_bonus = 100
border_sq = 5
native_to = "Land"
flags = "NoAggressive", "NoStackDeath", "DiplomatDefense"
helptext = _("\
Fortresses improve defense for land units. Among other effects, a land \
unit remaining in a fortress for a whole turn without moving recovers \
a quarter of its hit points. With Invention, fortresses gain watchtowers \
from which units can see further afield.\
")

[base_outpost]
name = _("Outpost")
graphic = "base.fortress"
graphic_alt = "-"
activity_gfx = "unit.fortress"
reqs =
{ "type", "name", "range"
"Tech", "Construction", "Player"
"TerrainClass", "Land", "Local"
"UnitFlag", "Settlers", "Local"
}
gui_type = "Fortress"
build_time = 3
defense_bonus = 100
border_sq = 5
native_to = "Land"
flags = "NoAggressive", "NoStackDeath", "DiplomatDefense"
helptext = _("\
Fortresses improve defense for land units. Among other effects, a land \
unit remaining in a fortress for a whole turn without moving recovers \
a quarter of its hit points. With Invention, fortresses gain watchtowers \
from which units can see further afield.\
")
5. I DO NOT SEE my 2nd fortress within the game.
6. What am I doing wrong? I believe I have to add my "new fortress" to the game, but where exactly?

Please help :)
cazfi
Elite
Posts: 3105
Joined: Tue Jan 29, 2013 6:54 pm

Re: How to add a base

Post by cazfi »

Which freeciv version is this?

I recommend first editing your ruleset/game.ruleset [about] name and description, so that once you start the game you can see from Help -> About Ruleset that you really are using your own ruleset (it has been loaded succesfully)

Then check if "Outpost" is listed in Combat -> Build Base -submenu.

I don't know if this is of any help for you, or if it's providing too much misinformation in its outdateness, but here's ruleset editing tutorial I started years ago: http://www.cazfi.net/freeciv/RulesetExample.txt
phoenix84
Posts: 4
Joined: Sat Sep 27, 2014 11:30 pm

Re: How to add a base

Post by phoenix84 »

Version: To jest Freeciv wersja 2.4.2, klient gui-gtk-2.0. (Ubuntu)
Help -> Ruleset: Default for 1 person (translation) - so it means it didnt work, but i choose "my ruleset" on the very beginning.

There is no my outpost in build menu.

Thx for help

P.S. I am reading your guide. When I'll find a solution, I'll post it here. If you know the solution please post it :).
phoenix84
Posts: 4
Joined: Sat Sep 27, 2014 11:30 pm

Re: How to add a base

Post by phoenix84 »

IT WORKS :)

I made a stupid bug, that .serv file was still including default ruleset, after fixing the path, everything works fine!

thx for this tutorial... will be needed, thx
phoenix84
Posts: 4
Joined: Sat Sep 27, 2014 11:30 pm

Re: How to add a base

Post by phoenix84 »

Cannot add a grafics :)
e
1. Made directory: phoenixgfx
2. Made file: phoenix.tilespec where new line "phoenixgfx/phoenix.spec", has been added (whole file below)
3. Made file: phoenixgfx/phoenix.spec (inside i tried 2 versions with phoenixgfx/phoenix nad phoenixgfx/phoenix.png (.png is added)
[spec]
options = "+Freeciv-2.3-spec"

[info]
artists = "Grafika do moda Phoenix"

[file]
gfx = "phoenixgfx/phoenix.png"

[grid_main]
x_top_left = 0
y_top_left = 0
dx = 64
dy = 48

tiles = { "row", "column", "tag"
0, 0, "u.outpost"
}
4. Made file: phoenix.png which is simple 64x48px file with transparent background and few pixels in it
5. Changed terrain.ruleset graphics line into graphic = "u.outpost"
6. Changed GUI tileset to phoenix (seen in the list)

And... doesnt work... standard fortress is seen instead of my pixels

Whole: phoenix.tilespec (with mine 1 line)


[tilespec]

; Format and options of this tilespec file:
options = "+Freeciv-2.4-tilespec duplicates_ok"

; A simple name for the tileset specified by this file:
name = "Phoenix"
priority = 30

; TODO: add more overall information fields on tiles,
; eg, description, authors, colors, etc.

; Basic tile sizes:
normal_tile_width = 96
normal_tile_height = 48
small_tile_width = 15
small_tile_height = 20

; Basic tile style.
is_hex = 0
is_isometric = 1

; Use roadstyle 0 (old iso style)
roadstyle = 0

; Fogstyle 2, darkness_style 4 : blended fog
fogstyle = 2
darkness_style = 4

; offset the flags by this amount when drawing units
unit_flag_offset_x = 25
unit_flag_offset_y = 16
city_flag_offset_x = 2
city_flag_offset_y = 9

; offset the units by this amount when drawing units
unit_offset_x = 19
unit_offset_y = 18

; offset the city bar text by this amount (from the city tile origin)
citybar_offset_y = 30

; offset the tile label text by this amount
tilelabel_offset_y = 15

; Font size (points) to use to draw city names and productions:
city_names_font_size = 10
city_productions_font_size = 8

; These are special because they get freed and reloaded
; as required:
main_intro_file = "misc/intro"
minimap_intro_file = "misc/radar"

; Below, the graphics spec files; must be somewhere (anywhere) in
; the data path. Order may be important for color allocation on
; low-color systems, and if there are any duplicate tags (lattermost
; tag is used).
files =
"amplio2/terrain1.spec",
"amplio2/terrain2.spec",
"amplio2/hills.spec",
"amplio2/mountains.spec",
"amplio2/ocean.spec",
"amplio2/water.spec",
"amplio2/tiles.spec",
"amplio2/fog.spec",
"misc/small.spec",
"amplio2/units.spec",
"phoenixgfx/phoenix.spec",
"amplio2/veterancy.spec",
"misc/flags-large.spec",
"misc/buildings-large.spec",
"misc/wonders-large.spec",
"misc/space.spec",
"misc/techs.spec",
"misc/treaty.spec",
"amplio2/nuke.spec",
"amplio2/explosions.spec",
"amplio2/ancientcities.spec",
"amplio2/medievalcities.spec",
"amplio2/moderncities.spec",
"amplio2/select.spec",
"amplio2/grid.spec",
"misc/cursors.spec",
"misc/overlays.spec",
"misc/citybar.spec",
"misc/shields-large.spec",
"misc/editor.spec",
"misc/icons.spec"


; Include color definitions
*include "misc/colors.tilespec"

; Terrain info - see README.graphics

[layer0]
match_types = "shallow", "deep", "land"

[layer1]
match_types = "forest", "hills", "mountains", "water", "ice"

[layer2]
match_types = "water", "ice"

; Water graphics referenced by terrain.ruleset
;
[tile_lake]
is_blended = 1
num_layers = 1
layer0_match_type = "shallow"
layer0_match_with = "land"
layer0_sprite_type = "corner"

[tile_coast]
is_blended = 1
num_layers = 2
layer0_match_type = "shallow"
layer0_match_with = "deep", "land"
layer0_sprite_type = "corner"
layer1_match_type = "water"
layer1_match_with = "ice"
layer1_sprite_type = "corner"

[tile_floor]
is_blended = 0
num_layers = 2
layer0_match_type = "deep"
layer0_match_with = "shallow", "land"
layer0_sprite_type = "corner"
layer1_match_type = "water"
layer1_match_with = "ice"
layer1_sprite_type = "corner"

; Land graphics referenced by terrain.ruleset
;
[tile_arctic]
; treated as water for ice cliffs
is_blended = 0
num_layers = 3
layer0_match_type = "shallow"
layer1_match_type = "ice"
layer2_match_type = "ice"
mine_sprite = "tx.oil_mine"

[tile_desert]
is_blended = 1
num_layers = 1
layer0_match_type = "land"
mine_sprite = "tx.oil_mine"

[tile_forest]
is_blended = 1
num_layers = 2
layer0_match_type = "land"
layer1_match_type = "forest"
layer1_match_with = "forest"

[tile_grassland]
is_blended = 1
num_layers = 1
layer0_match_type = "land"

[tile_hills]
is_blended = 1
num_layers = 2
layer0_match_type = "land"
layer1_match_type = "hills"
layer1_match_with = "hills"
mine_sprite = "tx.mine"

[tile_jungle]
is_blended = 1
num_layers = 2
layer0_match_type = "land"
layer1_match_type = "forest"
layer1_match_with = "forest"

[tile_mountains]
is_blended = 1
num_layers = 2
layer0_match_type = "land"
layer1_match_type = "hills"
layer1_match_with = "hills"
layer1_is_tall = 1
layer1_offset_y = 6
mine_sprite = "tx.mine"

[tile_plains]
is_blended = 1
num_layers = 1
layer0_match_type = "land"

[tile_swamp]
is_blended = 1
num_layers = 1
layer0_match_type = "land"

[tile_tundra]
is_blended = 1
num_layers = 1
layer0_match_type = "land"
cazfi
Elite
Posts: 3105
Joined: Tue Jan 29, 2013 6:54 pm

Re: How to add a base

Post by cazfi »

In your ruleset posted earlier you had "base.fortress" as gfx tag of the Outpost. In your phoenix.spec you provide "u.outpost" ("u." is usually reserved for units).

Check if client gives any tileset loading failures before falling back to another tileset, by setting the tileset and full debug log level from commandline, i.e., launch the client (assuming gtk2-client here) with command:
> freeciv-gtk2 -t phoenix -d 3

The best way to check if you have both Fortress and Outpost gfx loaded correctly is the editor.
Edit -> Editing Mode
then selecting "Military Bases" -tool, and opening list of all available bases by clicking the base (probably Fortress) that opens to left panel.
Post Reply