by ngunjaca » Wed Aug 20, 2008 12:12 am
[quote="pioja"]Hi,
could anyone point me to a tutorial on how to implement new unit graphics into freeciv? I have found the graphical file in the amplio unit set, but it seems to me that there are not many 'free spots' left in the file.
Do I have to resize the unit image data file, if I want to add more units to freeciv? Also, what kind of licence does the graphic have to come along.
Thanks,
Piotr[/quote]
For implementing new graphics here is a short guide:
In amplio/units.spec file a "grid" for units is defined:
"[grid_main]
x_top_left = 0
y_top_left = 0
dx = 64
dy = 48"
and a graphics file where the actual graphics are stored
"[file]
gfx = "amplio/units"" (this can be any other file)
which means that a single unit graphic in the image file units.png has 64x48 pixels. The size of the units.png image file can be expanded as you like. Its original size is 1280x192; if you want to add new units in new columns add to x axis 64 pixels (change the image canvas size for x axis from 1280 to 1344). Now you have 4 new empty unit graphics slots. The same way you can add new rows. In this way you can expand the unit.png file as you like. My biggest unit.png file is 1600x624 pixels, and i have no problems with FreeCiv loading the units.
Next step is to define in the units.spec file where your new unit graphic in the units.png image file is ("row", "column" numbers, are actually x and y axis), and give the unit a tag (for example for the original armor unit it is "u.armor"). For your new unit, lets say in the new column we added in the first row the coordintes would be 0, 20, and a tag "u.newunit". The new tag i.e. "u.newunit" is then used in the units.ruleset file under "graphic = "u.newunit"" for each separate unit. Take note that you can have up to 200 units defined in the units.ruleset file (this actually should be enough for everyone).
You can read more about it in the README.graphics file in /doc folder.