Donation

Help us to pay our server!
(: Consider a donation :)



Social Media

  • Facebook
  • Google+

Latest Posts

Topic: Creating wares tutorial

Forums » Player Forums » Playing Widelands » Creating wares tutorial



Soeb
Avatar
Joined: 2009-02-26, 13:50
Posts: 70
Ranking
Likes to be here
Location: Prague, Czech Republic
Posted at: 2009-04-23, 22:28

Hi,

Note this tutorial is for trunk, this means that some things are not implemented in build13. (but it's ok for build14)

This tutorial describes how to create wares and what options exist.

So...

A conf file, with all the possibilities looks kind of this:

    help=
    default_target_quantity=
    preciousness=

    [idle]
    pics=
    hotspot=

Now let's describe every option:

    help=

Description displayed in ware encyclopedia. It must have an leading underscore (_)

    default_target_quantity=

As the name suggests, the default target quantity for a ware. This is the default wanted number of wares in the warehouse/headquarters. This is not required for basic wares.
So for example, if you want to build 3 lumberjacks houses, there won't be enough axes with the default setting (1). When this is set to 5, toolsmith will produce 5 axes and will try to keep it at this number. It can always be adjusted later in-game trough the economy menu (but it'll be kept only in this one particular game).

    preciousness=

This is not required as well. It'll tell the AI how important the ware is. I'm unsure whether 1 is the most or least important. This option is only for AI and used by AI.

    [idle]

This section is a must-be in the file. No description is required for that.

    pics=

What image will be displayed. Usually it is called idle.png and is of size like 16x24.

    hotspot=

It tells where the picture should be drawn in the location in question (ie. node). For example the value can be 9 11 (that's the very pixel that'll be drawn in the location).

This is all about the ware's conf file.

Now there need to be 2 more files in the folder. First is the one defined in "pics" and the second one must be named menu.png. It will be displayed in warehouse/headquarters.

So let's have a look at a conf file of an axe for example:

    help=_The Axe is the basic weapon and tool for the barbarians.
    All young soldiers are equipped with this basic weapon, but also the lumberjack is using the same model.
    default_target_quantity=5
    preciousness=3

    [idle]
    pics=idle.png
    hotspot=9 11

(broke the line in half) and its folder contents:

    axe/
        conf
        idle.png
        menu.png

That's probably how you're folder's contents will look.

The last step is to add info about it in 'conf' in the main tribe's directory. Add a line pointing to the directory in manner of other folders. So for example if the name is lightaxe, it'll look like that:

    lightaxe=_Light Axe

Place it under '[ware types]' section in alphabetical order.

I think it describes it all quite enough. I hope it helps somebody.

--

Regards, Soeb

Edited: 2009-10-06, 19:07

--

Regards,
Soeb

Top Quote
Astuur
Avatar
Joined: 2009-02-28, 12:08
Posts: 733
Ranking
One Elder of Players
Location: Frankfurt / Germany
Posted at: 2009-04-25, 15:42

For all those that read Soeb's post above at a later time, I want to clarify, that the ware's description he used as an example:

The Axe is the basic weapon and tool for the barbarians. All young soldiers are equipped with this basic weapon, but also the lumberjack is using the same model.

is partly no more true. Barbarian lumberjacks now have a different tool (felling axe) for their work. Just to avoid any confusion._


Thanks Soeb! I want to add a thing or two:

Default_Target_quantity=: This option exists to compensate for possibly adverse effects of the "on-demand" production system. This describes how many of these wares should be kept in store as a minimum. If, for example, you would need to build 4 new lumberjack huts, you normally would not have 4 axes in store (if default =1). So you'd have to wait for their production. It you set the default to 5, that's what you will always have. You can set the option in the ware's conf file so it will be valid until you change it. In addition you can adjust the value inside the game using the flags menu. These adjustments are only relevant for this particular game.

Setting this option only makes sense for wares that are conrtrolled by the On-demand feature. Basic wares like trunks, corn, water, granite and reet are always produced at full rate stored in what quantities they may come. Some other wares that do not have a choice of further processing (like the ores) also do not need a Default_target_quantity.

Apart from that, I am not sure what the new "preciousness=" statement is really used for. Maybe this is more for the benfit of the AI, or perhaps for the distrubution between different warehouses?

Edited: 2011-08-24, 08:35

Being no programmer, I apologize for all my suggestions that imply undue workload and for other misjudgements due to lack of expertise or relevant skills.
I am on Win32, have no means to compile, and rely on prefabricated distributions (Thanks to Tino).

Top Quote
Soeb
Avatar
Joined: 2009-02-26, 13:50
Posts: 70
Ranking
Likes to be here
Location: Prague, Czech Republic
Posted at: 2009-04-25, 15:57

Happy to hear you like it!

I'll edit the post to make the description descriptive.

Apart from that, I am not sure what the new "preciousness=" statement is really used for. Maybe this is more for the benfit of the AI, or perhaps for the distrubution between different warehouses?

It is only for AI. It tells how important the ware is (this does not matter for basic wares) and if it should try to get this. But I'm not completely sure how it works, just that only AI needs it.

@EDIT: Updated, thanks for the tip Astuur.

Edited: 2009-04-25, 16:04

--

Regards,
Soeb

Top Quote