• Creating Custom Working Light Props


    deadwoods

    Level: Advanced Please PM STomnibus if you have any questions about this article.

    This is a technical guide/tutorial on creating custom light props that actually light up in the game (at night).

    The tutorial assumes the following knowledge:

    • Familiarity with iLive's Reader utility
    • Understanding of the key SC filetypes, such as FSH and S3D files
    • A strong understanding of TGI's and IID's

    There are two parts to this document, a technical overview of the components involved in in game and custom light props, followed by a mini tutorial on creating custom lights. Some of this stuff is fairly complex, and there are some areas where it's easy to make mistakes, so I'd advise doing this stuff carefully and take a few backups. I had many frustrating nights trying to get it right.

    Thanks to Karybdis, Pegasus and the BSC team for help with this.

    Background

    When looking at the props we wanted to add to the Amsterdam Centraal Station lot, I found some funky blue lightpoles in front of the real station and thought they'd be great for custom lights in the game. I know smoncrie had played around with this a bit and written a brief tutorial. Pegasus has also been playing with custom light models. In the end I was able to create the lights I wanted, but it was a long process.

    Lights and LightCones, A Technical Overview

    Before jumping headfirst into creating custom lights, we need to look at the technical aspects of the Maxis lights and lightcones. If you skip this section and go to the tutorial, you'll get yourself into strife, guaranteed.

    Files and Relationships

    The following points describe the files used by lghts and their relationships:

    • To build a custom light you're concerned with two models, the lightpole which you would build in the BAT, and the light it "produces" (such as lightcone). You can refer to the supplied ones or copy the supplied ones and tweak to your liking.
    • Each model (e.g. lightpole and lightcone) consists of two filetypes; the FSH filetype (Type = 0x7ab50e44) and S3D filetype (Type = 0x5ad0e817). These are normally in a 1:1 relationship, one FSH file per S3D, but some S3D files share a FSH file (such as the standard MAXIS lightcones).

    • Each model will have either one (1) FSH/S3D file pair or twenty (20) FSH/S3D file pairs. The BAT will produce twenty (for each of zoom 1-5 and each direction combination). Some MAXIS models only have one pair of FSH/S3D files. This is usually where the model looks exactly the same in each direction and zoom level (such as the lightcones which are basically a spherical shape and look the same in each direction).
    • Prop exemplars refer to the S3D file (either the single one if there is only one or the ****0000 IID one if there are twenty of them). This is done through the Resource Key Type 4 exemplar property. If this points to an invalid model, you will normally get the brown box.
    • Each S3D file refers to a FSH file (or "texture") through its Material ID (under the Mats tab in the reader). If this points to an invalid texture, you will get a box in Red/Blue/Green.

    GID's and IID's

    For the lights to work in both day and night, all models (both the lightpole and lightcone) must use a GID of BADB57F1 (0xbadb57f1). If you don't for custom lights, you may see what you're expecting during the day but at night you'll either get the brown box or an unexpected model.

    Because you must use a GID of BADB57F1, and only the first four characters of the IID are used as a unique reference (the other four are used for zoom and rotation) you have to be really careful when allocating IID's. There seem to be great chunks not used by MAXIS (3***, 5***, 7***, b***, d*** and f*** based on a quick check of the simcity_*.dat files). I've been using 4DE*.

    The Standard MAXIS Lightcones

    MAXIS provide four lightcone models:

    • 0x5ad0e817,0xbadb57f1,2cb70000 - a large cone approx. 13m high, radius at base of 4.5m
    • 0x5ad0e817,0xbadb57f1,2cb80000 - a medium cone approx. 10m high, radius at base of 3.5m

    • 0x5ad0e817,0xbadb57f1,09c6e584 - a smaller/flatter cone approx. 6m high, radius at base of 2.5m
    • 0x5ad0e817,0xbadb57f1,29da0000 - a small globe of light as used with the $ lights

    These are shown below against a 10m x 10m grid.

    lightcones.jpg

    These S3D files refer to one of two textures (FSH files):

    • 0x7ab50e44,0x1abe787d,09c6e584 - lightcone; used by 2cb70000, 2cb80000 and 09c6e584
    • 0x7ab50e44,0x1abe787d,ea89e9ee - globe of light, used by 29da0000

    Building Custom Lights

    There are three stages to creating custom lights; create your own lightcone models (optional, you can use the supplied ones), create your own lighpole models, and putting them together.

    Creating your own LightCone Models

    Theoretically it's possible to create your own complete lightcone model (i.e. create the S3D + FSH files) but it would be a lot of work. The simplest way is to use the existing MAXIS lightcone models and tweak the FSH file.

    You will need custom light models if you want different light colours (as Peg has done with his Peglites). Also if you are going to use multiple lightcones on a single light that will intersect, you might want to reduce the brightness of the light (otherwise you'll burn your eyes out looking at the intersection of the lightcones).

    You will need to copy both the MAXIS S3D and FSH files into your own .dat file (reader). You need the S3D file as it refers to the FSH file. You use the normal FiSHman and image editing tools to change the FSH file and upload it.

    You will need to ensure you set the GID of your custom files to BADB57F1, the IID's to something unique (within the BADB57F1 set) and that the Material ID points to your custom FSH file.

    Creating you own Lightpole Models

    This is just standard BAT work. Two things to remember:



    1. You should make your poles equivalent to the light model sizes (i.e. approx. 11-12m tall, approx. 8-9m tall or 6-7m tall).
    2. If you are going to have multiple lightcones hanging off a single pole, you will need to know the X,Y co-ordinates of the light sources (bulbs) in your model.

    Once you have exported the model from the BAT and created the model as a Prop in the Plugin Manager, you will need to go through every S3D file and FSH file in your .desc file and change the GID to BADB57F1 and the IID to a unique value (same unique value for all files). You will also need to go through the S3D files and set the Material ID to be the unique ID you have set for these files. This is a critical step and it must be done correctly.

    Putting it all Together

    The key to putting it all together is the prop exemplar file. There are two properties you must have:

    • Nighttime State Change - 0x01 means "change to state 1"

    • Resource Key Type 4 - this replaces the Resource Key Type 0/1 that is the default for single state/single model props. Resource Key Type 4xm is used to tie changing props to game activity (such as traffic lights). I've removed it and the props seem to function ok.

    The resource key type 4 contains a variable number of sets of values. Each set contains eight Uint32 values. Each set of values represents one model (such as lightpole or lightcone) and state (daytime = 0, nighttime = 1) combination. For example a light with three lightcones would have five sets of values (i.e. fourty all up):

    • SET1 - reps 1 - 8 - nighttime model for lightpole
    • SET2 - reps 9 - 16 - nighttime model for lightcone #1
    • SET3 - reps 17 - 24 - nighttime model for lightcone #2

    • SET4 - reps 25 - 32 - nighttime model for lightcone #3
    • SET5 - reps 33 - 40 - daytime model for lightpole

    An example of this is shown below:

    text1.jpg

    Each set of eight values contains:

    • the first REP is day (0) or night (1), although I think the values can be different things, because there is the Nighttime State Change property that say's "at night time use state A" (where A is normally "1" corresponding to the value of the first rep).

    • the second, third and fourth reps are the X,Z,Y represent the offset from the centre of the prop.
    • the fifth rep will be either:

      • 0x27812820 if there is a single S3D file for the prop/lightcone etc. which corresponds to Resource Key Type 0, or
      • 0x27812821 if there are 20 S3D files (for combinations of N/S/E/W at zoom 1 - 5) which corresponds to Resource Key Type 1.

      [*]the sixth, seventh and eigth reps are the T,G and I values for the prop/lightcone.

    To work out the X,Z and Y values, you need to convert from Hex to Decimal and then divide the number by 16^4 (i.e. 65536). For example, the $StreetlightDiagonalAVE_2CC1 uses two lighcones (5ad0e817,badb57f1,2cb70000) with the following dimensions:

    text2.jpg

    From what I've seen the Z value refers to the height of the cone base above the ground.

    So my example above using the custom lightcone of 4DE00000 has the following X,Z,Y values for the lightcones (rep #2, #3 and #4):

    • #2 .63m, -1.5m, 1.12m
    • #3 .63m, -1.5m, -1.12m
    • #4 -1.3m, -1.5m, 0m

    Here are three lights I created for the Amsterdam Centraal Station lot (day and night views). There are actually three light cones per light pole.

    working_lights_day.jpg

    working_lights_night.jpg

    That's pretty much it. If you have any questions, PM deadwoods or email at st_deadwoods@optusnet.com.au.

    If you have any further questions about this article, please PM STomnibus.


    1 person likes this


    User Feedback


    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an Account  

    Sign up to join our friendly community. It's easy!  :thumb:


    Register a New Account

    Sign In  

    Already have an account? Sign in here.


    Sign In Now

  • New Articles

    • Teaser Paragraph:

      Learn how to make your installed Automata useable as props in the Lot Editor.

      • 0 Comments
      • 146 views
    • Teaser Paragraph:

      Are you tired of building in the same four directions? Do you wish to break free of the shackles of SC4's grid system? Well this tutorial will give a basic overview about diagonal gridbusting.

      Diagonal city building, or gridbusting as the SC4 veterans call it, is a hard skill to master. One requires a great many mods and attached is a list of relevant mods to help get you started. There are numerous in-game barriers to overcome and a great many visual issues which must be addressed to create that dream diagonal area.

      Read on if you are interested in grid-busting!

      • 1 Comment
      • 707 views
    • Teaser Paragraph:

      Wondering whether or not to use a slope mod? Want to see why you should have one installed? Then look no further, this guide should have you covered.

      • 1 Comment
      • 681 views
    • Teaser Paragraph:

      Want to know the full ins and outs of the Japanese NAM Facelift Mod? Well look no further...

      • 1 Comment
      • 525 views
    • Teaser Paragraph:

      Is there a lot that you wish you could plop on the water?  Or did you create your own lot only to find out that the game doesn't allow you to place it in or near the water?  Grab the iLives Reader and follow these simple instructions :) 

      • 2 Comments
      • 309 views
  • Recently Browsing   0 members

    No registered users viewing this page.



  • Featured Topics

  • Recent Modding / Content Posts

    • Already thinking about a future project and wondering if it's technically possible.  There are lots of large scale airports in the game with the custom airport roads, these are great for the international flights but what about small rural airfields?  I have noticed there is paths available in the asset editor for taxiways and runways, will it be possible to make a grass/dirt airstrip? I don't think a modular one using the airport roads mod will be possible but a fixed strip and small terminal/hanger should be easy to create. I know with train stations and harbours you have the option to make them local only. Do you have the same option for airports when creating the asset? You could set up a small dirt strip, add a plane route from there to your main airport terminal and just assign small aircraft like a Cessna to that plane route. I've already done this with cargo terminals and selected local only when plopping a plane stand and assigned DHL/Fedex planes to a route.
    • BRAVO! on the maxis mansion revamp, also the zurich house lot was a very nice surprise, though one question does this mean you have abandoned the old zurich house lot that served as the centerpiece of the Trowbridge office park?. keep up the brilliant work mate!
    • now that I look even better at them, these row houses (didn't look at them like that before, donno why) will be places well in my lower mid density or in the higher low density for sure, quite need them   ye, lower mid density will be
    • I'm hoping to see more elevated freight stations now that it has been shown to be technically possible. I definitely agree with you on the realism side of things and it is something I've thought about. The building was inspired by an existing Victorian structure in my home town (picture in the 5th post of this thread). The rest of the station has been demolished but the lifting tower remains, what you can't see from the first images I posted is the container crane inside the building. Adding a lift shaft down to ground level is one of the changes I am planning to make. I'm imagining that the city planners have removed the old lifting gear and replaced them with modern machinery but still keeping the historic exterior of the building.  As for the width, 4 tiles is the maximum I'd like this asset to be. City centre space is valuable, having a compact freight station would mean it fits nicely within the standard zoning area. I've also designed it to fit next to this asset; http://steamcommunity.com/sharedfiles/filedetails/?id=762691618  I already have ideas for more modern versions of freight stations.     Edit: Just thinking, @Tim The Terrible did you mean alter the length of the building instead? Currently it's 4 tiles in length and width, instead of 4 arches I could increase it to 12 so more of the train will be covered by the building. Although doing so would increase the tri count dramatically.   
    • Thanks for you answers. I'll come up with a list of things I am requested with better explanation so it's more clear to me and maybe others. 1) New bridges. There are too few bridges for RHW-6 and apparently no choice at all for RHW-8 and RHW-10. If there are third party bridges for those networks, please let me now and I won't be requesting this. 2) Concrete barriers. I realized that this would be not realistic to have them everywhere. I realize that it's supposed to be added using a third-party mod, not NAM. I apologize. I might want to make this myself but not sure can I make it or not.. 3) Direct AVE-6 -> RHW-6S. This is what I was referring to. Using AVE-6 -> OWR-3x2 -> RHW-S6 would remove the barrier but it would also look ugly because of the arrows on OWR. Ideally, I would like to have two new RHW-6S->RHW-6C transition without a barrier and AVE-6->RHW-6S transition like it is but not always putting this gray thing in the middle of the road but only when near by (I mean the one that is using the transition) AVE-6 is using it. I could use AVE-6 -> RD-6 and then RD-6 bridge which hasno barriers and unnecessary gray things in the middle, but that'd be a bottleneck. What I am saying is that I don't see any nice ways to connect two AVE-6 located at different sides of a river. 4) RHW-8 to two RHW-4's. Thanks! 5) 8-lane roads. The only thing that won't be realistic in this case (using two OWR) is that painting because normally two two lanes in different ways going along form a regular road which have different painting. Can we get one-ways without that much painting? Sorry for offtopic, but any ways I can fix this?