Jump to content
catty-cb

Adding a new tree into Banished

1 post in this topic Last Reply

Highlighted Posts

Posted:
Last Online:  
 

This example adds a new tree to orchards. In this case the tree produces figs. If you want to build and test the mod...

bin\x64\Tools-x64.exe /build figResources.rsc /pathres ../example/tree /pathdat ../example/tree/bin

You should now be able to run the game and see that fig trees can now be used when you plant trees in a orchard. Like the crop example, you'll need to enable debug mode in this mod to be able to give yourself fig seeds without buying them at a trading post.

Before the mod is packaged, you have to explicitly tell the game to load the resources using the /ref parameter.

bin\x64\Application-x64-profile.exe /ref figResources.rsc /pathres ../example/tree /pathdat ../example/tree/bin

Start a new game, and use the debug menu to give all tree types to the player. Then place a orchard - you should be able to select Figs as the fruit. This tree works like any other.

You can build the mod into a package like so:

bin\x64\Tools-x64.exe /mod Package.rsc:fig /pathres ../example/tree /pathdat ../example/tree/bin

To test the mod by itself, you can run the game forcing it to only use packages.

bin\x64\Application-x64-profile.exe /onlypkg

The game should have the new mod listed in the Mods dialog and you can enable it.

General steps for adding a new tree

Adding a new tree is almost identical to adding a new crop, just the entity definitions are different, and modeling the tree can be slightly challenging.

  1. You'll need to model two objects. One for this display of the tree in the field, and one for the fruit when it is harvested. There is a slight difference is the modelling of the tree.

    Deciduous trees in the game use the a vertex shader to always make the leaf billboards point at the camera. When modelling the leaves only a small quad (0.01m) is needed for each billboard. The billboards have a third texture coordinate that tells each vertex how far to expand and in what direction.

    In general the billboards are also mapped to a location on the Ambient Occlusion texture that is fully white - and actual AO information is only used on the tree trunk.

    On other parts of the tree, such as the trunk, make sure the third texture coordinate is mapped to uv (0, 0), otherwise the trunk will sway in the wind along with the leaves. If you're adding a new conifer style tree, the third texture coordinate just defines how much the leaves sway in the wind.

    • See /example/tree/Models/FigTree.fbx
  2. Like in the crop example you need to build Textures, Materials, and Meshes for the objects. The process is the same.
    • See /example/tree/Models/MaterialInstance/Fig* and FigTree*
    • See /example/tree/Models/FigMesh.rsc and FigTreeMesh.rsc
  3. Like in the crop example you need to build String Tables and Sprites.
    • See /example/tree/UI/FigSpriteSheet.rsc
    • See /example/tree/UI/FigStringTable.rsc
  4. Finally you'll have to make entity definitions (again, similar to the building example)
    • See /example/tree/Template/NaturalResourceFig.rsc
    • See /example/tree/Template/RawMaterialFig.rsc
  5. To package and reference the new entities, you'll need a package resource and a list of referenced objects.
    • See /example/tree/figResources.rsc
    • See /example/tree/Package.rsc

preview.jpg


  Edited by catty-cb  

Banished Toolkit 1.0.7

Share this post


Link to post
Share on other sites

×

Thank You for the Continued Support!

Simtropolis depends on donations to fund site maintenance costs.
Without your support, we just would not be in our 24th year online!  You really help make this a great community. *:thumb:

But we still need your support to stay online. If you're able to, please consider a donation to help us stay up and running. This helps sustain a platform where we can share our community creations for years to come.

Make a Donation, Get a Gift!

Expand your city with the best from the Simtropolis Exchange.
Make a Donation and get one or all three discs today!

STEX Collections

By way of a "Thank You" gift, we'd like to send you our STEX Collector's DVD. It's some of the best buildings, lots, maps and mods collected for you over the years. Check out the STEX Collections for more info.

Each donation helps keep Simtropolis online, open and free!

Thank you for reading and enjoy the site!

More About STEX Collections