SC4D Homepage
BSC File Exchange
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length


Author Topic: Creating a Terrain Mod  (Read 4832 times)

0 Members and 1 Guest are viewing this topic.

Offline Lowkee33

Creating a Terrain Mod
« on: September 12, 2010, 01:36:28 PM »
   This tutorial will introduce the steps to take to make a terrain mod.  It covers the basics of editing the Terrain INI, and how to import your own textures into Sim City 4.  I am changing the titles of these two tutorials, as they aren't really basic and advanced anymore.  This tutorial explains how to make a mod, and the other explains terrain related exemplars.

This tutorial is subject to change as needed. Last Update: 11-05-2011
-Including the need for an exemplar for each texture
 
Difficulty:
    -Intermediate

   While not necessarily "hard" to do, we will be exploring SimCity_1.dat, and some experience/confidence in Ilive's Reader is necessary.  To make this faster I will be sharing the TGI's of the various pieces of SimCity_1.dat that we will need.  From there we move on to editing an INI and importing a texture


Programs you will need:
    -Ilives Reader
        We will be copying the Terrain INI from SimCity_1.dat and editing it.
    -Null45's BatchPngtoFsh Tool
        We will create and import a texture.   
    -A useful tool is a text writing program that has the "Replace all" function.  Notepad, which comes with Windows, will do just fine.  Reasons to be cautious of this are talked about when notepad comes up.

Welcome to the Tutorial

 Contents

    1) Setting ourselves up for success.  Here we will find the file we need in SimCity_1.dat and understand it.
    2) Making our Mod.  We will then change the INI to change our terrain textures.
    3) Editing an Existing Terrain Mod.  A quick look at some C.P. (CycleDog) Terrains.
    4) Importing a Texture.  We will create a texture and import it.   
   
Section 1)  Setting ourselves up for success.

Step 1)  Be Safe
     -Make a backup of your SimCity_1.dat.  We are not going to change anything in there, but who knows what could happen.
     -Backup and empty your plugin's folder.  We will be testing our terrain a lot, and want a clean slate to work with.

Step 2) Creating Our .Dat
    -Open Ilives Reader.
    -On the bottom left hand corner there is a tab that says SimcityDat.  Click on it. 
    -You will see the 8 Reader friendly files on the left side of your screen.  Click on SimCity_1.dat (topmost).
    -Find the entry:
        Type      - 0x00000000
        Group     - 0x8A5971C5
        Instance - 0xAA597172
    -Right click on the INI file and click "Copy File(s)"
    -We don't want to change SimCity_1.dat, so we will make our own .dat file
    -Open the file menu and make a new File.
    -Click "Paste File(s)" and you will have your own INI
    -Click "Save as" and save it as something you will remember and to you plugin folder.
    -You now have a terrain that will override SimCity's terrain. (At this point they are the same though).

    The INI is a long document, and getting to know it is important.  You may see right off the bat that certain lines are green.  These are lines that have been turned off (with ";"), so don't worry about them.  About halfway down this document is the Tropical Texture Map Table.  This is what we will be modding.  This table has 32 rows and 16 columns.  The blocks of the table are filled with 0x##, the ## being the last two digits of the terrain texture's Instance.

Optional Step 2.5) Finding the Maxis Textures

A terrain texture's Instance?  A terrain texture is a FSH with Type: 7ab50e44, Group: 891b0e1a, and Instance 00000?##.  The Instance is like a fingerprint, and it is important that no two textures have the same Instance (otherwise they will override).  The ## represents a variable number between "00" and "FF"  giving us 256 possible terrain textures.  The "?" represents the 5 zooms of the texture and has a value of either 0,1,2,3, or 4. 4 is the closest zoom, and in-game is the keyboard zoom 5+6.

The terrain textures can be found in SimCity_2.dat.  The optional step is to copy paste all of the terrain textures that are zoom 4 into the file we are working on.  This is purely for ease.  If you compare these textures to the ones on the Tropical Texture Map, you will see that only 31-38 are being used.  The other are miscellaneous, and include the Cliff, beach, edge of the city, and a few unused cliff textures.  Your file may look something like this:



Here is an image of the Maxis grass textures, and their corresponding IDs:


Step 3)  Modifying the Terrain INI

Making a terrain mod is simply changing the values in the Tropical Texture Map Table.  The 32 rows represent altitude (temperature to be exact) and the 16 column represent moisture.  The top row "00" is the highest altitude level.  This level is important.  Properties in the Terrain Exemplar (see the exemplar tutorial) define at what altitude this row appears at.  Any altitude higher than this will use this row.  The furthest left column is the driest moisture level.  These two variables temperature/moisture are not largely simulated (temperature not at all).  I have found that at no time will the Maxis Default settings display the 2 left most columns.

