Author Topic: How to understand certain source files.  (Read 413 times)

0 Members and 1 Guest are viewing this topic.

Offline hadrian900

  • Laborer
  • **
  • Posts: 28
How to understand certain source files.
« on: April 08, 2018, 11:20:33 AM »
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 ...
Code: [Select]
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
Code: [Select]
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?

Offline RedKetchup

  • Champion
  • Banished Expert
  • *****
  • Posts: 9472
  • Country: ca
Re: How to understand certain source files.
« Reply #1 on: April 08, 2018, 12:37:13 PM »
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 Paypal Donations < < <
Click here to PayPal Donate.

Offline hadrian900

  • Laborer
  • **
  • Posts: 28
Re: How to understand certain source files.
« Reply #2 on: June 18, 2018, 01:39:27 PM »
In example for building there is file apiaryResource.rsc
Which contains
Code: [Select]
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.

Offline RedKetchup

  • Champion
  • Banished Expert
  • *****
  • Posts: 9472
  • Country: ca
Re: How to understand certain source files.
« Reply #3 on: June 18, 2018, 01:43:19 PM »
In example for building there is file apiaryResource.rsc
Which contains
Code: [Select]
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.
« Last Edit: June 18, 2018, 01:49:06 PM by RedKetchup »
> > > Support Mods Creation developments with Paypal Donations < < <
Click here to PayPal Donate.