Page 1 of 3

[MOD 0.12.x] Logistic Combinators

Posted: Mon Aug 10, 2015 6:53 pm
by GopherAtl
Logistic Combinators

Image

Info:
Adds a variant of the constant combinator; instead of outputing constants you specify, though, it takes the types you specify and gets the values from the local logistics network, allowing you to build combinator and other circuit network systems that use data from the logistics network.
License
Long Description
Pictures
Version history
Config Settings
Use in Mod Packs
post format notes

Re: [Mod 0.12.x] Logistic Combinators

Posted: Mon Aug 10, 2015 7:07 pm
by CrispyOMNOMS
This is great for my latest multi-functioning furnace setup, I had to wire every single logic chest to every single smart inserter to every single power pole just to us my own combinatory logic with robots. This will cut down on the fiddly wire placement ten fold!

EDIT: I can't seem to get the download url to work, do I need to do anything more than just click on it?

EDIT 2: Downloaded it from the web link. :)

Re: [Mod 0.12.x] Logistic Combinators

Posted: Mon Aug 10, 2015 7:09 pm
by GopherAtl
CrispyOMNOMS wrote:This is great for my latest multi-functioning furnace setup, I had to wire every single logic chest to every single smart inserter to every single power pole just to us my own combinatory logic with robots. This will cut down on the fiddly wire placement ten fold!
that's the idea :) You're hardly alone, I see people every day, here and on reddit, surprised and sad to learn they can't use logistic network values directly in combinators, so I made a thing, and now they can (if they install the mod)

Re: [Mod 0.12.x] Logistic Combinators

Posted: Mon Aug 10, 2015 9:48 pm
by DOSorDIE
Great MOD!

Is it possible to make one who show in a chest the aktiv robots (flying and that in the Roboport)?
I want to know and controll how many i have.
So i can make a chest with robots and when <100 then put some in the Roboport.
That would be great!

Re: [Mod 0.12.x] Logistic Combinators

Posted: Mon Aug 10, 2015 9:52 pm
by GopherAtl
DOSorDIE wrote:Great MOD!

Is it possible to make one who show in a chest the aktiv robots (flying and that in the Roboport)?
I want to know and controll how many i have.
So i can make a chest with robots and when <100 then put some in the Roboport.
That would be great!

hmm. maybe? it'd be a completely different method under the hood, but I dunno any reason it wouldn't be doable. I will look into it, it is a good thought. I don't think logistics or construction robots are assigned to any roboport when active, only when idle and possibly when charging, so it might be expensive to be doing the checks constantly for how many robot entities are within the entire logistics area, though, particularly with many people's tendency to have thousands of them. So not sure it would be practical, could be a performance hit.

Re: [Mod 0.12.x] Logistic Combinators

Posted: Mon Aug 10, 2015 10:55 pm
by DOSorDIE
GopherAtl wrote:
DOSorDIE wrote:Great MOD!

Is it possible to make one who show in a chest the aktiv robots (flying and that in the Roboport)?
I want to know and controll how many i have.
So i can make a chest with robots and when <100 then put some in the Roboport.
That would be great!

hmm. maybe? it'd be a completely different method under the hood, but I dunno any reason it wouldn't be doable. I will look into it, it is a good thought. I don't think logistics or construction robots are assigned to any roboport when active, only when idle and possibly when charging, so it might be expensive to be doing the checks constantly for how many robot entities are within the entire logistics area, though, particularly with many people's tendency to have thousands of them. So not sure it would be practical, could be a performance hit.
That would be great when you look at it.
Maybe this helps
https://forums.factorio.com/forum/vie ... 96&t=13855
But i need it only for the aktiv Logistic System ... not all.
For my outposts i make the same and deliver robot when they need.

Re: [Mod 0.12.x] Logistic Combinators

Posted: Mon Aug 10, 2015 11:31 pm
by GopherAtl
DOSorDIE wrote: That would be great when you look at it.
Maybe this helps
https://forums.factorio.com/forum/vie ... 96&t=13855
But i need it only for the aktiv Logistic System ... not all.
For my outposts i make the same and deliver robot when they need.
At a glance, it doesn't so much help as confirm my concerns about the performance! Active ones - ones that are currently flying about - are the expensive ones, it should be fairly cheap to find the count sitting idle in roboports. His is, admittedly, searching the entire world, apparently, but still, he says it takes it several seconds - completely freezing the game - to get the count. Even if I check 1/1000th the area, something that takes just milliseconds is just not something I can be doing in on_tick. An entire game cycle has to run in just 16 milliseconds, after all!