I am going to copy/paste the Tropical Texture map into Notepad, and quickly do some "replace all" functions.  Your work with Maxis Textures can be far more precise.  Just remember to click the "Apply" button on the top of the INI before you save.  Also, be careful using the "replace all" function.  If you replace "31" with "32", you will replace the 31 that defines that temperature row, and you will get a crash.  In my quick change I "saved" a texture value as "ab".  When I replaced "ab" with "37" I replaced the ab in "Table".  A good safety measure is to replace "0x##' with "0x##", but in the end, you will get used to CTDs.  My Tropical Texture map is on the left with the resulting terrain on the right.  I just threw some textures in that I know are recognizable as different.  Anyway, we see that Maxis textures blend pretty well with each other.



Similarly, this method can be used with the textures that C.P. (CycleDog) created.  However, he made about 70 textures, so there is a much higher learning curve when it comes to the Instances.  The next section explains how to replace a specific texture in one of his terrain Mods.

Section 3) Editing an Existing Terrain Mod

This section of the tutorial will explain how to modify an existing terrain mod.  For this example I have used the MeadowShire Terrain Controller.  I have chosen textures that are noticeable and helpful for a tutorial. 

Step 1)  Planning
   -To make this go faster we will want the plugin folder to consist of only the necessary files.  There are 4 files needed to make a terrain mod work.
          1) The Terrain Controller
          2) The CPT_No3 textures
          3) The CPT_No4 textures
          4) The Rock textures
   -Start SC4 and terraform in god mode until the target texture is apparent:

     
    -The texture in the white circle is our target texture.  I have chosen this because it is a warm color in an otherwise cool color Terrain mod.
    -Notice the green and red circles.  These are also warm textures.  This makes the process more complicated, but for now we will head into the Reader.

[Step 2)  The INI file.
    -An image of the Meadowshire INI:


   -Editing this Terrain is a matter of finding the Instance of the texture we want to change, and switching it with an Instance that we want to keep.

Step 3)   Locating the Texture
   -Open CPT_No3_TerrainTextures_Essential.dat in Reader.  We will see a long list of "FSH" Entries.  I was in zoom 5 when I took that image, so I am looking for an 0x000004## file.
   -Click on the "DAT" tab, the little arrow next to "Filter", place a "4" in the Instance section, and click "Apply".  The following picture displays these steps:   


    -That is better.  Now we can search for the target texture.  There are some that are close in No_3, but checking No_4 we find the exact texture:


   -Note the last two Instance digits (in this case "fd").

Step 4)  Replacing textures
   -Re-open the Terrain controller, open the INI, and scroll down to the Tropical Texture Map Table.
   -We can find "0xfd" listed in quite a few places.  It is possible to change these here, but better to copy/paste the whole table into a text program that has the "replace all" function.
   -For this tutorial we will just use more of the other cool (green) textures to replace the three warm textures.
   -The Instance "0xff" appears next to "0xfd" quite a lot, and checking No_4 we see that it is a cool texture.  "Replace all" of the "0xfd" with "0xff"
   -Copy/Paste this new Table over the Table in the INI, click the save icon, and then save the whole file:



   -Opening SC4 we will now see this:



   -We still have those other two textures, so now repeat step 3 and 4 for them.  They are Instance "0xf3" and "0xC1".  These textures appear less and have more neighboring textures.  I will change these in Reader as I see fit:


   -There is actually a 4th warm texture there, but I will leave that for you all to change.

Section 4)  Importing our own texture

At this point you may feel that you want to add your own texture to Sim City.
 
Along with Reader, you will need an image editing program and a Png to Fsh converter.  I use Null45's BatchPNGtoFSH.  For this tutorial I will add one texture to the game, and will edit the INI to only use this texture.

Step 1)  Getting your texture ready for import.

Sim City can use any image that is a square with binary pixel lengths as a terrain texture (2x2,4x4,8x8...256x256...1024x1024).  Open your image in an image editing program (MSPaint works), scale it to the desired size, and save it as a PNG with the name "0x000000##".  The ## being the "fingerprint" that you desire.  I am creating an image with Texture Maker.

Step 2) Importing the PNG

Recall that all terrain textures are Group 0x891b0e1a and Instance 0x00000?##.  I am going to make a texture with Instance 0x000000ff, and simply clone it in reader to make the 4 other zooms.

