Beiträge von mauporte

Willkommen in der Transport Fever Community

Wir begrüßen euch in der Fan-Community zu den Spielen Transport Fever und Train Fever, den Wirtschaftssimulatoren von Urban Games. Die Community steht euch kostenlos zur Verfügung damit ihr euch über das Spiel austauschen und informieren könnt. Wir pflegen hier einen freundlichen und sachlichen Umgang untereinander und unser Team steht euch in allen Fragen gerne beiseite.

 

Die Registrierung und Nutzung ist selbstverständlich kostenlos.

 

Wir wünschen euch viel Spaß und hoffen auf rege Beteiligung.

Das Team der Transport-Fever Community


    Update (in case anybody cares): I stopped working on this project mainly because I realized some parts just couldn't be done with how the scripts are connected and which do exactly what (and I stopped playing since the base game feels too empty/plain to me); but the new update announced is going to introduce precisely the main thing that gave me problems: the dynamic changes in demand.
    Because of that I plan on adapting this mod to the update (though probably not immediately when it comes out since I haven't played in a while)

    last week got pretty heavy at work and I had no free time until sunday, but I have an update.:

    First of all I corrected some spelling and grammar mistakes, but more importantly I added new sections to both posts (with timestamps in red) and updated the images/tables with some information about waste and some corrected numbers. I would appreciate if anybody interested takes a look at those additions.

    Lastly, I wanted to share some screenshots (purple squares are the manufactured goods, since I haven't recreated the icons:
    }

    What I don't like about those other mods is that 30 years in I'm done and I'm bored.


    Now when it comes to waste/recycling the reason why I am not really talking about it is because historically speaking waste and slag has always been dumped nearby, (and tons of steel factories had slag mountains just beside them, most of them only started being cleaned up in the early 90's. It is only recently that we are thinking about the efficiencies of reusing such things which is why if added they would be more of a 1980-2010 timeline (and it could be a way to extend the campaign).


    The one exception to the recycling is recycling some metals since it has always been cheaper to throw chains, rings, etc in the smelter than sending people to the mines, even in medieval or ancient times.


    when it comes to city waste I am a big proponent of biodigestors, but this is more a piping thing, and while boats and trucks have been used to transport waste to landfills for a long time, only huge cities really needed this service back then, and even then cities usually try to handle this service inhouse to reduce costs.

    So this is how waste would work:

    from 1850-1970ish:
    - several landfills would spawn but they would work as power plant, they don't produce anything and demand waste

    -cities produce waste, but unless the landfill is nearby or the city is very big there won't be enough supply to make it worth it.

    -smelters produce slag which can be sent to building materials manufactories, as a material 2

    then from 1960-2010ish:

    - recycling plants would be buildable, (I need to refresh my knowledge on these developments, but) at the beginning they would only take waste and produce a small amount of waste metals, which can be sent to smelters of any kind ](and again, it might not be worth it)

    - as time goes on recycling plants start producing waste plastics, waste textiles and eventually even biofuels (again I need to recheck the history of this)

    I think one very good mod made by three persons is worth more than 2 or 3 mods which are similar.

    while I completely agree with the statement what I don't like about the other demand mods is that they just add more products to the existing production lines.


    For example: I feel that it is very dumb/useless to add livestock to meat to food, when you consider that grains to food gives the same result and is a much simpler production line. That's why I created the manufactured industries with so many recipes and instead separated the basic goods. And this is where I will be stubborn :/

    Mod Concepts:

    1- Basic Goods.

    First lets look at Basic Goods, of which there are 45 and are divided into 3 categories: 12 Food Items, 15 Materials and 18 Ores & Oil Products:




    These work exactly like the goods found in game, being composed of simple supply chains, the main difference is that only a fraction of these goods have cities as their final destination, and even then, those cities will eventually stop demanding such goods. Aluminum (1870), Polymers (1920) and Silicon (1940) will become increasingly important as the decades pass after their initial unlock.


    2- Manufactured Goods

    Next lets look at Manufactured Goods, and yes I am aware that some of the basic goods listed previously are technically manufactured goods, but I had to differentiate these two somehow:



    This is where the versatility comes into play as there are a lot of possible "recipes" for almost every manufactured good. Now, when deciding these combinations and industries/goods I tried to make no balance concessions and cared first about it making sense (and being historical is part of making sense). The only balance concession that I remember making is that I did not put textiles nor leather under furniture since clothes only have textiles/leather. If the garment factory was more versatile then I would've added textiles/leather to furniture as well. Even so I understand that some things might require clarification and I am open to suggestions, what I would not like is for the list to get much bigger (right now there's 15 goods). Manufactured Goods are the main products that cities will demand and are organized as a matrix of 3x2 categories:

    • Food Items (2 level 1 and 2 level 2)
    • Consumer Goods (3 level 1 and 3 level 2)
    • Industrial Products (3 level 1 and 2 level 2)


    Level 1 industries have only 2 inputs, while level 2 industries have 3 inputs. Level 2 Food Items are the easiest since they don't require level 1 manufactured goods , Industrial Products are the most complicated since they may require up to 3 manufactured goods. Input 1 usually corresponds to packaging except with industrial products and vehicles (although in a way you could consider the chassis of a vehicle as its packaging).


    Lastly, even though I am very happy with the icons for the basic goods, I will definitely be reworking the icons for the manufactured goods.


    3- Extractor Buildings

    Next we have Extractor Buildings, those in which raw materials are produced:




    and this is another place in which the limitation/versatility idea comes into play, since not all basic goods will be as abundant or even available depending on the climate, so in different maps different raw materials will become the backbone of your production chains. The oil pumpjack is simply a well in which natural gas is also found (which is why it also produces fuels). I have thought of the idea of adding acids as an input to farms to simulate fertilizers, but haven't looked into or given much thought as to how the effects would be simulated, increase in capacity? (I think this idea in particular might be tricky)


    I also decided against compost since ranches already produce 3 goods in general. When it comes to extractor building spawn I hope that there is a way to integrate it into 1 mod, but if not, worst case scenario I upload 3 mods, one for each climate.


    I also tried no to make any balance concessions here and dry climate should definitely be harder and much more reliant on synthetics. with the produce farms, I know that it is kind of weird to have them as mono cultures, but we can imagine that each farm represents a series of crops for each climate, with tomato, onion and cucumbers being the most commons.


    Another thing to say here is that when I was deciding the names and quantity and types of extractor buildings I was constantly checking world statistics and distribution of said products to keep me grounded. One exception is Sisal: the truth is that in tropical climates around the world there are several traditional crops that were used as textiles and are quite similar, jute being another of the common ones. I chose sisal simply because that's the maya textile crop and i like the mayas.


    4- Industrial Buildings

    Next we have Industrial Buildings, those in which manufacturing takes place, even if it is of basic goods:



    The only industrial buildings that aren't manufacturing plants of some kind is the waste disposal facility, the power plant and the materials recovery facility, the latter of which is the only one that has any output. All three of these buildings will purposely spawn near cities (oftentimes just outside the city). At one point I also thought of the idea of a market building that would accept bulk food items and also spawn near cities, but decided against it.


    The spawn weight of industry buildings was calculated with a basic 4:2:1 ratio from extractor to basic industry to manufacturing industry, with some changes. Climate doesn't affect industry buildings because in a sense (and for better or for worse) that was the whole point of the industrial revolution.


    While aluminum and polymers are very versatile, you don't unlock all of their uses immediately, these more or less reflect history (but more geared towards commercial application than the inventions/discoveries themselves). Silicon on the other hand might not be as versatile, but electronic factories will eventually stop demanding glass, so you need to set up a silicon to wafer production line in time before this happens.


    At an 1850 start most manufacturing industries are not available, and even at a later start you'd need ta very big map with a lot of industries to guarantee at least 1 of every manufacturing industry so having to build your own industries is necessary with this mod. that isn't a problem, that tricky part is that I would wish to limit that so that extractor buildings couldn't be built, only industry buildings; and something tells me that that isn't going to be possible though. The thing I haven't looked into is if the individual cost of each building can be changed (and maybe that's where extractor buildings can be made unbuildable by giving them very high prices).


    5- Vehicle Cargo (added 16/06/21)

    Next lets look at how cargo items are transported by vehicles:




    As far as I understand it the game does not assign different prices for different goods, instead income is calculated with distance/speed. At the same time, the game has a weight category for goods (which represents the average weight of 1m3 of said good), yet the default value is 1200 for every cargo item. The way I see it then, weight becomes our cost modifier for different goods. So far I based the current weights on real world values and some are indeed alarming like gold and silver: the Difference column shows by how much the weight differs from the default 1200 value and while some items might be too light, this will only affect how fast any given vehicle can reach its top speed so its more important to balance the heavy items rather than the light items.


    Lastly, while it would be cool to expand upon the vehicles, maybe adding things like covered hoppers, refrigerated boxcars, refrigerated tankers for milk, etc. it currently exceeds the objective of this mod, maybe at a latter stage. Same goes for the cargo models, for the moment being default models will be used (aluminum uses steel, for example)


    6- Town Demand

    And here is here I am so far. I would like to add a new land use: markets, for food items, but the next description considers it not existing and it also considers that residential doesn't exist:

    • at 1850:
      commercial buildings will demand one of these basic food items: fish, produce, coffee, bread, meat
      industrial buildings will demand one of these basic materials: glass, bricks, planks, steel
      at this point all cities demand 2 goods in total, both basic goods, and there 's a 50-60% chance of it being a resource that doesn't have to be processed, making some very early lines cheap.
    • starting at 1880:
      as commercial buildings upgrade they will start demanding level 1 food items: canned food or alcohol
      as industrial buildings upgrade they will start demanding level 1 industrial products: tools, machine parts or electronic devices
      at this point cities that you have developed are now demanding 4 goods in total the rest only demand 2 goods.
    • starting at 1910:
      as commercial buildings upgrade they will start demanding level 1 consumer goods: clothes, furniture or electronic devices
      as industrial buildings upgrade they will start demanding level 2 consumer goods: vehicles, specialty goods or luxury goods
      at this point cities that you have developed are now demanding 6 goods in total, the other cities only demand 2.
    • starting at 1940:
      as commercial buildings upgrade they will start demanding level 2 food items: processed goods or soft drinks and they will stop demanding basic food items
      as industrial buildings upgrade they will start demanding level 2 industrial products: industrial goods or prefabs and they will stop demanding basic materials
      at this point no city in the map demands basic goods anymore
    • starting at 1970:
      demand for level 2 goods becomes more common


    7- Town Supply (added 16/06/21)

    Towns will supply 2 goods:

    • Mail (to be expanded at a further date)
    • Waste (to be expanded at a further date)


    8- Final Remarks

    As I said I will change the icons for manufacturing goods, and I'm happy with my icons for basic goods. One of the aspects that I don't plan to do is create all of the models for all of the buildings, that's where I am hoping that other creators are interested enough to share their mods and maybe this can become a more complete package/experience, if not I'll just keep using the default ones, or if I do choose to create those models it will be at a latter date. Same goes for the models for cargo items.

    Introduction:
    For about a month or so I've been working on a mod, dedicating 2-3 days a week and I think I've reached a stage in which I can show my progress to other people, mainly for three reasons:

    1. I want to gauge if people would actually be interested in this idea
    2. I can always use input regarding ideas or alternatives, but especially regarding balance, etc.
    3. if people want to cooperate the better, there are tons of assets that already exist and that could complement this mod perfectly and even though I plan to ask several creators directly if this thread can speed that process up great. and everything will be credited.

    Objective: (added 16/06/21)

    In order to keep this thread focused I would like to expand upon the reason that I want to make this mod in the form of objectives:

    1- Campaign Feel

    1850-2000 should feel like a longer time:

    • Line Evolution: Some lines that were extremely profitable at 1860 might be completely abandoned mid game, some other lines might become much more important by 1970, quickly expanding their infrastructure around them, some rails might be rebuilt with better standards at other dates, etc.
    • Planning: planning ahead should of course be important, but with some randomization along the way to force the player to pay attention. Short, medium and long term plans should always be needed.
    • Game Speed: the game has 2 independent, controllable speeds: the animation and the calendar, and while I won't fix any of those speeds (everybody choose what they want) the idea is to more or less think of how this could be played at a slower calendar speed.
      • Using Civilization as an example: it would be like if every time you sat down you only played an era, at marathon speed, next day you play another era, etc.
    • Map Size: just like with game speed everybody choose what they want, but personally I prefer large maps with low industries and medium cities and that's more or less the mapsize-city-industry ratio with which work for this mod was started on.


    2- Versatility and Complexity:

    Solving puzzles is fun, but when there is only one solution for any given problem, or when the problems that you have to solve are mostly independent, 1-2 step operations with little variables, it eventually becomes boring: doing the same thing each time you start a new game and in the same order, over and over again. Usually when I figure out "the meta" of these types of games I either ignore it completely or stop playing altogether. So:

    • through versatility the idea is to allow more options, which depending on the random elements will be more or less viable;
    • through complexity the idea is to create the need for planning ahead: if you don't you will have problems further on, regardless of the versatility;


    4- Difficulty
    if easy = 0% and hard = 100%, then in an average hard game set on a temperate map:
    - Early Game (1850-1890) ≈ 80%
    - Mid Game (1890-1960) ≈100%

    - Late Game (1960-2000) ≈120%

    construction updateFn params should include the year (params.year)

    thanks, that was another question that I asked at one point, if the parameter "year" of the industry updateFn function would do the same (and since I've been burned by the wiki several times before I don't know what to think anymore jaja)

    I also found out by studying the sensless industries mod that I can add modifiers to variables in scripts directly from the mod.lua , which is probably what Doug was trying to tell me about. what I like about this solution is that instead of having 1 huge mod.lua i can break apart my tasks into 3 different scripts.

    I'll give it a try and hopefully, I'll be able to publish soon.


    thanks again

    I appreciate the response, but none of these mods help me with what I want to do (and I think you forgot our past conversation also because I already did all the industry modification in another script).


    all that's missing is to change the variable "year", to a dynamic variable that updates automatically. You helped me how to create that gamescript that gets said variable, but I haven't found the way to USE that variable with my industry modifiers. You told me that I should migrate the whole thing from mod.lua to the new gamescript and that way I could use them together and after a while of trying every single combination I could think of I started this thread where I learned that no, I can't migrate the mod.lua to the gamescript.


    So my question is: how do I integrate these two things?

    both the postRunFn and the runFn are exclusively in the mod.lua


    The addModifier call belongs into the runFn.

    thanks for the reply. (sigh), that's not even how they show it in the wiki, there they just put it at the end as a standalone line.

    I really don't want to bother people here with every little detail but the truth is that I thought I would be done by now, but since certain things are only available in scripts, some are only available in the gui thread some in the engine thread, some only in the mod.lua and syntax sometimes confuses me: everything seems more complicated than it needs to. But if you will indulge me, I have 1 more question:

    - I created a script that uses the update function of the engine thread to assign the current-year to a variable,

    - I want that to run a series of if statements to modify values of industries (and some other things) at certain years
    Q: if I cant use the addmodifier in the script in which I get the year, and if I can't get the year in the mod.lua, and if i can't bring variables from scripts to mod.lua (I was told), can I bring a variable or function from the mod.lua to the script? and if so how?


    thanks again

    for the last week I have been running tests trying to understand how it modding in TF2 works, and I gotta be honest: even though I have read all the wiki multiple times and have read tons of threads and downloaded several mods and studied them and even though i have easily made mods for other games in the past TF2 is very irritating to work with.


    Now I have a very simple script and I just can't figure out where to put the line "addModifier("loadConstruction", ModifyFarm)", I have tried at the begining, the end, in the update function, first line of the modifyfarm function, in between data and the function in between the brackets of the data function, as an init function, and nothing works, the game always crashes because "data" is nil (and local).



    Another question: is it possible to use postRunFn or runFn in scripts? or is it just for the mod.lua? and if so, where should i put it? the modding wiki doesn't explain much.

    You're going to need to define a custom set of production levels for the industry(ies) in question. That you can likely do in postRunFn, although I have not tried that myself.

    first of all I really appreciate your help.

    for the values I was planning on linking to a table using the industry name as an id to search.

    I migrated the whole test to the game_script file, and while I'm not getting any error codes anymore I don't think I'm putting the postrun process in the correct place as nothing happen

    If you're running a game script, then you can call game.interface.getGameTime() directly in the engine thread. You don't need to call it in the gui thread to then use the horribly awkward serialization routines to get that value into the engine thread.

    and how exactly do i use this? because if I don't have to do the whole update, handler stuff, then
    while this works in the in-game console:

    currentYear = game.interface.getGameTime() .data.year
    return currentYear

    in the script it keeps telling me that I'm trying to index a nil value (game and interface), then it also tells me that .data.year are unexpected adn of course now I'm left with a a function that's not in the file (getGameTime) and so the program tells me about how it doesn't support global functions, And that's what confuses me: I read several times the documentation they provided and I feel that their syntax changes or something is not really that clear.

    Where are you running this code? Is this a construction modifier function within mod.lua? If so, it will not work, as that code is only run once, when the game loads.

    this is a construction modifier function within mod.lua. Yesterday my tests were with a runfn process and I was just checking if at start things would change as I wanted to. I would play with different parameters and start different games at different years and adjust things and save some pieces of code. Today I started using this simple script but now in the postrunfn. first i used a local variable within the mod.lua named Year and i'd set static numbers to that variable and again start at different times, now i can use loops because of the postrun but i didn't test them much. Next is when I discovered that getting the current year is not that simple (I just thought there was going to be some sort of global function, or at least one i coudl easily reference in a base game file) that eventually led me to this thread and I read what's been posted here. I created a new file in res/config/game_script but as i said the whole load, save thing is very confusing and I also feel that I'm not experienced enough with lua and I get confused when i see what appear to be syntax changes (at least to me).

    Thanks for the reply: i did take a look at it, but the date a particular building was constructed is not a value that i can use for what i wish to accomplish. I need the current in game year. the funny thing is that i left this part of my coding to the end because i figured that extracting the year was going to be the easiest part. the rest of my code works (just a simple set of if statements), I even made a table with static values and simulated my own year counter and works.

    now: I've been using this simple code to run tests,

    If I can make this one react to the year (though i eiminated that line as first i need to extract the value) I'm set, I can create most of my scripts using a macro and a spreadsheet.


    I'm already using updateFn to change the capacity here, how could i use the parameter "year" described here?: https://www.transportfever2.co…types#updatefn_parameters

    I am also having trouble with this: I want to be able to run a loop that checks the current year and at several milestones I'd change stocks for several industries.


    as far as I understand it in order to get the year, I need to write a script in the gui thread which sends data 'game.interface.getGameTime() . date.year' to a variable in 'save' using 'sendscriptevent' the whole process needs to be "handled" with handleEvent then I can save that value in "load" and the transference of information from gui thread to the engine thread will be complete. Meaning that I can finally use the value in my if statements.


    Is this right? it feels like way too complicated just to get a simple value of 4 digits. also if someone could help me with some examples, as the explanations I've found haven't really told me much and I have bee running tests all day to no avail.