[MOD WIP 0.6.X] TroZ Mod

Topics and discussion about specific mods
Post Reply
User avatar
TroZ
Inserter
Inserter
Posts: 21
Joined: Mon Sep 16, 2013 12:34 am
Contact:

[MOD WIP 0.6.X] TroZ Mod

Post by TroZ »

Hi,

I've been working on a mod for a bit over a month and I feel it is time to let others try it and get feedback on balancing. The mod is intended for Freeplay, but also works in sandbox (with the one new building being non-functional).

Download: https://dl.dropboxusercontent.com/u/389 ... %20mod.zip

TroZ Mod has three basic features:
  • 5 additional Science Packs, with most of the higher level researches using at least one of them
  • Radars are now useful in freeplay, reporting on how many creepers are in the area. Additionally, there is a Tracking Station that predicts when the next attack will be, which becomes more accurate the more radars you have (up to 10)
  • The Rocket Defense building is now much harder to build, requiring much more resources to build. (I envision it as a building with a bunch of rocket launchers with radars and tracking stations guiding the rockets)
Basically, this mod makes many aspects of the game harder / take more resources. I also wanted to make some less used items used more (like I always build lamps by hand, but one of the new science packs have lamps as an ingredient, so you need to make an assembly line for them).

Science Packs
I started off adding new science packs, because it seems strange to me that you would research advanced chemistry and accumulators and flying with basically the same materials. I came up with 5 new science pack types, and modified the requirements for various technologies to use them. The new science packs are:
  • Chemistry Science Pack - 2 coal, 1 stone, 1 iron ore, 1 copper ore, gives 5 - used for chemistry research and some rocket research (rocket fuel composition)
  • Military Science Pack - 1 submachine gun, 5 basic magazines, 1 iron plate, 1 basic inserter, gives 5 - used for military research (something like the inserter fires the gun at the plate to test different bullets and armors)
  • Electronics Science Pack - 10 copper cable, 6 basic circuits, 5 iron plates and 2 lamps - enough to build some test circuits and maybe a transformer with the cables and iron and the lamps to indicate circuit output
  • Rocketry Science Pack - 1 rocket launcher, 10 rockets, 1 radar, and 5 military science packs, gives 5 - rocket testing materials, using the inserter from the military pack to fire rockets at the iron plate, or using the radar to track their range / speed
  • Vehicle Science Pack - 1 car, 1 fast transporter belt, 2 steel plate, 3 wood - only used for train research (if you already know about cars and trains, cars would be developed before trains, so I changed their research order), testing a car pulling a wood and steal cart compared to a fast transporter belt
Over 50 technologies had their requirements modified to use the above science packs.