-Open the "GroupID" file in the BatchPngtoFsh tool folder, and change it to "891b0e1a".  The program will now automatically make your FSH have the correct Group ID.
-Change the name of your image to the Instance that you want, including the 0x (0x000000ff for me).  BatchPngToFsh will use this file name as the Instance it creates.
-Open BatchPngtoFSH and drag/drop your image on to it.  You will now see your image listed.  Uncheck the "Automatically Process Mips" box, and click "Save Dat".  You will now be asked what to save it as, so save it as something reasonable in your plugin folder.

Step 3) Making the zooms:

This tutorial is not very complex, so I am using the same image for all zooms.  If you had more than one zoom you wanted to import, just name the files accordingly (0x000000ff, 0x000001ff, 0x000002ff, 0x000003ff, 0x000004ff).

-Open your new file in Reader and right click on the FSH.  Select "Clone File", change "number of copies" to 4, check the "Increment Instance" box, and change the value to "0x00000100".  You will then have 5 texture files with the proper zoom IDs.  Don't do this if you already have each zoom as a separate image.

Step 4) Making a texture's exemplar:

Every terrain texture needs an exemplar of its own.  Otherwise, your terrain will be black in-game blakerussell's image below).  To do this, open SimCity_1.dat in Reader, don't fill the list, and enter the Navigator.  Expand the Terrain branch, and you will see a long list, mostly terrain exemplars.  The terrain exemplars have names like "Texture01" and "Texture1D".  Right click on one of these, and select "Synchronize".  You will see your exemplar in the main screen.  Copy/paste it into a blank dat (or whatever makes sense), and save the .dat.  SimCity_1 should not be saved.

I put the exemplar in the same file as the FSH textures.  Change the instance of the exemplar to that of the texture, and you are good to go.  There are some properties in there that can be changed, but for now you have something that works (perhaps I explain these later).

An image of my file:




Step 5) Editing the INI:

-Now that we have a valid Terrain Texture we can change the INI to use that Instance.  I only made one texture, so the whole thing is filled with 32 columns and 16 rows of "0xFF"

In-Game I have this:



This concludes the tutorial on how to create a terrain mod.  The advanced tutorial is now "Terrain Exemplars", and describes further ways to make your terrain your own.

Please feel free to ask any questions or add tips of your own.  If you feel I could organize this better please say how.  I will be watching this thread and adding these tips into the tutorial.  So, if you see someone posting something that is already in there, that is why.

A big thanks goes out to CycleDogg for the textures and Ennedi who's various posts taught me how to do this.
« Last Edit: November 05, 2011, 07:36:42 AM by Lowkee33 »

Sim City 4 Devotion Forums

Creating a Terrain Mod
« on: September 12, 2010, 01:36:28 PM »

Re: Terrain Mod Tutorial - Basic

Offline marsh

  • *
  • Posts: 1071
  • Country: us
  • Reputation: 4
  • Gender: Male
Re: Terrain Mod Tutorial - Basic
« Reply #1 on: December 21, 2010, 02:46:47 AM »
I have a question. I have some textures, not by c.p., and I want them in a terrain mod. I can get them into i-live fine as fsh.'s. My question is what do you do with the exemplar file so they can be read correctly.

Sim City 4 Devotion Forums

Re: Terrain Mod Tutorial - Basic
« Reply #1 on: December 21, 2010, 02:46:47 AM »

Re: Terrain Mod Tutorial - Basic

Offline Lowkee33

Re: Terrain Mod Tutorial - Basic
« Reply #2 on: December 21, 2010, 10:16:42 AM »
You will need a terrain texture exemplar whos Instance is the Instance of the FSH in zoom "0".  For example, the cp snow texture is 0x0000008f (and 1,2,3,4 as the 6th digit for zooms).  The exemplar would be Instance 0x0000008f.

Best bet would be to copy/paste an exemplar from SimCity_1.dat (found using the Navigator in the Terrain Tab) and change the Instance to your texture.  There are interesting properties that can be changed there, but I haven't explored them enough to speak of. 

Sim City 4 Devotion Forums

Re: Terrain Mod Tutorial - Basic
« Reply #2 on: December 21, 2010, 10:16:42 AM »

Re: Terrain Mod Tutorial - Basic

Offline marsh

  • *
  • Posts: 1071
  • Country: us
  • Reputation: 4
  • Gender: Male
