[Discussion} Modding the industry

Home Forums Modding [Discussion} Modding the industry

Viewing 15 posts - 1 through 15 (of 22 total)
  • Author
    Posts
  • #6948
    steveb
    Participant

    Hi guys,

    Train Fever is quite a nice game but rather limiting in many ways… Having said that, am trying to mod some new industries in the game. At the moment I am experimenting to see what can be done. For instance, i have created a new Copper Mine which actually works like the coal/iron mines… and temporarily changed the wood sawmill into a bronze factory to make goods out of the copper.

    All is well but there seems to be a problem around industries… My copper mine always stays at 1-2 or 3 ore production and doesn’t increase even though there is demand for it. Am wondering if any of you tried to do any other experiments and you can provide some feedback. My first impression is that this behavior is created by the game for some unknown reason…

    Thoughts? I don’t fully understand how the cargo system works or how/when the industries decide to start producing…

    PS: I know about the cargo mod but even with that one i run into the same problem, even when the chain is complete and there is demand from all sides…

    screenshot from my steam: http://cloud-4.steampowered.com/ugc/44230686603519021/CA69F414CB600544FEE5B8CFC96CD0F2AA220FB5/

    #7143
    starman001
    Participant

    Hi,

    just a thought, but from your explanation it seems that the problem is you are only working on the lower chain. You already know the cargo mod you said, so you already know about the demand system there (however it might working 😉 )…

    According to your description, you made a mine and a refine industry. But that’s just half the rent, because there is currently only one good in the game that is demanded from the cities.

    Change your “goods-industry” so that it creates goods out of the ressource “refined copper”. Connect it to the chain and make a deliver system to the city in the 20 minute limit, and I’m sure it will be working.

    I changed the cargomod into 3 different chains (all producing “goods” in the end though), and as long as a chain is complete, the industry starts producing.

    Strange it works different in vanilla though, not sure why.

    #7144
    steveb
    Participant

    @starman001 I did exactly what you suggested… I have 1 copper mine that obviously produces copper. Then I have a “Mill” that needs the copper ore in order to make “Goods” (that the cities need)… It simply does not work. Both buildings will stay at 0-1 production even though they are connected to a city.

     

    I tried different scenarios, trucks and trains both on short distances and long, direct trains from ore mine > mill and mill > cities…

    It is not strange that it works in the vanilla… I did some digging in the exe and it looks like the main goods are defined (in some way I don’t understand yet) there.

     

    I don’t understand your half the rent example. My copper ore is made in goods which are required by the cities. The other goods are also there: oil, iron, coal etc

     

    The difference between my experiment and Gwinda’s cargo mod is that cargo mod does work sometimes and sometimes not… mine doesn’t, at least not the way it should :)) one copper ore every year is not enough

    #7183
    starman001
    Participant

    Hi,

    forget the “half the rent”, that’s just a german phrase I sometimes use, and I just translated it here… My Bad 😉

    It means “this is only 50% of what is needed”.

    Regarding the industry, I can’t say for sure why it’s not working. I suppose you also used the vanilla mdl file from the goods industry, and just replaced the ressource needed ? If not, you can try that.

    How did you create the files ?

    I’m not entirly sure what’s needed, but if you don’t replace art and stuff, you need to edit the cargo file to create a new ressource, a mine file of your choise and give it the new good, and the goods fabrik to use the new Ressource…

    Also (this just comes into my mind) : Of course you need to update all vehicles that they can carry the new goods, and maybe also the loading bays (not sure about those).

    The chain of course also checks, if the goods CAN be transported, AND the 20 minute limit.

    For example : When you create the complete chain, but add a wrong waggon to a train in the chain (there are 3types of wagons for the goods, you need to use the correct one) than the production also is not starting.

    • This reply was modified 9 years, 7 months ago by starman001.
    #7190
    Nivve
    Participant

    How easy would it be to have three different types of goods that city industries need?
    I dislike the ‘all systems create goods’ model, as it is too easy. I would rather have oil -> plastics, Steel mill -> metals, Farms -> foods & ingredients.

    I don’t really fancy lots of different industries (FIRS of OpenTTD was way too much for me), but having one oil well sufficient for all the goods in a city is just too unrealistic for me.

    Is that easy to mod in the game? Not sure how it would impact demand and growth and whether it needs lots of changes..

    • This reply was modified 9 years, 7 months ago by Nivve.
    • This reply was modified 9 years, 7 months ago by Nivve.
    #7630
    steveb
    Participant

    @starman001 I replaced the art, created my new resource but yeah the mdls are basically copied from the iron mine. Edited the vehicles as well… so am out of ideas atm

     


    @Nivve
    Unfortunately, city needs and goods are hardcoded in the game exe and cannot be mooded as far as I know.

    #7753
    Matt
    Participant

    It would be great if we could be able to edit city needs and city production (Adding in parcels produced in cities along with passengers). If it is hardcoded, id love for the devs to release a modding kit that lets this be done. Otherwise we wait until someone with know how to do that..

    Unfortunantlly IMO the fact there is this block feels like the game gets severelly limited.

    #7770
    Matt
    Participant

    This would be my idea for industry flow:

    http://imgur.com/eDPVwMu

    Looking over my setup i forgot to put in one possible input Plastics -> tool and dye. other then that *shrug* its not complicated but i feel it adds alot.

    • This reply was modified 9 years, 7 months ago by Matt.
    • This reply was modified 9 years, 7 months ago by Matt.
    #7783
    NyetComrade
    Participant

    That really bums me out. I hate that one industry on the map can provide for nearly every city’s needs. They should require a certain amount of each type of goods.

    Right now, the game feels a bit elementary.

    #7849
    Buggi
    Participant

    Keep in mind that originally the dev’s were not going to include cargo at all. So the mere fact that is an option which can be expanded on is fantastic. They do need to open the inner workings more so modding efforts by fans can expand the system.

    The foundation is in, it just needs to be built upon to really make this game shine.

    #7985
    Traian Trante
    Participant

    NyetComrade  : i agree. as cities grow, they shoudl demand more type of goods.

    #8064
    douglas
    Participant

    Hi steveb! Good to see you here!

    Have you modified the wagons to accept copper and bronze? You also added the new cargo types in cargotypes.lua ?

    #8065
    douglas
    Participant

    This is a guide from GWINDA. The autor of the Cargo Mod. The guide might not be up to date, was made in beta.

     

    [HOW-TO] Design your own industry prefabs. (tutorial)

    In this tutorial I will show, step-by-step, how to assemble a new industry prefab like this one:

     

    http://cloud-4.steampowered.com/ugc/576776903191918631/F50825C439ACB47FEF4B18A3C7471D4EA5B14AC1/2048×1152.resizedimage

    http://cloud-4.steampowered.com/ugc/576776903194271396/63DFBD539052CBFAFF00745B204A502D64EFAD33/2048×1152.resizedimage

     

    The factory building, ovens and coal box comes from the steel mill industry meshes.

    The cranes, steel pipes and crates from the asset meshes.

     

    The coal box has been retextured to show only coal.

     

    Background

    It is easier if you start with a copy of an industry in about the same size you want to create.

    For example \res\models\model\industry\forest_1850.mdl

    Open the copy with a text editor or any other suitable software, I use Programmer’s Notepad because it gives me Lua syntax highlight.

     

    I will briefly explain what I think it does.

     

    boundingInfo

    My guess is that this is the collision box when placing roads/tracks. You don’t need to change this.

     

    collider

    This is empty so I guess it isn’t used, leave it as it is.

     

    lods

    Now here is the interesting part and we will focus on the children table.

    For each mesh you add, it needs to be a node inside the children table.

     

    id

    The filename of the mesh you want to add, including a relative path from \res\models\mesh

     

    transf

    This is a 4 by 4 transformation matrix that will be applied to the mesh. If you aren’t familiar with transformation matrixes, here is a layman crash course:

     

    1, 0, 0, 0,

    0, 1, 0, 0,

    0, 0, 1, 0,

    0, 0, 0, 1

     

    This transformation places the mesh at position 0,0,0 at scale 1:1 no rotation. The bottom row shifts the mesh in x,y and z direction (moving it in 3D space).

     

    To place a mesh at X10, Y3 and Z-0.1 the transformation looks like this:

     

    1, 0, 0, 0,

    0, 1, 0, 0,

    0, 0, 1, 0,

    10, 3, -0.1, 1

     

    To scale a mesh we multiply the diagonal row of 1:s (except the last one) with the scale factor. The first row scale in X, second in Y and the third in Z direction. To scale a mesh double wide, half the height and same depth:

     

    2, 0, 0, 0,

    0, 1, 0, 0,

    0, 0, 0.5, 0,

    0, 0, 0, 1

     

    Rotation is a bit more tricky, I will explain how to rotate around the Z axle since this is the most common use of it.

     

    You need to calculate the COS and SIN of the angle you want to rotate, then insert them in the matrix like this:

     

    COS,-SIN,0,0

    SIN,COS,0,0

    0, 0, 1, 0,

    0, 0, 0, 1

     

    Replace the COS and SIN with their resp value. Observe that the SIN value is negated on the first row. To rotate the mesh 35 degrees we get SIN 35 = 0.5735764336 and COS 35 = 0.819152044. The matrix will look like this:

     

    0.819152044,-0.5735764336,0,0

    0.5735764336,0.819152044,0,0

    0, 0, 1, 0,

    0, 0, 0, 1

     

    So what if we want to shift, rotate and scale at the same time?

    The last row is not interfering with anything, so just enter the X,Y and Z coords there. The rotation and Scaling are using the same rows, but this isn’t a problem. Just multiply the COS value with the scale for that axle and the 1 in on the third row.

     

    To place the mesh at X10,Y3,Z-0.1, rotate it 35 degrees and scale all axes with 2:

     

    1.638304089,-0.5735764336,0,0

    0.5735764336,1.638304089,0,0

    0, 0, 2, 0,

    10, 3, -0.1, 1

     

    Easy! 🙂

     

    type

    This has to be “MESH” if the id is a mesh file or “GROUP” if it is a group file. We will only work with mesh files here.

     

    events

    This doesn’t seems to be implemented yet. I have seen some depo doors using events, but the never move in the game.

     

    matConfig

    My first thought was that this is the child’s material index, but it crash if I set it to anything else than 0. There has to be one 0 for each child table +1. So if you have 3 meshes, there must be 3+1 zeros here.

     

    static

    Haven’t tested this one yet.

     

    visibleFrom

    This is the near clip range, how near can the object be. leave it by 0.

     

    visibleTo

    Now, this is an interesting one. This is the far clip distance. If you want to see this model from far away, like maxed zoom out, increase this value. Also remember that it will put extra load on game performance.

     

    metadata

    This is where you define what goods you need for the production and the goods produced.

     

    requiredTypes

    This is an array of all needed goods. In this example it is empty because a forest only produce without any required input.

    productionType

    Here we can specify ONE goods that will be produced, in this case “WOOD”.

     

    Set up the base

    First we add the ground texture. Change the child node to:

    {

    id = “refinery/oil_old_lod_0_floor.msh”,

    transf = {

    1, 0, 0, 0,

    0, 1, 0, 0,

    0, 0, 1, 0,

    0, 0, 0, 1,

    },

    type = “MESH”,

    },

     

    Before we can test this we need to be sure we have enough 0 in the matConfig section:

    matConfigs = {

    {

    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ,0, 0, 0, 0, 0, 0

    },

    I added all the 0 we will need for this model at once, 17 meshes +1.

     

    If you save and generate a new map you should spot some “empty” industries.

    Lets add the factory building rotated 90 degrees; COS 90 = 0 and SIN 90 = 1, scale 1:1.

    {

    id = “industry/steel_mill_1850_lod_0_fabric.msh”,

    transf = {

    0, -1, 0, 0,

    1, 0, 0, 0,

    0, 0, 1, 0,

    -11, 8, 0, 1,

    },

    type = “MESH”,

    },

    Now place 2 ovens, no rotation scale 1:1.

    {

    id = “industry/steel_mill_1850_lod_0_oven.msh”,

    transf = {

    1, 0, 0, 0,

    0, 1, 0, 0,

    0, 0, 1, 0,

    8, 5.5, 0, 1,

    },

    type = “MESH”,

    }, {

    id = “industry/steel_mill_1850_lod_0_oven.msh”,

    transf = {

    1, 0, 0, 0,

    0, 1, 0, 0,

    0, 0, 1, 0,

    15, 11, 0, 1,

    },

    type = “MESH”,

    },

     

    The coal box has been both rotated 90 degrees and scaled down to 50% on X,Y and to 40% on Z.

    Remember that COS 90 and SIN 90 are 0 resp 1 multiplied with the scale:

    {

    id = “industry/steel_mill_1850_lod_0_mat.msh”,

    transf = {

    0, 0.5, 0, 0,

    -0.5, 0, 0, 0,

    0, 0, .4, 0,

    -15, 1.9, 0, 1,

    },

    type = “MESH”,

    },

    On my picture it has also been retextured to contain only coal. I will explain how to do this in another post.

    Now add in some clutter like steel pipes, crates and steel beams:

    {

    id = “asset/industry/steal_pipes_01_lod_0_steal_pipes_01.msh”,

    transf = {

    1, 0, 0, 0,

    0, 1, 0, 0,

    0, 0, 1, 0,

    2.4, -13, 0, 1,

    },

    type = “MESH”,

    }, {

    id = “asset/industry/steal_pipes_01_lod_0_steal_pipes_01.msh”,

    transf = {

    1, 0, 0, 0,

    0, 1, 0, 0,

    0, 0, 1, 0,

    1.2, -12.23, 0, 1,

    },

    type = “MESH”,

    }, {

    id = “asset/industry/steal_pipes_01_lod_0_steal_pipes_01.msh”,

    transf = {

    1, 0, 0, 0,

    0, 1, 0, 0,

    0, 0, 1, 0,

    0, -13.01, 0, 1,

    },

    type = “MESH”,

    }, {

    id = “asset/industry/wooden_box_03_lod_0_wooden_box_03.msh”,

    transf = {

    1, 0, 0, 0,

    0, 1, 0, 0,

    0, 0, 1, 0,

    10, 0, 0, 1,

    },

    type = “MESH”,

    }, {

    id = “asset/industry/wooden_box_03_lod_0_wooden_box_03.msh”,

    transf = {

    1, 0, 0, 0,

    0, 1, 0, 0,

    0, 0, 1, 0,

    11, -0.1, 0, 1,

    },

    type = “MESH”,

    }, {

    id = “asset/industry/wooden_box_03_lod_0_wooden_box_03.msh”,

    transf = {

    1, 0, 0, 0,

    0, 1, 0, 0,

    0, 0, 1, 0,

    12.3, 0, 0, 1,

    },

    type = “MESH”,

    }, {

    id = “asset/industry/wooden_box_03_lod_0_wooden_box_03.msh”,

    transf = {

    1, 0, 0, 0,

    0, 1, 0, 0,

    0, 0, 1, 0,

    13.4, 0.2, 0, 1,

    },

    type = “MESH”,

    },  {

    id = “asset/industry/metal_beam_01_lod_0_metal_beam_01.msh”,

    transf = {

    0.984807753, -0.173648177, 0, 0,

    0.173648177, 0.984807753, 0, 0,

    0, 0, 1, 0,

    12.6, -6, 0, 1,

    },

    type = “MESH”,

    },  {

    id = “asset/industry/metal_beam_01_lod_0_metal_beam_01.msh”,

    transf = {

    0.866025403, -0.5, 0, 0,

    0.5, 0.866025403, 0, 0,

    0, 0, 1, 0,

    13.4, -8, 0, 1,

    },

    type = “MESH”,

    },

     

    Now we only need to add the two last cranes. There are one base and one crane mesh for each crane.

    {

    id = “asset/crane_old_lod_0_cube.msh”,

    transf = {

    0.707106781, -0.707106781, 0, 0,

    0.707106781, 0.707106781, 0, 0,

    0, 0, 1, 0,

    -6, -8, 0, 1,

    },

    type = “MESH”,

    }, {

    id = “asset/crane_old_lod_0_polymsh.msh”,

    transf = {

    0.707106781, -0.707106781, 0, 0,

    0.707106781, 0.707106781, 0, 0,

    0, 0, 1, 0,

    -6, -8, 0, 1,

    },

    type = “MESH”,

    }, {

    id = “asset/crane_old_lod_0_cube.msh”,

    transf = {

    -0.707106781, -0.707106781, 0, 0,

    0.707106781, -0.707106781, 0, 0,

    0, 0, 1, 0,

    16, -2, 0, 1,

    },

    type = “MESH”,

    }, {

    id = “asset/crane_old_lod_0_polymsh.msh”,

    transf = {

    -0.707106781, -0.707106781, 0, 0,

    0.707106781, -0.707106781, 0, 0,

    0, 0, 1, 0,

    16, -2, 0, 1,

    },

    type = “MESH”,

    },

     

    If you save and test you will have this model producing wood. Let us change it to accept coal and wood to produce goods.

    In the metadata section we set up the requirements:

    metadata = {

    industry = {

    requiredTypes = { “COAL”,”WOOD” },

    productionType = “GOODS”

    }

    },

     

    That’s it folks.

    I will make a new tutorial on how to re-texture and create new goods types.

    #8286
    steveb
    Participant

    @douglas Hi there mate! Thx for that tutorial 😉 It has some nice pointers in it but does not help my case… Yes I added new goods in cargotypes and edited the vehicles to transport them.

    #8559
    SirSac
    Participant

    I have been thinking about the industry a lot:

    It would be great if the ‘goods’ (which need to be differentiated for this idea i.e.: lumber, refined oil, steel and not “goods”) would be transported to industries as they are now, with the exception that the industry in the cities would actually use these and crank out commercial goods. these goods would then need to be delivered to commercial buildings (both in the same city and in other cities.) This should allow the player to make the ‘easy’ cash early on by simply getting a supply line into a city as is already done in vanilla, however provide the added goal of a more complex supply network that would have to take goods from one city to another and even could provide some reasons for supply lines within a single city (like a city courier.) I image this as 3 separate goods that are in demand uniquely in each city. there for, you could have one city producing one type of goods, but still have demand for another cities finished goods. This would require the differentiation of final products in each chain IE: refined oil becomes plastic goods (stealing this idea from cargo mod 😉 ), steel becomes metal goods, lumber becomes construction materials (or whatever)
    Of course, the amount of commercial goods coming into a city to supply the commercial buildings will benefit the town and increase the value of commercial buildings and, in turn, raise the value of residential buildings based on the availability of high value commercial buildings.

     
    Basically, industry in a city should actually act as industry and not just a repository for goods. why would finished goods go to industry anyways :p

Viewing 15 posts - 1 through 15 (of 22 total)
  • The forum ‘Modding’ is closed to new topics and replies.