Few Questions on various Dynamics

Place to post guides, observations, things related to modding that are not mods themselves.
Post Reply
BinaryMan
Inserter
Inserter
Posts: 21
Joined: Mon Mar 24, 2014 12:02 am
Contact:

Few Questions on various Dynamics

Post by BinaryMan »

I am looking at the DyTech files and Base files to understand some things. There are a few things I want to try but am not sure how to do it.

= Resource Placement =

Looks like the autoplace uses perlin noise with all the maps affecting each other. It looks pretty hard to calibrate things and the map settings can affect it (for example, with everything on Very High for all settings, DyTech materials were not in the starting area (this might be deliberate, or it might be regular resources being prevalent and negatively affecting other spawns).

Instead I would like to spawn resources using the following method: for each chunk, I want to check each resource and according to its probability setting (per chunk), if a random roll from 0 to 1 is < the setting, create one tile of that resource in the chunk (at a random x/y in the chunk that is place-able and doesn't have a resource already in it; re-try if water or resource is present and give up after X tries in case of all-water chunk).

I also want to make the resource tiles infinite and specify other things. DyTech lava it looks like this:

Code: Select all

    infinite = true,
    minimum = 10000, (min yield = 10%?)
    normal = 250000, (not sure about this)
Oil in Base is:

Code: Select all

    infinite = true,
    minimum = 750, (10%?)
    normal = 7500,
I have seen some screenshots with yield % (oil, 1 type of lava), and others for solid resources like ores at say 0.3/second when set as infinite. Does the "minimum" and "normal" refer to the min/max spawn amounts (as in oil spawns at say 100-200% and drops to minimum 10% yield?). I think I am missing a value here since I want to specific the min/max at creation, and the min after mining. Also, is it possible to somehow control the "drop rate" of the resource either intrinsically, or based on the entity that is mining it (say, a more efficient oil drill is not just faster but drains the deposit more slowly)?

My concern is that if not using autoplace then will anything spawn in new chunks, or can this custom resource spawn function be called on new chunk spawn to do so (with a hook or event or something)? I would also like to ensure at least one of each resource type within some distance of spawn (I think this means just spawning one of each inside an X/Y range in addition to the above random chance at map gen?).

= Variable Inserters =

I was able to find some information looking at the DyTech inserters, for example:

insert_distance = 2.3,
pickup_distance = 1,
pickup_position = {0, -1},
insert_position = {0, 1.8},

For belts I think its add 0.2 for long side, and subtract 0.2 for close side. What I am curious is if there is a way to script an inserter that can be configured on the positions instead of having many variants. Meaning, if there is a UI you can make for it where you can change its setting like maybe click on grid positions or buttons (a 5x5 area would work centered on the inserter) and then it will modify the entity properties above for that inserter?

= Power Sources =

When inheriting from existing prototypes Generator or SolarPanel, you are limited to the dynamics of those things. How to create a new kind of generator? For example, to consume a solid item or X amount of a liquid to generate some power? So you can create say "energy cells" and then a machine consumes them like a recipe and makes some KW or MW of power. Or, you could have instead of regular boiler mechanic, some kind of engine takes in water + coal or other source, and makes "steam" - instead of the temperature mechanic generating power a machine would consume a certain amount of the produced "liquid steam" and generate some KW or MW of power (it could handle multiple power sources with different recipes since I think the regular fuel mechanic doesn't work except in a regular boiler? Although, a burner inserter/miner does work on fuel directly - so it would be like a burner assembly machine that produces only the specific product(s) like steam?). This means the machine that consumes fuel replaces the boiler, and then the other machine that consumes the product of that replaces the generator. I tried making the energy consumption negative for an assembling machine... it didn't work as expected even though it shows up as a producer in power grid; it also operates normally but shows as unpowered and doesn't actually make any power.

= Lazer Robots =

I don't know if it's possible yet, but can you make a robot that can fire lasers? Flies like logistics robots, but comes out to shoot enemies from its base (base being like the roboport) ?

= Module Affecting Custom Properties =

Beyond the basic module properties I've seen (consumption, effectivity, pollution, speed), is it possible to make a module which affects a custom property used only in a mod? Example: The custom power source above, the steam generating entity: Accepts a module which increases its steam production. Say that is all the module does, and the machine won't take a regular productivity module. It could be used more creatively as a way to affect custom LUA scripts or any behavior really? Or are the existing attributes all that a module can work on?

= Fluid I/O on Machines (fluid_boxes) =

The DyTech blast furnace sets 4 outputs and 4 inputs. In all the recipes applicable to that, there is a symmetry to the input and output. Recipe like this:

Code: Select all

ingredients =
    {
      {type="item", name="clean-iron-ore", amount=1},
	  {type="fluid", name="lava-1600", amount=0.2}
    },
    results = 
	{
	  {type="fluid", name="molten-iron", amount=1}
	}

and, fluid box in oil refinery for example, fluid box like this:

production_type = "input",
pipe_covers = pipecoverspictures(),
base_area = 10,
base_level = -1,
pipe_connections = {{ type="input", position = {-1, 3} }}

No where does it specify which input or output pipe it will go to - when there is only 1 input or output then all applicable pipes are used. What I am wondering is what is the logic if you had say 4 inputs and 4 outputs? The oil refinery I see 3 outputs defined so I guess it just outputs them in the order they are defined matching with the order the multiple outputs are defined? Also, what is meant by base_area and base_level ? I see base_level as 1 or -1 only so far. Is this a graphical thing for the pipe connectors (z-level) ?

= Leaky Tank =

I heard there were Void Pipes created, but I wonder can a Tank be made via script to "leak" some units of fluid when it reaches 100%? Or I guess even with pipes can it be made conditional when full or near full some %?

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: Few Questions on various Dynamics

Post by orzelek »

To your first question about ores - take a look at Resource Spawner Overhaul (RSO in short) for different approach to ore generation.

jorgenRe
Filter Inserter
Filter Inserter
Posts: 535
Joined: Wed Apr 09, 2014 3:32 pm
Contact:

Re: Few Questions on various Dynamics

Post by jorgenRe »

You can do it using an accumulator as a base and have a script do the stuff.
So lets say you have a windmill then to make it generate energy you do as it is done in mopower: "local energy = game.windspeed*100000"
Wheras energy is the variable in the function:
"entity.energy = energy"

This can be worked on a bit and you can create for example a nuclear reactor that consumes items from a nearby special chest that it locates using lua code :)!
Those are the ones i can come up with atleast :)!
Just remember to use " < " well with if statements as you certainly don't want it adding energy all the time :)!
Logo
Noticed the told change in FFF #111 so il continue to use my signature ^_^
Thanks for listening to our suggestions, devs :D!
I would jump of joy if we could specify which tiles spawned in a surfaces

User avatar
oLaudix
Filter Inserter
Filter Inserter
Posts: 282
Joined: Sun Jun 14, 2015 3:24 pm
Contact:

Re: Few Questions on various Dynamics

Post by oLaudix »

BinaryMan wrote: I also want to make the resource tiles infinite and specify other things. DyTech lava it looks like this:

Code: Select all

    infinite = true,
    minimum = 10000, (min yield = 10%?)
    normal = 250000, (not sure about this)
Oil in Base is:

Code: Select all

    infinite = true,
    minimum = 750, (10%?)
    normal = 7500,
I have seen some screenshots with yield % (oil, 1 type of lava), and others for solid resources like ores at say 0.3/second when set as infinite. Does the "minimum" and "normal" refer to the min/max spawn amounts (as in oil spawns at say 100-200% and drops to minimum 10% yield?). I think I am missing a value here since I want to specific the min/max at creation, and the min after mining. Also, is it possible to somehow control the "drop rate" of the resource either intrinsically, or based on the entity that is mining it (say, a more efficient oil drill is not just faster but drains the deposit more slowly)?
Infinite resources are spawned just like normal ones but are handled differently. If you hover over oil deposit in game and use /c game.player.print(game.player.selected.amount) in console itll print the exact ammount of the oil left in the deposit. As for the numbers minimum variable says when the infinite resource will stop depleting and normal value says how much resource is 100% yield. Example: If the deposit have 11250 of oil in it itll give 150% yield since 11250/7500 is 1.5 (150%) At the same time if the deposit goes to 750 units itll stop depleting but will give only 10% yield (750/7500 = 0.1). If you change normal to 750 for example then the yield for same deposit will be 11250/750 = 15 (1500%). Itll deplete faster but at the same time will stop at 100% yield. Also itll cap at 10/s.
Image

Post Reply

Return to “Modding discussion”