1 Introduction
1a What this is about
In this tutorial, I’ll explain how to create or modify a tree controller (short: TC) by explaining you as many properties as possible and talking about the main considerations and planning you should make. All of this information here is either based upon my own experience or posts I’ve found on the STEX and the LEX; if you are familiar with this topic or at least have researched the internet about this topic, you might recall some of this content. Please keep in mind that some functions related to tree controllers and their exemplar file properties are unknown to date. Also, please feel free to post me suggestions on how to improve this article and point out errors; since English is not my native language, it’s difficult for me to write an article this long.
1b Difficulty
Creating a TC is a difficult task; you need much patience and be familiar with iLive’s Reader. However, most of the work will be editing properties and copying/modifying RKT’s from other plugins, so the coding itself is actually not something for real pros with the reader. For the sake of this tutorial, I assume that you know how to do that. The main difficulty will be organizing yourself and trying a lot of things out; more about that later.
1c Credits
My special thanks go to @blunder and @vortext for providing me with valuable info about tree controllers, both by conversation and writing articles and posts on both Simtropolis and sc4devotion.com. Without their information, both making my own TC and this tutorial would have been almost impossible.
2 Requirements
2a Software and other plugins
Software: You only need iLive’s Reader for making a tree controller.
About the necessary plugins: Make sure that after thinking about which trees you want to have in your region, download the necessary plugins. It’s recommended to look into their files and make sure you know where to find the exemplar files containing the RKT (the property which links an exemplar file to the graphics for whatever item it describes).
Most important: You need MUCH time. Making a TC requires a god amount of trial and error regarding aspects I cannot just explain in detail or "do for you" because that depends on which trees you actually want to use for your TC.
2b What to consider before starting
Firstly, of course, you need to think about which trees you actually want to use for your TC. Aspects you might want to consider are:
How good will the result look? Do not only let your thoughts focus on looks, the size of the trees (especially how much space they take up visually) plays an important role (in fact, modifying the space a tree takes up in-game will be the most time-consuming part of creating a TC).
How realistic will it be? Some trees, for instance, only grow up to a certain altitude, or in special climates, so you don’t want to combine trees only growing in alpine areas with rainforest trees.
Item "limit": While there is theoretically no limit in how much different flora items you can stack into your TC, please keep in mind that balancing out multiple items in a brush (see below about what this word means) becomes RAPIDLY increasingly difficult the more items you use. In my TC, I’ve mostly been using 5-6 flora items per brush, which basically means that I’m using not more than 5-6 different types of trees on 1 type of forest.
You might want to write down your thoughts somewhere, along with the info which trees in particular meet your thoughts.
Secondly, figure out a way to organize yourself. Surely I don’t need to tell this to you twice, but at first you might not know how. This will become more clear the further you have read this tutorial.
2c Terminology
Brush: A chain of exemplar files containing one combination of trees that you want your TC to plant. Only the first of these items will be planted “from scratch”, the others will be created by upgrading already existing trees. All brushes can have (and must have) different requirements – more about that below.
Clustering: The process of upgrading trees while planting trees with the TC is called clustering.
RKT (short for ResourceKeyType): A property consisting of 3 (or 8, 16, or 24 reps in case of RKT4) reps linking an exemplar file (aka any in-game item, such as a prop or flora) to its corresponding graphics.
Slot: Only under certain circumstances a brush becomes active. These circumstances are a product of two factors: altitude and moisture. There are 16 altitude and 16 moisture levels, making a total of 256 combinations possible. One such altitude-moisture combination is called slot. There must be a brush for all slots; please read more about that in chapter 4d.
3 How does a tree controller work?
Some of you might already have opened files related to tree controllers and might have been disappointed by the fact that they only contain exemplar files that you can’t make heads nor tails with it. I, by myself, was no exception at first. This has one main reason (and with that, I’ll already start listing up the main properties of a TC):
A TC is a hard-coded feature (thus, it can’t be modified by legal means) that searches for suitable exemplar files in the game itself and your Plugins folder, and if it finds them and the necessary requirements are met, it plants trees. Therefore, there's just no exemplar file that would be a TC, and it's impossible to make one. To make a “tree controller”, we therefore need to tell the hard-coded TC which exemplar files to use. Every tree needs an exemplar file; thus, any TC that you will download (or develop on your own) is just a collection of flora exemplar files.
A single brush of a TC can – under the same circumstances – only plant the same number of different tree types: exactly 1. However, if it tries to plant a tree within a certain radius of an already existing tree, it can upgrade it to another tree according to an order that you determine. This is the ONLY known way of making forests with several different types of trees.
A single brush can (and must) be made depending on certain circumstances in your city tile to become active. More about that later.
Long story short: Designing a TC is all about
deciding which trees to use together in a brush,
defining their clustering order,
determining the circumstances under which a brush can become active,
and making sure that the brush behaves the way you want (this is the most tedious part).
4 How to actually make a TC
4a Disable Maxis trees
The first step is: The Maxis trees that are being planted by the TC are hard-coded as well and need to be deactivated first before adding a new TC, or else unwanted side effect may occur, up to the point that the game will just ignore your files and stick to planting Maxis trees. Fortunately, this is nothing that you need to do on your own: I’ve attached a file to this tutorial that will do the job (it contains all necessary exemplar files).
4b All necessary properties
In this chapter, I shall explain all properties that play an important role in designing a TC. Let’s start with a picture of an exemplar file that lists all properties of a flora item that will be recognized as a God-Mode tree. I’ve labeled the most important properties with numbers which correspond to the numbers in the paragraph titles below (click to enlarge):
4b1 Flora: Wild, FloraFamily, Special Case Only
Make sure that these three properties are set as shown in the pictures:
Flora: Wild >> True (enter 0x01)
FloraFamily >> 0xE8F02106,0x48F02107
Special Case Only >> False (enter 0x00)
Only if the Flora: Wild property is set to True, this exemplar file will be recognized as a tree that will be planted in God-Mode. Else, it will be ignored. The FloraFamily property must also be set to these two reps; I haven’t tested what happens if you change the values but since it works with Maxis God-Mode planted trees, it seems that it works with all other trees as well. I also haven’t tested what happens if you set the Special Case Only property to true; but since I can plant God-Mode trees when this property is set to false, it obviously works.
4b2 Exemplar Name
This property just gives an item a name for your convenience; it doesn’t affect any in-game functions. Most likely you want to enter a name that helps you recognizing the flora item. It’s recommended to refrain from using special characters like äöüé, because sometimes they are being replaced by nonsensical characters.
4b3 Exemplar ID
This property must match the Instance ID of the flora item (see red markers) or else the item entry won’t work.
4b4 ResourceKeyType (1 or 4)
This is one of the most important properties: It will link the flora item you are creating with its corresponding graphics. Without it, the flora item will be invisible; with a wrong code, you will only be able to plant brown boxes (or something that you don’t want to plant if the code happens to match existing graphics). The RKT will, however, only affect the visual result – not any in-game functions. Unless you make graphics on your own, there’s little need to worry about which values to enter exactly – but of course, you need to know where to get an RKT:
Look into the dependency files of the tree you want to have (in this case: Girafe’s seasonal ash flora item type D is located in the file Grfe_ashes_seasonal.dat).
Look for the RKT property there. Copy&Paste it over to your new God-Mode flora item.
Seasonal vs. non-seasonal flora items:
For seasonal God-Mode planted items, the same rules regarding seasonal flora apply as for Mayor-Mode planted items: They should be planted at the same time of the year (in most cases in the in-game month of August), and they require an RKT4 property (with 16 or 24 reps) to work, as opposed to non-seasonal items, which requires an RKT1 property (with only 3 reps).
In most cases, you will anyway get the RKT you need from the plugin files you've downloaded; however, an interesting exception may occur:
4b5 FloraPreferences
This property controls at which circumstances – determined by the terrain in a city tile – trees will be placed in a city. These circumstances are a product of two factors: altitude and moisture. This will result in an interesting question arising before making a TC: Which forest would be suitable for which altitude/moisture value? (Please also see chapter 4c below about when you actually need to deal with this property in the first place.)
Which values to use?
The FloraPreferences property consists of no less than 256 reps. Entering any value higher than 0 (zero) and up to 1 in one particular rep will enable this flora item to be placed by the TC – entering 0 will disable it. I’m only using 0 or 1; it’s possible to use other values (between 0 and 1) but I haven’t been able to figure out what will happen if you use these.
Please note the following:
One slot (one altitude-moisture combination) can only be used for one brush – if there are two brushes or more on the same slot, the game will only use one and ignore the others. NEW INFO (Jan 2nd, 2018): As far as I know, in this case the exemplar file with the highest Instance Identifier (the 3rd group in the TGI code) will override all others.
There must be a brush for EVERY slot - more about that in chapter 4d.
Which rep controls which requirement?
The 256 reps are organized in groups of 16 reps. Each of these groups represents one altitude level; with the first group being just above sea level and the last group being located above “snow line” (more about that later). Within each group, the reps are sorted by moisture level, starting with driest and ascending to most humid. I’ve created a table to visualize it; imagine the rows as altitude levels and the columns as moisture levels.
Altitude
Two values are important here: Sea level, defined by your terrain mod, and “snow line”, which is defined by the property Flora: elevation scale range, located in the Flora Tuning Parameters exemplar file (you can find this exemplar file in the file SimCity_1.dat, with the TGI 6534284a-7a4a8458-1a2fdb6a; a modified version also comes with the Seasonal Flora Patch from Lowkee). The value in the Flora: elevation scale range property is in metres above sea level. The TC divides the space between these two values into 15 equally large zones; these are represented by the lower 15 rows in the table above (the first 240 reps). Everything above snow line is represented by the 16th row.
(It is not necessary to release a modified version of a terrain mod and the Flora Tuning Parameters; in the first case, this will conflict with any other terrain mod, anyway, and in the second case, the default Maxis settings will do.)
Moisture
Unless your city tile is entirely flat, all sloped areas of your city tile have different moisture values. By normal means, the different moisture values cannot be seen in-game, but there is a mod which allows you to make them visible (download link below). To this day, I haven’t been able to completely understand how the game handles moisture in your city tile, let alone using it to my advantage, even after trying the moisture viewer mod – therefore, I can’t help you much on this topic. In my own TC, I’ve just ignored this whole moisture thingy, with the only exception that on lower altitude levels, I’ve made some minor modifications the forest combinations which will merely result in minor graphical changes, mostly during fall. I can only tell you that the left-most column (as seen in the table above) represents the driest moisture level, and the right-most column the most humid one.
To my knowledge, the in-game handling of the reps in the FloraPreferences property, regarding moisture, seems to depend on the following factors:
Orientation of the hillside – this means, if it faces north, east, south, or west
Proximity to the sea
Month of the year
Intensity of the slope (flat land to cliffside; the most important part)
4b6 FloraParameters
This property, along with the Clustering properties, will be the most time-consuming part of designing a TC. It controls a variety of parameters, especially with the placement of a tree. Please note that any MMP flora requires this property as well, and it makes sense to just copy it along with the RKT into your new TC flora item and then modify some settings. I’ve found most of the information below in various topics on both STEX and LEX and carried it together.
The FloraParameters property consists of 14 reps as follows:
Reps 1, 6, and 7: These values control how often and in which time intervals seasonal trees are changing. This only applies to seasonal trees, and with most trees I’ve found so far in various plugins, the 1st value is set to 180 (in half-days, which equals to 90 days), the 6th to 363 (close to 365, which is the amount of days in a year), and the 7th to 15,050 (I don’t know why). The 1st value seems to control the length of the first two stages of a seasonally changing tree; with the other two values, I’m not sure.
Reps 2, 3, and 12 are unknown.
Reps 4, 5, 9, and 10 have to do with spreading seedlings. If values 4 and 5 are set to any value higher than 0, then as long as you are in God Mode, trees will automatically be planted every 24 months. I haven’t tested this feature at all, and I’ve only found little information about this, so I can’t tell you much about it.
Rep 8: This value is more interesting, because it controls at which maximum slope you can place a tree. You can set a value ranging from 0 (only flat land) to 1 (even highest cliffs). It may require a bit of trial and error; however, this value corresponds to the property MaxNormalYForCliff in any terrain mod in the way that 1 – MaxNormalYForCliff = Value 8.
Rep 11 and 13: These will be the most important reps because they control how much space (circular, radius in m) a tree takes up. Please note the difference:
Rep 11 controls how much space a tree takes up after it has already been planted. This means: After being planted, no other flora can be planted within this radius. However, there’s a special exception made possible by rep 14 (see below).
Rep 13 controls how much free space a tree requires before it is being planted.
These two reps are important because, along with the clustering properties, they enable you to string several trees together in a brush and therefore create a forest from several different types of trees. Both values control the density of a forest, and they do not need to be the same. Please also see chapter 4c about this topic.
Rep 14: This value is in metres. If the height difference between the existing flora and the flora that is being plopped exceeds this amount (in the newly plopped flora), the rep 11 of the already existing flora is being ignored. I haven’t tested it so far, I can’t even tell you for sure which value controls the height of an existing flora.
4b7 Clustering (Flora: Cluster type; Flora: Cluster max radius; Flora: Cluster max height)
These three properties control the most important function required for you to plant forests with several different types of flora: As already mentioned, an existing flora can be upgraded to another one. The properties work this way:
Flora: Cluster type: This property consists of one value, and it is simply the Exemplar ID of the next flora item that will replace this flora. Theoretically, you can make unlimited chains, but do not make a cycle, that means, do not point one tree back to a previous tree. As far as I’ve heard, this will freeze SC4 at some point during planting trees. You might write down which tree points to which tree – this is the property that helps you defining which trees belong into a brush. More about that later in chapter 4c.
Flora: Cluster max radius: If a new flora is being plopped within this radius, the existing tree will be upgraded to the next tree (defined by the property Flora: Cluster type).
Flora: Cluster max height: I don’t actually know what this one does. I’d be glad if someone would shed some light on this.
4b8 Orient To Slope
If set to true, then the game rotates the graphics of an object to adapt to the slope (it will be perpendicular to the slope), if set to false, it always remains vertical. Decide yourself if this makes sense; with trees, I usually leave it at false, but with flat objects, such as gravel or moss, I would set it to true.
4b9 Other properties
The following properties are not necessary about defining which trees will be part of the TC and how they are being balanced, but they may be of interest:
4c How to make a brush consisting of several trees
You might recall that I’ve pointed to this chapter at three parts of this tutorial. In fact, after you’ve gotten familiar with the relevant properties, I shall explain the main process that you will be going through while designing a TC step by step: Making sure that a brush (a group of different flora objects) works properly, which basically means, all types of trees are present, and they take up the right amount of space.
Step 1, of course, is thinking: Which trees shall belong together, and at which altitude/moisture level should they be placed? The highest amount of different objects in a single brush I’ve ever used on my own is 8, but I’m pretty sure you can use a higher amount. Remember: Any newly planted tree is the first tree of a tree chain, and you can’t skip a tree in the clustering order; therefore, it might be increasingly difficult to handle a high amount of trees.
Step 2: Simply tie the trees together by defining the next tree with the Flora: Cluster type property. The last tree in a brush doesn’t require this property, you can skip it. In general, it is recommended to use the tree that requires the lowest amount of space first in this row because clustering only works if the first tree requires the lowest amount of space; if that doesn’t matter, use the tree that you want to occur the most often.
Step 3: Think about at which slot you want this brush to be active, and modify the settings in the FloraPreferences property of the first tree in a brush accordingly. In all following trees, just leave all 256 reps of this property at 0 – they will follow suit.
Step 4: Now comes the most time-consuming part: Balancing the trees. This is done by modifying the reps 11 and 13 of the FloraParameters property, as well as the Flora: Cluster max radius property. The general rules are:
The 1st tree of a brush must have the lowest values in reps 11 and 13 of the FloraParameters property, the values of the following trees must be increasing.
The 1st tree of a brush must have the highest value in the Flora: Cluster max radius property, the values of the following trees must be decreasing.
By changing by how much the values will be increasing/decreasing, you can modify how likely a tree will be replaced by another one. This can be interesting if you, for instance, want a certain tree only to occur rarely and another one rather often. Generally speaking, the lower the difference, the more likely a tree will be upgraded. The following issues may occur:
If two trees will have identical values, the first tree will most likely not be represented at all and eventually be completely replaced by the second tree. If the difference is only low, the first tree may rarely be present at all. This may result in only the later trees being present and the TC running through the first trees too quickly.
If the difference between the values is too high, it may be very difficult to get the later trees of a brush to be planted. This may result in almost only the earlier trees being present.
Other than that, it’s of course interesting to consider which flora item you are using, anyway. Of course, you can use other objects than trees, and they may use up less space, such as bushes. Please note that if you decrease the space that items require too much, this will rapidly fill up your city with items and thus increase your file size quickly.
All of this chapter is what I meant with organizing yourself: Write down, for instance, which trees are in which brush, at which slots a brush becomes active, and which values at rep 11/13 and clustering values you are using, and, if necessary, write down the results of your experiments – I haven’t found a perfect formula for which values exactly to use, not least because that depends on the visual size of the flora items you are using, so creating the ideal brush requires a good amount of trial and error.
4d Empty slots
As we’ve already seen, there are 256 slots that can make a brush becomes active. You might be interested in keeping some of these slots empty (for example, no trees in very dry environment, or no trees above snow line). The most logical assumption (and in fact, it will partly work) would be just making sure that there is no item that has these slots set to 1. Unfortunately, there is a nasty issue: If you are using a TC at a specific location where there is no flora item at all set to 1, the TC will start planting nonsensical objects there. This is actually very likely to occur; since the TC cursor is most likely large enough that you may accidentally at least partly touch such a location while planting.
To prevent that from occurring, there’s only one way to do so: You need to create one flora item for all these slots which you want to be empty, and set some requirements in a way that it is practically impossible for a TC to plant a tree at this location. The only relevant property, aside from the FloraPreferences property, is (in my opinion) the FloraParameters property: I’m setting both the rep 11 and rep 13 to a value that is larger than the maximum distance on a large city tile in metres (the length of a diagonal line connecting two opposite corners of a large city tile is 5,792.62 m; therefore, I’m setting rep 11 and rep 13 to 5,800). This way, the TC cannot place a tree if there’s any other item within a radius of 5,800 m (which is very likely to occur and it’s the case anytime as soon you place any object on a city tile, be it an MMP, a God-Mode planted tree, a lot, or a traffic network).
4e Relevance of files outside of the TC itself
The following exemplar files are not necessary to balance brushes in a TC, and you probably won’t find it necessary to modify them, let alone share them in public, but they at least partly affect the way tree controllers work. They can be found in the file SimCity_1.dat, as well as in various uploads in the internet. Since they have a unique TGI, they can only exist once and every new version you’ll upload will conflict with all available existing versions of the same file. The only thing you can do, if modifying these files is part of an upload you are intending, is either only resort to modifying the original files in your Plugins folder and sharing your knowledge in public and hoping other people are resourceful with iLive’s Reader – or uploading the modified files anyway and risking that they will conflict with the mods other people are using.
5 How to switch between tree controllers
Yes, you read this right: Contrarily to popular belief and some posts on the internet, and while it is impossible to combine tree controllers, it is at least possible to switch to another TC while still keeping all the trees of your former TC in your cities. Now before trying that: Read this carefully to prevent serious issues, such as CTD's, in your region!
Which issues can occur if you just switch to another TC, install two or more TC’s, or uninstall one:
Uninstalling a TC works the same as uninstalling any other plugin such as MMP’s or lots: Just remove all trees you have already planted, and then remove the files of your old TC from your Plugins folder. This is something that you can safely do. If you just remove the files without removing the trees, they will still be in your cities (you just can’t plant new ones). However, it has been reported, that if the trees are destroyed by, let’s say, disaster, and the game can’t find their corresponding exemplar files, your game will crash to desktop.
Trying to combine two TC will basically be impossible: If there are two flora items on one slot defined by the 256 reps of the FloraPreferences property, only one of them will be planted. I haven’t figured out the rules about which one so far, but this basically means that only one TC out of several installed TC's will be active.
Let’s next point out some possible reasons for changing your TC:
As you may have thought already, we are now talking about thousands of trees in a lot of cities, and it may even be impossible to find out which trees have been planted in God Mode and which in Mayor Mode, since you may have planted some MMP’s that look the same as the trees planted in God Mode. Therefore, you may want to be on the safe side in case you accidentally forget to remove a tree from an old TC.
There may also be two TC that you like, and you want to have more possibilities to design your cities, and you may not want to be restricted to height differences. (This can, BTW, cause an unpleasant effect called banding in your cities: Two entirely different types of forests meet each other and it will literally create a border between them with no transition at a certain height.)
Fortunately, the measurements are really simple: You only need to set all 256 values in the FloraPreferences property in all of the flora item exemplar files to 0 and keep the files of the old TC in your Plugins folder until you’ve removed all trees planted by it. (I call such a file disabler file.) Issues like CTD’s can only occur if the game cannot find an exemplar file of an item already being present in a city. This way, the hard-coded TC cannot plant these flora items anymore, but since the exemplar files are still there, the game will work properly.
If you are sure that you want to remove all trees planted by a certain TC you want to get rid of, there’s an easy way to do so: Replace all of the RKT’s in the TC by a RKT1 with three reps and enter: 0x6534284a,0xffffffff,0xffffffff. This is a nonsensical code that will replace all God-Mode planted trees with brown boxes while still keeping their functions intact, while Mayor-Mode planted trees still retain their graphics. This way, you can easily recognize God-Mode planted trees and remove them.
By the way, I'd like to recommend that if you are planning to release a new TC, please include a disabler file with your upload that disables your TC like mentioned above . It's just more convenient for everyone.
6 Links
Seasonal Flora Patch by Lowkee
https://www.sc4evermore.com/index.php/downloads/download/25-flora-fauna-and-mayor-mode-ploppables/36-lk33-seasonalflorapatch
Cori’s Dataview Moisture
List of available tree controllers
Maxis TC Disabler.zip