[Simcity4 Devotion] SC4 Automata As Props
This tutorial demonstrates how to make (static) props for SimCity 4, using the ingame (and other) automata models (no 3D modelling required). Such props had already been released since the early days of SC4 custom content development, so this isn't anything new. However, many modders are still unaware of the option, and this is the purpose of this tutorial.
Table of Contents
1. Introduction
The Simcity 4 dats contain a huge collection of automata, being displayed by the game in normal gameplay and UDI missions. Modders can make props out of these (for use in lots). The quality of these models is superior to the ones generated by the BAT, as the BAT renderer (with all its known problems, like blurring, distortions and loss of detail) is not invloved in the process.
2. Basic Knowledge
Making a prop using an automaton model is a very simple task, with only few differences, compared to BAT models.
The basic difference is that automata models consist of only one S3D file, used in all zoom/rotation views. In contrast, BAT models have 20 S3D files, one for each zoom level and rotation (5 zooms x 4 rotations). The (lone) automaton model contains all model faces (and not only the ones that are visible in each specific view), because the model must be possible to be rotated by any possible angle (eg consider a car turning around on a street-end tile).
The way to reference (display) such a model in a prop exemplar is through the use of the Resource Key Type 0 property. The property's value (just like in the Resource Key Type 1) is the TGI address of the model to be displayed. The only difference is that this property references a model with 1 S3D file, while Resource Key Type 1 references a model with 20 S3D files (BAT-exported models).
You also need to add the kSC4BuildingModelRotationProperty property in your prop exemplar. Without this property, your prop will always display the same (front) side, as you rotate the city view ingame. The kSC4BuildingModelRotationProperty makes the model rotating together with your city. Weird, but the value of this property is ignored, it can be true, false or empty, it makes no difference. Only its presence is required.
3. Example: Orthogonal and Diagonal Bus Props
Now let's see how the above can be applied to make a prop displaying the ingame bus model, in orthogonal as well as diagonal form (as the model has "full geometry", it can be rotated by any arbitrary angle, without quality degradation).
The steps to make such props are:
1) First locate the bus automaton exemplar in simcity_1.dat. This can be done with the help of iLive Reader's Navigator tool. The TGI address of this exemplar (Vehicle_Bus_normal_10620000) is 0x6534284A, 0x096E6739, 0x10620000. The Model Resource Key property specifies the model displayed (we will use it in our prop). So the model's TGI address is 0x5AD0E817,0xBADB57F1,0x10620000.
2) Locate this model in simcity_1.dat, copy and paste it in another datfile. As in our example we also have diagonal props, make three copies. This step (as well as the next two) is not required, if you are not going to make diagonal props.
3) For the diagonal props, assign the copied models different IDs, so that they don't conflict with the original. In our case I have assigned them the following instance IDs: 0x1062FFF1, 0x1062FFF2 and 0x1062FFF3. Not only these are not used in simcity_1.dat, there is also no chance that these IDs can be used by BAT, as BAT uses different IDs (eg the 5th digit can only be 0 or 8).
4) Now we have to rotate our copied models as needed. Download and install SC4 Model Tweaker from the LEX. Open the datfile containing the models, and rotate them by the desired angle (in our case 45°, 22.5° and -22.5°, but you can specify any angle you wish). Save and exit.
5) Now we have to make the prop exemplars. These can be generated by the Plugin Manager. This is supposed to guarantee a unique ID for each prop (now how this is done, as there is no a centrally-kept registry, this is another story, but let's believe them). PM can generate prop exmplars only for BAT models (with 20 Z/R), so we can use another model to generate the prop exemplars and then change the properties ourselves. Drag the model onto the "Prop" node in PM, and give the prop exemplars some meaningful names. I have named them Prop_SC4BusAutom_000, Prop_SC4BusAutom_225, Prop_SC4BusAutom_450 and Prop_SC4BusAutom_675 (they will display the bus model at 0°, 22.5°, 45° and 67.5° angle respectively).
6) Finally, copy all four prop exemplars into a (new) datfile, and delete the .SC4Desc files. Go to each prop exemplar and change the Resource Key Type 1 property to Resource Key Type 0; and of course change their value so that they reference our (copied) models. Also add the kSC4BuildingModelRotationProperty property. And finally set all other properies (User Visible Name Key, Flammability etc) to meaningful values. In our case the Occupant Size property (this determines the blue prop rectangle size) was set to values calculated from the model's vertex coordinates extremeties (min and max values), thus corresponding to the model's exact dimensions.
7) We are done. Now you can use the props in your lots.
The datfiles made for this tutorial have been attached at the end of this post. You may examine them to see the technique, or use them in your lots privately, but not release lots use them as a dependency.
Notes:
This tutorial demonstrates how to make (static) props for SimCity 4, using the ingame (and other) automata models (no 3D modelling required). Such props had already been released since the early days of SC4 custom content development, so this isn't anything new. However, many modders are still unaware of the option, and this is the purpose of this tutorial.
Table of Contents
- Introduction
- Basic Knowledge
- Example: Orthogonal and Diagonal Bus Props
- Notes
1. Introduction
The Simcity 4 dats contain a huge collection of automata, being displayed by the game in normal gameplay and UDI missions. Modders can make props out of these (for use in lots). The quality of these models is superior to the ones generated by the BAT, as the BAT renderer (with all its known problems, like blurring, distortions and loss of detail) is not invloved in the process.
2. Basic Knowledge
Making a prop using an automaton model is a very simple task, with only few differences, compared to BAT models.
The basic difference is that automata models consist of only one S3D file, used in all zoom/rotation views. In contrast, BAT models have 20 S3D files, one for each zoom level and rotation (5 zooms x 4 rotations). The (lone) automaton model contains all model faces (and not only the ones that are visible in each specific view), because the model must be possible to be rotated by any possible angle (eg consider a car turning around on a street-end tile).
The way to reference (display) such a model in a prop exemplar is through the use of the Resource Key Type 0 property. The property's value (just like in the Resource Key Type 1) is the TGI address of the model to be displayed. The only difference is that this property references a model with 1 S3D file, while Resource Key Type 1 references a model with 20 S3D files (BAT-exported models).
You also need to add the kSC4BuildingModelRotationProperty property in your prop exemplar. Without this property, your prop will always display the same (front) side, as you rotate the city view ingame. The kSC4BuildingModelRotationProperty makes the model rotating together with your city. Weird, but the value of this property is ignored, it can be true, false or empty, it makes no difference. Only its presence is required.
3. Example: Orthogonal and Diagonal Bus Props
Now let's see how the above can be applied to make a prop displaying the ingame bus model, in orthogonal as well as diagonal form (as the model has "full geometry", it can be rotated by any arbitrary angle, without quality degradation).
The steps to make such props are:
1) First locate the bus automaton exemplar in simcity_1.dat. This can be done with the help of iLive Reader's Navigator tool. The TGI address of this exemplar (Vehicle_Bus_normal_10620000) is 0x6534284A, 0x096E6739, 0x10620000. The Model Resource Key property specifies the model displayed (we will use it in our prop). So the model's TGI address is 0x5AD0E817,0xBADB57F1,0x10620000.
2) Locate this model in simcity_1.dat, copy and paste it in another datfile. As in our example we also have diagonal props, make three copies. This step (as well as the next two) is not required, if you are not going to make diagonal props.
3) For the diagonal props, assign the copied models different IDs, so that they don't conflict with the original. In our case I have assigned them the following instance IDs: 0x1062FFF1, 0x1062FFF2 and 0x1062FFF3. Not only these are not used in simcity_1.dat, there is also no chance that these IDs can be used by BAT, as BAT uses different IDs (eg the 5th digit can only be 0 or 8).
4) Now we have to rotate our copied models as needed. Download and install SC4 Model Tweaker from the LEX. Open the datfile containing the models, and rotate them by the desired angle (in our case 45°, 22.5° and -22.5°, but you can specify any angle you wish). Save and exit.
5) Now we have to make the prop exemplars. These can be generated by the Plugin Manager. This is supposed to guarantee a unique ID for each prop (now how this is done, as there is no a centrally-kept registry, this is another story, but let's believe them). PM can generate prop exmplars only for BAT models (with 20 Z/R), so we can use another model to generate the prop exemplars and then change the properties ourselves. Drag the model onto the "Prop" node in PM, and give the prop exemplars some meaningful names. I have named them Prop_SC4BusAutom_000, Prop_SC4BusAutom_225, Prop_SC4BusAutom_450 and Prop_SC4BusAutom_675 (they will display the bus model at 0°, 22.5°, 45° and 67.5° angle respectively).
6) Finally, copy all four prop exemplars into a (new) datfile, and delete the .SC4Desc files. Go to each prop exemplar and change the Resource Key Type 1 property to Resource Key Type 0; and of course change their value so that they reference our (copied) models. Also add the kSC4BuildingModelRotationProperty property. And finally set all other properies (User Visible Name Key, Flammability etc) to meaningful values. In our case the Occupant Size property (this determines the blue prop rectangle size) was set to values calculated from the model's vertex coordinates extremeties (min and max values), thus corresponding to the model's exact dimensions.
7) We are done. Now you can use the props in your lots.
The datfiles made for this tutorial have been attached at the end of this post. You may examine them to see the technique, or use them in your lots privately, but not release lots use them as a dependency.
Notes:
- The Is Ground Model property has been set to False, because otherwise it generates strange shadow effects. Plus the model already contains a shadow model (Group 2). This looks quite OK, but it's different to the shadows cast by the "normal" BAT models. However other models might be OK, and for these you may want to set Is Ground Model to true (for these you should also remove the modelled shadow, if your model contains one).
- I have left the Light property to True, although these models do not have nightlights. Furthermore, I'm not sure if this technique works for models with 1 Z/R, and I don't know even if such models actually exist. Some testing on your part can prove this.
- If you are going to release prop-packs using the simcity automata models, I would recommend that you open a development thread, so as to avoid duplication.
- The technique is not limited to automata models, instead it can actually be used to make props using any kind of 1-Z/R models, like monorail tracks. Or maybe ploppable water; by not involving the BAT in the process, chances are that their appearance could be considerably improved (jeronij %confuso).
- If you find this technique interesting, you may also want to take a look at my PedMall-Compatible Transit-Pack. It uses special models, referncing directly the very same NAM texture used in the Ped-Mall Tiles, thus achieving a perfect match between the ped-mall textures and the lots.