Re: [Mod 0.12.x] Logistic Combinators

Posted: Tue Aug 11, 2015 7:07 am
by DaCyclops
DOSorDIE wrote: That would be great when you look at it.
Maybe this helps
https://forums.factorio.com/forum/vie ... 96&t=13855
But i need it only for the aktiv Logistic System ... not all.
For my outposts i make the same and deliver robot when they need.
Well how about that, your asking the exact same things I was asking Gopher :D

From what Gopher confirms, the LUA just doesnt have a way of reading the current robot status from a logistics network (and from what my investigation has revealed, there is no LUA scripting access to Logistics Networks as a whole....). so to even calculate it, would require calculating the robots around each roboport and inside each roboport. which would be inaccurate the moment two roboports are placed within 50 squares of each other....

Im having some thoughts on if its possible to approximate the figure for the current Logi network, without killing the game every second.

Re: [Mod 0.12.x] Logistic Combinators

Posted: Tue Aug 11, 2015 7:31 am
by Neotix
If we put 2 or more Logistic Combinators in the same Logistic Network, and we connect them together, we will get multiplied values? Or there is some code to detect how many Logistic Combinators is in network and always show proper values?

Re: [Mod 0.12.x] Logistic Combinators

Posted: Tue Aug 11, 2015 8:47 am
by DOSorDIE
GopherAtl wrote: At a glance, it doesn't so much help as confirm my concerns about the performance! Active ones - ones that are currently flying about - are the expensive ones, it should be fairly cheap to find the count sitting idle in roboports. His is, admittedly, searching the entire world, apparently, but still, he says it takes it several seconds - completely freezing the game - to get the count. Even if I check 1/1000th the area, something that takes just milliseconds is just not something I can be doing in on_tick. An entire game cycle has to run in just 16 milliseconds, after all!
Why we do split the script that it need longer ... it dont need a update each seconds.
Make a internal database where the roboports are so we dont need to search each time.
The distance to search the next roboport is fixed but we need only all from the same logisic system.
So its easy to search from the exists roboport for new ones.

Ask all roboport (we known now its position) so its easy do a script.
And its enough to do this all x seconds todo not makeing heavy load.

EDIT:
Plan B:
Make a "Marker chest" who is need next to all Roboport i want to control (So searching for all/new Roboports is not needed)
All Marker Chest make a query of the roboport next to it (flying and in the Roboport)
and that is show in the "Output chest" like the Logistic Combinator.
For the outpost make a "Outpost chest" that only count the Roboport next to it.

Re: [Mod 0.12.x] Logistic Combinators

Posted: Tue Aug 11, 2015 9:36 am
by vampiricdust
Absolutely fantastic mod! GopherAtl you are awesome. This is a huge leap for circuit networks, finally we can use circuit logic with logistic values. I can't tell you how many times I have been playing with combinators and wished I could do this.

I'm so going to a lot of time getting to know your creation & how to abuse it.

Re: [Mod 0.12.x] Logistic Combinators

Posted: Tue Aug 11, 2015 12:31 pm
by GopherAtl
DOSorDIE wrote:All Marker Chest make a query of the roboport next to it (flying and in the Roboport)
and that is show in the "Output chest" like the Logistic Combinator.
For the outpost make a "Outpost chest" that only count the Roboport next to it.

The flying ones are the problem. If the roboport even has this information, it doesn't seem to make it available in any way, so knowing where the roboports are only lets me determine the area to be searched for all entities of the type "robot." Have you seen how many roboports people use? dozens, hundreds, all overlapping, with thousands and thousands of robots? That is the problem. I could probably put something together that wouldn't be too bad if used with moderation in worlds with smaller roboport setups, but I have no control over how people use my mod, and the people with the most heavy logistics robot use would be the people who most want this kind of functionality!