Radar and Tracking Station
Radars were used in the last demo level, but currently aren't useful in the full game, so I gave them a use. I had this idea on my own, but then later saw this mod which also adds a use for radars. I didn't like how that mod worked, so I made my own version.
Radars when completing scanning a sector will report on how many creepers are in an area north, south, east or west of the radar. This is a bit helpful, but isn't really useful after 1 or 2 radars.
A tracking Station can be researched and built. This acts like a radar as well, but will also 'combine' its scans with the scans of the other radars and give an estimate of the time on the next attack, with an accuracy increasing the more radars you have, up to 10. The tracking station will also give an estimate of the size of the attack once it completes a scan with less than 30 seconds left until the attack. A warning will also be given when an attack is in progress (which may be after you see the creepers attack if you have a low number of radars). These messages will appear at the top left silently, but estimated attack sizes and attack warnings will also be displayed as print messages (like if you try to put a building in an invalid location).
The tracking station is intended to work as a goal for the mid-game, being somewhat resource intensive, but giving a good benefit. It takes a little more power than a radar to run, but gives the nice additional info. A tracking station with 10 radars (the amount needed for accurate reports) requires a good amount of electricity to keep running.
Due to the way the game works currently, tracking stations only work in freeplay, and will probably break in 0.7 due to upcoming changes in how creepers will attack according to some posts in these forums (but hopefully I'll be able to fix it up quickly). You can still build the tracking station in sandbox, but you won't get any reports.

Rocket defense
The rocket defense was turned even more of a major end game project. It still needs about 5000 steel, but it now requires multiple radars, tracking stations, rocket launchers, rockets (2000!), logistics robots and logistics chests to store and load the rockets into the launchers, and overclocked computers (computers with 1 of each type of level 2 upgrade module) increasing the iron and copper needed significantly. Even with all these additional parts, I have made the rocket defense able to be built by an assembly machine by having the steel and other high amount parts built into a 'Rocket Defense Part' sub-assembly and then needing 50 of those in the final assembly step. Here is an image of a factory that I built that only produces Rocket Defense buildings:
Image


Other Changes
There are many other changes. Some notable ones are:
  • Cars and trains now share engine and axle parts (Car: 2 axles, 1 engine, Locomotive: 8 axles, 4 engines, Train wagon: 4 axles)
  • Science labs need more power
  • 2 new smaller chests made from stone and bricks
  • Rockets need coal (for thrust)
  • Green science packs need to be researched
  • Burner inserters need 2 stone (to contain the fire)
This mods also can optionally work with the Treefarm mod, version 7.1. It actually mods that mod to make several balance changes.
  • Coal can no longer be made from charcoal (only done by geologic processes in real life)
  • Cookery output amount and fuel values modified to be closer to real life (total output of cooking now has less fuel value than the input, but each individual output item has more fuel value than an individual input item).
  • Fields need a burner inserter to be build (something is planting and harvesting the trees, assumingly it runs on some of the wood it cuts)
  • Fertilizer research needs Chemistry Science Packs
I also wanted to make this mod work with F-Mod (not that it doesn't work with it, but there are no specific interactions), but I haven't played enough with F-Mod to completely understand / figure out how they should interact (other than knowing that with alien artifacts much more common, that they should be used in construction of the Rocket Defense somehow, along with the metals that F-Mod introduces).

Images
New science packs and Tracking Station:
Image
Factory that makes all the science packs:
Image


Conclusion
If you would like, please try out my mod, alone or with Treemod, and tell me what you think about, any balancing issues, or way it could be enhanced or how it could interact with other mods. I'm still working on this mod, and have a few more ideas that I may implement, but I think I have the biggest changes done.
Thanks!


Permissions
I give permission for people to download and play this mod (obviously), but also to continue work on this mod if I don't respond to replies in this thread that ask for a response for over a month. I grant permission for others to mod this mod in their mods, as I did with Treemod (not that I can stop you, but I just wanted to specifically state that that was fine for separate mods to do). I also give permission for other mods to use parts of my mod (graphics and code) as long as they list me as a contributor to the resulting mod.

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [MOD WIP 0.6.X] TroZ Mod

Post by kovarex »

This looks very nice, I will definitely try it and I think that some changes are going to be inspiration for the vanilla game for sure :)

Just one small note, radar actually is useful in the freeplay, it keeps quite big area around it uncovered on the map. (You know that pressing M opens map right? :)

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [MOD WIP 0.6.X] TroZ Mod

Post by kovarex »

I took a look at the mod (just at the scripts and insides, didn't play yet).
I really like the amount of comments everywhere and that it is nicely written, I can see you have some programming experience :)

I always do some kind of "code review" when I open new mod, to give some insights what can be done more easily.
It also gives me feedback of what of the interface is not documented or insufficient.
So here it is (feel free to ignore me^^):

There is one method (isn't documented, shame on me) that could simplify your code (and make it less fragile).
It is force.getentitycount used as

Code: Select all

game.player.force.getentitycount("radar")
In the demo we use it to keep track the count of mining drills/furnaces built so we could remove the tracking of built/destroyed/mined mines/furnaces, the same way you are doing it now :)
You don't have to worry about speed here, count of entities per force are kept precomputed inside the engine.

At this place:

Code: Select all

--allow lab to use new science packs
data.raw.lab["lab"].inputs =
{
    "science-pack-1",
    "science-pack-2",
    "science-pack-3",
    "alien-science-pack",
	"science-pack-chemistry",
	"science-pack-military",
    "science-pack-rocketry",
    "science-pack-electronics",
	"science-pack-vechicle"
}
I believe it would be better to extend the input table (add new science packs) rather then rewriting it, so you won't collide with possible different mod that would add something there as well.
The same with adding some new unlock-recipe effects to technology.

The rest is 100% fine as far as I can tell :)

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [MOD WIP 0.6.X] TroZ Mod