Re: Terrain Mod Tutorial - Basic
« Reply #3 on: December 21, 2010, 04:39:39 PM »
Thanks. I've got it. Now the only problem I have is making the textures blend together in photoshop so there's not grids through the textures. :P

Also, I'm pretty sure this is the case, do they have to be a certain size? I noticed that when trying to put a texture in smaller than 255x255 will crash the game.  %wrd
« Last Edit: December 21, 2010, 04:41:33 PM by marsh »

Sim City 4 Devotion Forums

Re: Terrain Mod Tutorial - Basic
« Reply #3 on: December 21, 2010, 04:39:39 PM »

Re: Terrain Mod Tutorial - Basic

Offline Lowkee33

Re: Terrain Mod Tutorial - Basic
« Reply #4 on: December 21, 2010, 07:50:36 PM »
Quote
Thanks. I've got it. Now the only problem I have is making the textures blend together in photoshop so there's not grids through the textures. Tongue

Sort of where I am at too, that and having to make the 4 other zooms.

Textures must be a square with Binary sides, 1,2,4,8,16...256,512,1024...  Making 1024x1024 textures seems to be the name of the game right now.  The interesting thing is that with larger textures you can decrease the Texture Tiling Factor (found in the Terrain Exemplar), and get far less repetition.  To get the most out of Ennedi's rock mods the TTF should be decreased.  It basically stretches the textures out.

If you are going to make your own textures you may want to learn the behavior of the Z0-4 Texture spread curve properties in the Texture exemplar.  They may be able to help with your griddyness. 


Sim City 4 Devotion Forums

Re: Terrain Mod Tutorial - Basic
« Reply #4 on: December 21, 2010, 07:50:36 PM »

Re: Creating a Terrain Mod

Offline blakerussell

  • *
  • Posts: 5
  • Reputation: 0
Re: Creating a Terrain Mod
« Reply #5 on: November 04, 2011, 09:03:34 PM »
I have attempted to upload my own texture via PngToFsh. I followed your instructions exactly (i think). What do you think I am doing wrong? What EXACTLY were your options in uploading through the PngtoFsh program? Maybe I have something checked that isn't supposed to be checked. What do you think?  ()what()

« Last Edit: November 05, 2011, 08:29:33 AM by blakerussell »

Sim City 4 Devotion Forums

Re: Creating a Terrain Mod
« Reply #5 on: November 04, 2011, 09:03:34 PM »

Re: Creating a Terrain Mod

Offline Lowkee33

Re: Creating a Terrain Mod
« Reply #6 on: November 05, 2011, 06:53:36 AM »
Hmm, looks like I forgot something in the tutorial.  I've seen this on my own computer quite a few times.

