News:

Welcome to World of Banished!

Main Menu

How to understand certain source files.

Started by hadrian900, April 08, 2018, 11:20:33 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

hadrian900

As i was browsing source files to understand how the game is compiled, i find a lot of things never covered in the mod guide by the developer.

I have no developing, nor large programming knowledge.

Right now i'm trying to understand this particular file: "AppiarySpriteSheet.rsc"

I know that ...

Sprite _sprites
[
{ String _name = "BuildApiary"; String _source = "UI/Sprite/BuildApiary.png"; }
{ String _name = "AphiaryWork"; String _source = "UI/Sprite/ApiaryWork.png"; }


{ String _name = "HoneySmall"; String _source = "UI/Sprite/HoneySmall.png"; }
{ String _name = "Honey"; String _source = "UI/Sprite/Honey.png"; }

{ String _name = "ProfessionBeekeeper"; String _source = "UI/Sprite/Beekeeper.png"; }
]

...calls images which are supposed to show up in Interface accordingly.

The part i do not understand is

SpriteSheet resource
{
String _materialName = "ApiarySpriteSheetMaterial.rsc";
String _imageName = "Build/ApiarySpriteSheet.png";
int _imageWidth = 128;
int _imageHeight = 128;
bool _padForFiltering = true;


I have looked into sprite sheet of unmodded game, where it leads and what file it reffers to, what makes me believe this part is supposed to compile sprites in one image.

So what does this do exactly?

RedKetchup

it creates a transparent .png with all the icons on it.
compile it, and then go in the /build folder of your mod(or in this case, the /build folder of example/apiary/ folder), you will see a bigger .png (defined by the width/hight) with all the icons draw on it. thats what the game use

i am gonna put here in attachment , an example of such file created with all the UI/Sprite/icons.png pasted to it
this code you dont understand serves to create this kind of spritesheet.png
> > > Support Mods Creation developments with Donations by Paypal  < < <
Click here to Donate by PayPal .

hadrian900

In example for building there is file apiaryResource.rsc
Which contains
ExternalList resource
{
External _resources
[
// toolbar - references building and everything else - nothing else need be listed here
"Apiary.rsc:apiary"
]
}

I don't quite get what does this particular file do.

RedKetchup

#3
Quote from: hadrian900 on June 18, 2018, 01:39:27 PM
In example for building there is file apiaryResource.rsc
Which contains
ExternalList resource
{
External _resources
[
// toolbar - references building and everything else - nothing else need be listed here
"Apiary.rsc:apiary"
]
}

I don't quite get what does this particular file do.


thats the resource file like you had
it calls an item named "apiary" in the file named "Apiary.rsc" which is the toolbar file (which is at your root of your mod, next to the resources file.)
you will see in the toolbar file, the paragraph apiary is placing an item on the food toolbar and it calls a template to define what is that "apiary" placed on the toolbar food.

the double dot caracter mean : go to that paragraph inside that file
like example :

      "RKEditorChoiceEdition.rsc:RKCemetery",

that mean : go to the paragraph named RKCemetery inside the file named RKEditorChoiceEdition.rsc

in that file RKEditorChoiceEdition.rsc there will be a paragraph that decide what you do with that RKCemetery
it is like a name of a function. you ask to go to a certain function in a certain file and then there, you will decide what it is that function and what it does.

here is : place an icon to the toolbar and go to a certain template for what it does when people click on it.
> > > Support Mods Creation developments with Donations by Paypal  < < <
Click here to Donate by PayPal .