Post by kovarex »

There are two bugs, that when you load existing game with the mod (that was started without it).
  • Modified technologies and recipes are not reloaded from original.
    Every force have it's own, version of technologies and recipes, the reason is, that we plan ways to modify some recipes/technologies only for some players, but not for other, imagine technology that will make some recipe cheaper for example.
    There are two possible ways to solve it.

    Code: Select all

    -- this is simple way to reload changed technologies and recipes
    -- the drawback is, that this will revert all custom changes made to recipes/technologies during game
    -- (currently it wont hurt, but in the future it might)
    for index, force in pairs(game.forces) do
      force.reloadtechnologies()
      force.reloadrecipes()
    end
    

    Code: Select all

    --  it is better to reload just recipes that were modified by the mod.
    -- note, that recipes and technologies that were added by the mod (not just modified)
    -- don't need to be reloaded, as these are created from prototypes when the mod is loaded for the first time
    for index, force in pairs(game.forces) do
      local technologies = force.technologies
      technologies["changed-technology-1"].reload()
      technologies["changed-technology-2"].reload()
      local recipes = force.recipes
      recipes["changed-recipe-1"].reload()
    end
    
  • Recipes that are unlocked by some technology don't get unlocked when the technology is already researched.

    The example of the workaround is in data/base/migrations/2013-05-30_Factorio_0.5.0.lua
    Here we added some additional recipes to technologies, and unlocked these for player that have already researched these.

    Code: Select all

    local forcelist = game.forces
    for index, item in pairs(forcelist) do
      local technologies = item.technologies
      local recipes = item.recipes
      if technologies["logistics-2"].researched then
        recipes["fast-splitter"].enable()
      end
      if technologies["logistics-3"].researched then
        recipes["express-splitter"].enable()
      end
      if technologies["steel-processing"].researched then
        recipes["steel-axe"].enable()
        recipes["steel-chest"].enable()
      end
    end
    
The code making these one-time changes is best to be put in <your-mod>/migrations/migration_name.lua
The code will be used only for saves that were saved when this migration didn't exist, so it won't apply for new games, or for saves, that were already saved with your mod.

P.S. If this is too hard to understand for any reason, I can make these migration files for you :)

grobyc
Long Handed Inserter
Long Handed Inserter
Posts: 60
Joined: Sat Apr 27, 2013 8:49 am
Contact:

Re: [MOD WIP 0.6.X] TroZ Mod

Post by grobyc »

I was so eager to test this mod from old save then I create code of migration file myself.

Code: Select all

local forcelist = game.forces
for index, item in pairs(forcelist) do
  local recipes = item.recipes
  local technologies = item.technologies
  technologies["electronics"].reload()
  technologies["automobilism"].reload()
  technologies["military"].reload()
  technologies["rocket-defense"].reload()
  technologies["rocketry"].reload()
  if technologies["electronics"].researched then
    recipes["science-pack-electronics"].enable()
  end
  if technologies["automobilism"].researched then
    recipes["science-pack-vechicle"].enable()
    recipes["axle-assembly"].enable()
    recipes["diesel-engine"].enable()
  end
  if technologies["military"].researched then
    recipes["science-pack-military"].enable()
  end
  if technologies["rocket-defense"].researched then
    recipes["defense-computer"].enable()
    recipes["overclocked-defense-computer"].enable()
    recipes["rocketdefensepart"].enable()
  end
  if technologies["rocketry"].researched then
    recipes["science-pack-rocketry"].enable()
  end
end
Edit: For start I see potential for this mode because create bigger and more complicated factory and for that matter is this game :D .

User avatar
TroZ
Inserter
Inserter
Posts: 21
Joined: Mon Sep 16, 2013 12:34 am
Contact:

Re: [MOD WIP 0.6.X] TroZ Mod

Post by TroZ »

Thanks for the feedback so far!

Yes, I have programming experience, but this is my first time working with Lua.