I won't be distributing a mod that I wouldn't recommend people use, and unless some fundamentally different way to determine the active bot count is found, this falls firmly in that set. Sorry :(



Thanks to everyone for the interest and feedback. Please share any contraptions you make with these, as that's the best part of making mods in the first place!

Re: [Mod 0.12.x] Logistic Combinators

Posted: Tue Aug 11, 2015 12:44 pm
by DOSorDIE
GopherAtl wrote:I won't be distributing a mod that I wouldn't recommend people use, and unless some fundamentally different way to determine the active bot count is found, this falls firmly in that set. Sorry
But is it possible to make the "Outpost Chest"?
I need to check the robots of my outposts ... so it mostly only 1 Roboport for me.
That would help a lot.
Please :roll:
When i know how i write it by myself ... but im not a Master in LUA.

Re: [Mod 0.12.x] Logistic Combinators

Posted: Tue Aug 11, 2015 1:23 pm
by DaCyclops
DOSorDIE wrote:
GopherAtl wrote:I won't be distributing a mod that I wouldn't recommend people use, and unless some fundamentally different way to determine the active bot count is found, this falls firmly in that set. Sorry
But is it possible to make the "Outpost Chest"?
I need to check the robots of my outposts ... so it mostly only 1 Roboport for me.
That would help a lot.
Please :roll:
When i know how i write it by myself ... but im not a Master in LUA.
im gonna have a play with having it recursive read the roboports into an array when placed, and then monitor the array's inventory contents (adding new roboports when placed near an existing array). Idle count is better than no count. May also have it give an "average" over the last half a minute or so, as a "Estimated Total".

My plan was always reading all those into their own unique Signals, Idle Construction, Idle Logistics, Total Construction, Total Logistics (the count for Totals being tagged with "Estimate" unless we can get a better figure through an LUA interface). Might get laggy on ultra-big builds (heres looking at you DemonEngineer) but may be 'light' enough not to bog down the tickrate on normal builds, especially if it is working from a list as opposed to checking for roboports every time (might also make it only do its maths every 5 seconds.)

Re: [Mod 0.12.x] Logistic Combinators

Posted: Thu Aug 13, 2015 9:25 am
by DOSorDIE
Found a bug
When i choose Oil, Heavy Oil, Light Oil, Petroleum, Acid, ... he always write 2147483647

Re: [Mod 0.12.x] Logistic Combinators

Posted: Thu Aug 13, 2015 11:37 am
by GopherAtl
DOSorDIE wrote:Found a bug
When i choose Oil, Heavy Oil, Light Oil, Petroleum, Acid, ... he always write 2147483647
Really? Thanks for reporting. I've got a meeting this morning for work, but I'll look into this and see about getting a fix out after lunch. Off the top of my head, I have no idea what might be causing this...

Re: [Mod 0.12.x] Logistic Combinators

Posted: Thu Aug 13, 2015 1:34 pm
by DOSorDIE
GopherAtl wrote:
DOSorDIE wrote:Found a bug
When i choose Oil, Heavy Oil, Light Oil, Petroleum, Acid, ... he always write 2147483647
Really? Thanks for reporting. I've got a meeting this morning for work, but I'll look into this and see about getting a fix out after lunch. Off the top of my head, I have no idea what might be causing this...
No need to hurry ... found a workaround.
I connected the Tank directy and then it worked.

Because the Roboport:
A friend of mine make for me the Outpost Chest.
So no need to make one ...
But you can look if the for the logistic system get to run (if you want).

Re: [Mod 0.12.x] Logistic Combinators

Posted: Thu Aug 13, 2015 3:29 pm
by GopherAtl
just did a test setup and it seems like this isn't my mod; smart inserters with a logistics condition involving crude oil don't function at all, the condition is apparently always false - tested with crude oil <, =, and > 0, and in all cases the inserter did nothing. Other fluids are likely the same. circuit network conditions work, as you found hooking directly to the tanks, but at present it seems the logistic network either doesn't track fluids, or doesn't test them properly in conditions.

:edit: passed this bug up, since it's if anything an inconsistent, or at least unexpected, behavior of the conditions on the logistics network - though not entirely inconsistent really (see my bug report post for details) Depending on the response there, I may update in the next version to just ignore, effectively outputting 0, for all signals of type "fluid."

Re: [Mod 0.12.x] Logistic Combinators

Posted: Thu Aug 13, 2015 6:51 pm
by GopherAtl
Release 0.1.1 out now (link)

Only one minor bug fix, signal types that are, for the logistics network, currently invalid (fluids and abstracts) no longer output MAX_INT, instead they output 0, and without all that time wasted trying to get their actual value (which does not exist)

Re: [MOD 0.12.x] Logistic Combinators

Posted: Sat Aug 22, 2015 12:53 pm
by vampiricdust
One thing to be mindful is negative numbers. Since the logistic bots will try to carry max load, this does cause the numbers to spike into negatives. If you're doing any arithmetic on the data, it can cause unintended behaviors. A simple decider combinator to ensure a non negative number can filter them.

Really love your mod sir. I find it more useful every night I play now.