Jump to content
catty-cb

Adding a new animal into Banished

1 post in this topic Last Reply

Highlighted Posts

Posted:
Last Online:  
 

This example adds a new animal to pastures. In this case the animal is a white chicken. It behaves just like the other chickens in the game. If you want to build and test the mod...

bin\x64\Tools-x64.exe /build whiteChickenResources.rsc /pathres ../example/animal /pathdat ../example/animal/bin

You should now be able to run the game and see that 'Leghorns' can now be used when you select an animal in a pasture. 'White Chicken' does fit on all the UI very well, so 'Leghorns' which is a type of white chicken, is used instead. This is something to keep in mind as you mod the game - make sure your text fits in the UI. The UI will expand controls to fit the text, however this may cause the entire UI to stretch in unexpected ways.

Like the crop example, you'll need to enable debug mode in this mod to be able to give yourself all the animal types 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 whiteChickenResources.rsc /pathres ../example/animal /pathdat ../example/animal/bin

Start a new game, and use the debug menu to give all animal types to the player. Then place a pasture - you should be able to select 'Leghorns' as the animal. This animal works like any other. There's another debug button to fill pastures with animals without waiting for them to grow. Press it a few times to add the animals.

You can build the mod into a package like so:

bin\x64\Tools-x64.exe /mod Package.rsc:whiteChicken /pathres ../example/animal /pathdat ../example/animal/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 animal

Adding a new animal is almost identical to adding a new crop or tree, just the entity definitions are different, and the model requries bones, skinning, and animations.

  1. You'll need to model two or three objects. One for this display of the animal in the field, and one for the meat when it is harvested. You may also need a model for another produced resource - chickens produce eggs, and cows produce milk.

    After modelling the animal, you'll need to rig it with bones and weight the mesh to the bones using a skin modifier. You can setup any sort of animation controllers, ik controllers, etc, as long as when you export the FBX file you bake the animation into the file, so that all animation frames are explicit, instead of relying on the controllers.

    It's important to keep the number of bones low. A maximum of 51 bones is supported, however for the game to render many animals quickly (in DirectX 9 mode), you'll want to keep the bone count much lower than that. The lower the bone count, the more models the game can render simultaneously.

    • See /example/animal/Models/WhiteChicken.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/animal/Models/MaterialInstance/WhiteChicken*
    • See /example/animal/Models/WhiteChickenMesh.rsc
  3. You'll need to define an animation file that tells the game the ranges of animation for various motions. Animals need a walk, and three idles. It's important to make sure animations that are played often on many of the same object be properly instanced, and that the number of different instances running is fairly low.
    • See /example/animal/Models/WhiteChickenAnims.rsc
  4. Like in the crop example you need to build String Tables and Sprites.
    • See /example/animal/UI/WhiteChickenSpriteSheet.rsc
    • See /example/animal/UI/WhiteChickenStringTable.rsc
  5. Finally you'll have to make entity definitions (again, similar to the all the other examples, just different configuration). The white chicken reuses the meat and eggs resources that already exist in the game, so there aren't new resources for them.
    • See /example/animal/Template/WhiteChicken.rsc
  6. To package and reference the new entities, you'll need a package resource and a list of referenced objects.
    • See /example/animal/whiteChickenResources.rsc
    • See /example/animal/Package.rsc

preview.jpg


  Edited by catty-cb  

Banished Toolkit 1.0.7
  • Like 1

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