I'll try using game.player.force.getentitycount("radar") - that would definitely simplify some of the code :)

I'll also look into adding on to the tables instead of replacing them for the lab input and the technology unlocks. That would make integration with other mods easier.

I'll look into making a migration file or using the one grobyc provided. I had looked at three other mods, and I don't think any of them used one, which is why I didn't realize their use.
Is the migration file loaded based upon the date at the beginning of the migration file vs the date of the save file (the save was made before the date of the migration file, so it has yet to be applied to the save file), or is it based upon the version number at the end of the migration file name (save was made with version 0.3.0 of the mod, and the mode is now version 0.4.0, so all migration files 0.3.X would be run)?


Thanks again for all the input - hopefully I'll have an update in a few days incorporating all these suggestions.

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [MOD WIP 0.6.X] TroZ Mod

Post by kovarex »

TroZ wrote: I had looked at three other mods, and I don't think any of them used one,
The reason probably is, that it was not modifying existing technologies or recipes so it wasn't needed.
TroZ wrote: I'll look into making a migration file or using the one grobyc provided. I had looked at three other mods, and I don't think any of them used one, which is why I didn't realize their use.
Is the migration file loaded based upon the date at the beginning of the migration file vs the date of the save file (the save was made before the date of the migration file, so it has yet to be applied to the save file), or is it based upon the version number at the end of the migration file name (save was made with version 0.3.0 of the mod, and the mode is now version 0.4.0, so all migration files 0.3.X would be run)?
The only way the name of the migration matters is, that it defines the order.
Every save game datafile contains set of names of already applied migrations. When new game is started, names of all migrations are included although these were not applied.
When you load any save game, the available migrations are compared with these already applied, all migrations that were not applied (new ones) are executed.

This means, that you don't have to really think about it, you can just drop another migration file to the migration folder and it will get executed in all relevant save games.
[/quote]
TroZ wrote: Thanks again for all the input - hopefully I'll have an update in a few days incorporating all these suggestions.
You are welcome, thank you for the mod, I'm looking forward to try it out (I will do so while testing before 0.7 release)

n9103
Smart Inserter
Smart Inserter
Posts: 1067
Joined: Wed Feb 20, 2013 12:09 am
Contact:

Re: [MOD WIP 0.6.X] TroZ Mod

Post by n9103 »

Nice work!
All the new science packs sure are a pain to incorporate in anything resembling a tidy or compact factory :p
Some small complaints though, mostly about having to manually make science packs to unlock the Tier 2 Assembler, because unlocking Assembler 2 requires packs that would require Assembler 2 or 3 to make.
I definitely feel like the progression there is forcing me to take a step backwards, and that's magnified by the need for other complex packs for the basic necessities like Turrets.
Perhaps reducing the Military pack to just 2 ingredients would fix those stalling points?

Bonus points though, for incorporating the TreeFarm mod well. Unfortunately, the changes you made caused me to abandon the cokery in the mid-game, and just run wood for my fuel source.
Maybe others that run distant smelter bases and use bots to supply them would still use the cokeries as-is, but I don't.
Colonel Failure wrote:You can lose your Ecologist Badge quite quickly once you get to the point of just being able to murder them willy-nilly without a second care in the world.

grobyc
Long Handed Inserter
Long Handed Inserter
Posts: 60
Joined: Sat Apr 27, 2013 8:49 am
Contact:

Re: [MOD WIP 0.6.X] TroZ Mod

Post by grobyc »

Mod bring problem. Technology "Automation 2" can't contain "Military 2" on requires, eventually "Military 1".

If you want make your factory full automaticlly you must make all one by one. To make "Automation 2" U need first discover "Military 2" with contain "Military Science Pack". To make it you need "Submachine gun" or "Inserter". This two entities need "Assembling machine 2" with is in "Automation 2". Loop is closed.

I lower requires of "Automation 2" technology from "Military 2" to "Military 1" and go further.

n9103
Smart Inserter
Smart Inserter
Posts: 1067
Joined: Wed Feb 20, 2013 12:09 am
Contact:

Re: [MOD WIP 0.6.X] TroZ Mod

Post by n9103 »