Terrain textures need an exemplar to go with them.  You want to use reader to copy/paste one from SimCity_1.dat into a new dat (or perhaps the one with the texture(s) in it.  They can be found in the Navigator, under the terrain branch (where the terrain properties is found as well).  Change the instance of this exemplar to that of your texture.

Good Luck  :thumbsup:

Edit: would you also mind changing your PNG to a jpeg?  It makes loading this page faster.  You don't really want any direct links to PNGs in this forum.  Thanks.
« Last Edit: November 05, 2011, 07:31:21 AM by Lowkee33 »

Sim City 4 Devotion Forums

Re: Creating a Terrain Mod
« Reply #6 on: November 05, 2011, 06:53:36 AM »

Re: Creating a Terrain Mod

Offline blakerussell

  • *
  • Posts: 5
  • Reputation: 0
Re: Creating a Terrain Mod
« Reply #7 on: November 05, 2011, 10:22:24 AM »
Excellent. Thanks so much!

Sim City 4 Devotion Forums

Re: Creating a Terrain Mod
« Reply #7 on: November 05, 2011, 10:22:24 AM »

Re: Creating a Terrain Mod

Offline Indiana Joe

  • *
  • Posts: 353
  • Country: us
  • Reputation: 1
  • Gender: Male
  • Of Fruit Flies and Bananas
Re: Creating a Terrain Mod
« Reply #8 on: November 22, 2012, 12:15:04 PM »
Hey Lowkee; I was wondering if you would help me edit a terrain mod.  I'm fairly happy with the original Columbus mod, but there's one instance of textures that bothers me.  Right before it fades to beach textures at the shoreline, it turns from the common grass texture into one with flowers and fallen logs.  That doesn't exactly blend well with the beach (and the faded-out logs look very unrealistic).  So I was hoping to replace that occurrence of textures with another one from the CPT_No3 texture pack.  That's as far as I've gotten in my planning.  I have the Reader, but I've only used it for some minor tweaking before.  I was hoping you could help me get started on swapping out these textures.

Sim City 4 Devotion Forums

Re: Creating a Terrain Mod
« Reply #8 on: November 22, 2012, 12:15:04 PM »

Re: Creating a Terrain Mod

Offline Lowkee33

Re: Creating a Terrain Mod
« Reply #9 on: November 22, 2012, 12:44:14 PM »
I do believe Editing an Existing Terrain Mod is what you are looking for.

Sim City 4 Devotion Forums

Re: Creating a Terrain Mod
« Reply #9 on: November 22, 2012, 12:44:14 PM »

Re: Creating a Terrain Mod

Offline Indiana Joe

  • *
  • Posts: 353
  • Country: us
  • Reputation: 1
  • Gender: Male
  • Of Fruit Flies and Bananas
Re: Creating a Terrain Mod
« Reply #10 on: November 22, 2012, 12:53:58 PM »
Ah, I missed that part of the tutorial.  That helps, but what I really want to do is just alter where some textures appear.  I don't want to replace them completely.  Is there an easy way to change the texture so that it, for example, doesn't show up within x tiles of the shoreline?  Or at a certain altitude?

Sim City 4 Devotion Forums

Re: Creating a Terrain Mod
« Reply #10 on: November 22, 2012, 12:53:58 PM »

Re: Creating a Terrain Mod

Offline Lowkee33

Re: Creating a Terrain Mod
« Reply #11 on: November 22, 2012, 01:03:19 PM »
Quote
That helps, but what I really want to do is just alter where some textures appear.

Thats exactly what this tutorial is.  Find the instance of the texture you want to change and the instance of the texture you want to change it too.  Then find that instance in the Terrain INI and switch it with the one you want.  Textures appearing on the beach would be the lowest row.

Sim City 4 Devotion Forums

Re: Creating a Terrain Mod
« Reply #11 on: November 22, 2012, 01:03:19 PM »

Re: Creating a Terrain Mod

Offline Indiana Joe

  • *
  • Posts: 353
  • Country: us
  • Reputation: 1
  • Gender: Male
  • Of Fruit Flies and Bananas
Re: Creating a Terrain Mod
« Reply #12 on: November 22, 2012, 01:07:33 PM »
I don't want to change the beach textures.  I want to change the textures that appear on the hills that slope down to the beach (the ones adjacent to the beach textures).  But I still want them to appear on hills elsewhere.  Can I keep the texture from appearing at these low altitudes, but still appear in the same instance at higher altitudes?

Okay, after some tinkering I've begun to figure out how this works.  Do you know enough about the texture map to be able to help me with this:

What I'm aiming to do is have there be a single, uniform texture that the beach textures transition into.  Sort of like an "upper beach" texture.  Any idea which instances I'll have to replace to get this to happen?  Or am I in for a lot of experimenting?
« Last Edit: November 22, 2012, 02:26:29 PM by Indiana Joe »

Sim City 4 Devotion Forums

Re: Creating a Terrain Mod
« Reply #12 on: November 22, 2012, 01:07:33 PM »

Re: Creating a Terrain Mod

Offline c.p.

  • *
  • Posts: 203
  • Country: 00
  • Reputation: 8
  • CL:
    SC4D Green Thumb
Re: Creating a Terrain Mod
« Reply #13 on: November 22, 2012, 05:27:53 PM »
The circled numbers are the ones with the logs.  If you change the numbers in the bottom row, beginning with the circled fa, and working to the right, to 0xf9 or 0xab, that might get you something close to what you want, maybe.
« Last Edit: November 22, 2012, 05:29:42 PM by c.p. »

Sim City 4 Devotion Forums

Re: Creating a Terrain Mod
« Reply #13 on: November 22, 2012, 05:27:53 PM »

Re: Creating a Terrain Mod

Offline Indiana Joe

  • *
  • Posts: 353
  • Country: us
  • Reputation: 1
  • Gender: Male
  • Of Fruit Flies and Bananas
Re: Creating a Terrain Mod
« Reply #14 on: November 22, 2012, 10:13:24 PM »
Woah, it's the master of terrain himself, come back from the dead!   ;D  Thanks a ton; I've been messing with it all day and I'll try that out.

Sim City 4 Devotion Forums

Re: Creating a Terrain Mod
« Reply #14 on: November 22, 2012, 10:13:24 PM »

 


If you experience visual glitches in our site, we strongly suggest you to use Firefox to browse the forums. Also a 1024*768 or higher resolution is highly recommended to view this site