Yea, that's what I mean. I had to hand-make all those packs.
Total grindfest, worse than getting from iron pick to electric mine. :(
Colonel Failure wrote:You can lose your Ecologist Badge quite quickly once you get to the point of just being able to murder them willy-nilly without a second care in the world.

User avatar
TroZ
Inserter
Inserter
Posts: 21
Joined: Mon Sep 16, 2013 12:34 am
Contact:

Re: [MOD WIP 0.6.X] TroZ Mod

Post by TroZ »

Well, I'm working on the update, and it seems that automation 2 needing military 2, armor making and steel processing is a bug!
I have a comment right above that line that states that that is supposed to be the prerequisites for armor 2.

If you want to fix it yourself, change line 233 of the /TroZ/prototypes/technology.lua from
data.raw.technology["automation-2"].prerequisites = {"armor-making", "steel-processing", "military-2"}
to
data.raw.technology["armor-making-2"].prerequisites = {"armor-making", "steel-processing", "military-2"}
You may have to start a new game, or you should be able to use '~' to open the console and run the corrected line and the following one to set things the way they should be.
data.raw.technology["automation-2"].prerequisites = {"automation"}

I guess I copied and pasted the wrong '2' technology name.

I'm working on other like the migration file and making this mod play nicer with other mods by not over-writing technology unlocks, but just adding on to them. I'm also making a few other tweaks, like lowering the cost of Advanced Science (science pack 2 and chemistry science pack unlock) from 50 to 40 of pack 1.


Part of the 'aim' of this mod was to make managing all the science packs hard. It isn't shown in the screenshots that I posted, but another test run I build a single shared belt loop supplying the the labs with science packs (I had only 8 at that point).
I think I may have nerfed the treefarm mod too hard, but I'm not sure what the right balance is. The original treefarm mod allowed you to turn 4KJ/item wood into 14KJ/item Coal-Coke (coal is 8KJ/item) for 0.3 electricity per tick (0.1 per tick per cookery, three cookeries needed assuming you just have them in a line. For comparison, a single mining drill using 3 electricity per tick, and since the tree farms themselves don't need power, the mod give you almost twice the burnable energy for about 1/10 the electricty (not counting the inserters needed), with the only requirement being extra processing time. My nerf was to assume that part (more than 1/2) of the wood being converted to charcoal was burned in the process, as would happen in real life, so the power for the cookery is only used to monitor the process (and maybe start the fire). It would help, I think If I could somehow specify that wood could not be used to make steel (doesn't burn hot enough), so charcoal or better would need to be used, but I don't think there is a way to do that currently, without doing tricks like once a second checking every furnace and if it is making steal remove and wood fuel it may have. I didn't nerf coke as bad as I did charcoal, but you aren't getting real benefit from making it either, and you wind up with less total energy (about 20% energy per item, but 30% less items). I would also like have coke make steel faster that coal would, but that also doesn't seem possible currently without a lot of programming trickery. I'm not sure if I should make coke a slight gain in energy over coal to justify the processing, I was assuming that there were some situations were you had coal on one side of a belt and an ore on the other where having the higher energy per item coke would be a win (you could feed more furnaces as each furnace would be taking fuel less often) but considering that now, it is always then ore that you run into a limitation with first as even a single wood can smelt several ores (and I wound up buffing wood by 1KJ).

I'm hoping to have an update out tomorrow night (as I'll be away this weekend and would be able to get an update out then).

n9103
Smart Inserter
Smart Inserter
Posts: 1067
Joined: Wed Feb 20, 2013 12:09 am
Contact:

Re: [MOD WIP 0.6.X] TroZ Mod

Post by n9103 »

The complications of the science pack management is a good thing, mostly.
I think the (for me) 9th and final pack (vehicle pack) may have been a bit too much though, as it throws out any possibility of using linear setups that remain homogeneous.
It's no longer possible to lay out continuous lines of labs, and have all packs supplied to them automatically.
You have to either revert to hand-loading one set, or reconfigure for a crisscross looking setup.
Considering I generally always design my whole factory aiming at my science center, that's not really much of an option.
I'll probably try setting up with the need for crisscrossing in mind next game.
Then again, nerfing out one of those science packs altogether wouldn't be unwelcome. :p

As for ore on one side, fuel on other, that's *always* my setup (until electric furnaces for the boosters, but that's *late* game workings) but fuel isn't burned through so quickly (even with just wood, even under the .4.0 values) that a basic inserter can't keep up with supplying a furnace, so long as there's items on the belt.
Nowadays, even a single basic inserter can feed wood onto a belt fast enough to fully feed no less than 5 steel furnaces (probably a lot more, but if it can feed five, then it's not a real issue.)

About the only way you could make the "reduced item count but higher energy density" solution really work would be to make energy requirements (or energy supplied) so low that a basic inserter could not keep up with feeding furnaces in cases where you don't want wood (or whatever else you'd want to nerf) to be an option.
But that's a really big step away from good gameplay, if you ask me.

Simply condensing the overall size, but not overall energy, with a long processing time seems a balance enough.
I'll be one of the first to say that the original increasing energy process was imba, but you've gone a bit too far in the other direction I'd say.
Even if you did find a way to force certain processes to use only coal or better, it would only affect those limited processes, and only serve to needlessly handicap the player's early game/sustainability.


On different matters, got a bug for ya.
For the attack warnings, every now and then I would get a prediction/alert message that had negative numbers. I had 2-4 radars and 1 early warning system.
Colonel Failure wrote:You can lose your Ecologist Badge quite quickly once you get to the point of just being able to murder them willy-nilly without a second care in the world.

User avatar
TroZ
Inserter
Inserter
Posts: 21
Joined: Mon Sep 16, 2013 12:34 am
Contact:

Re: [MOD WIP 0.6.X] TroZ Mod

Post by TroZ »

Ok, here is an updated version:
https://dl.dropboxusercontent.com/u/389 ... 00.3.1.zip

This now has migration files, although I couldn't figure out how to modify fuel values from within the migration file.
It corrects the issue of automation 2 being hard to research (it only requires electronics research and red and green science packs now)
I've also tweaked the fuel values of the Treefarm mod. Converting wood to charcoal is still an energy loss overall, but charcoal can be used in some recipes that wood can't (chemistry science packs and rockets). Coal to Coke is now a small energy win (less items, but about 11KJ of extra energy, more than 1 coal, but less than 1 coke). Wood was returned to standard fuel value (4KJ from the 5KJ I had it at). This should make the tree farms useful for a big supply of low energy wood fuel and make cookeries useful for converting the wood to charcoal for recipes or for improving slightly the energy of your coal mines by converting to coal to coke, but limits the nearly free energy that the mod originally allowed you.
I also think I addressed the negative attack amount issue. The estimate error was based upon the number of radars, with the estimate getting an extra penalty if the tracking system 'thought' the attack was within the next 30 seconds, but was really longer than that. The extra penalty could push the error percent over 100% if you only had a few radars, which could let a negative random number be picked. If this happens now, the attack amount will be said to be 1. (in reality, it appears in freeplay that the attack amount is always 2 more than the last attack, and each attack is 4-14 minutes apart, with the first attack not happening for an hour, AFAIK)
Finally, I've changed how the mod adds new recipe unlocks so that it won't overwrite unlocks that other mods add.

n9103
Smart Inserter
Smart Inserter
Posts: 1067
Joined: Wed Feb 20, 2013 12:09 am
Contact:

Re: [MOD WIP 0.6.X] TroZ Mod

Post by n9103 »

Don't suppose this is being worked on to bring it into the .7.x versions?
Colonel Failure wrote:You can lose your Ecologist Badge quite quickly once you get to the point of just being able to murder them willy-nilly without a second care in the world.

User avatar
Dysoch
Filter Inserter
Filter Inserter
Posts: 445
Joined: Fri Oct 18, 2013 2:27 pm
Contact:

Re: [MOD WIP 0.6.X] TroZ Mod

Post by Dysoch »

any chance this will be updated?
i really like the science packs and tracking station.

if not, can i take over and add it to my own mod?
Creator of:
- DyTech
- DyWorld
- DyWorld-Dynamics
- DyWorld-Dynamics 2
Active since Factorio 0.6

Post Reply

Return to “Mods”