Warning: Blueprints made in version 0.2.1 will not work with future versions. I performed a code re-write that changed entity names. Sorry for anyone this effects.
License
License
The MIT License (MIT)
Copyright (c) 2015 Alan 'DaCyclops' Brown
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Long description
Long description
A combinator that reads the statistics off the local Logistics Network, and feeds them into the circuit network on a set of new signals.
Pictures
Pictures
The Robotic Combinator outputting all 4 signals into Nixie Tubes.
The newly added Signals
Version history
Version history
Version 0.3.5 (2016-04-06): Fixed issue with starting new game
Version 0.3.5 (2016-03-26): Global Init Fix
Version 0.3.4 (2015-10-21): Factorio 0.12.11 Migration
Version 0.3.3 (2015-09-13): To help with script update time; Further reduced polling rates, disabled Empty Storage Stacks by default
Version 0.3.2 (2015-09-12): Fixed crash on new games, Reduced default polling rate
Version 0.3.1 (2015-09-12): Code Rewrite, Added more signals to Robotic Network Combinator
Version 0.2.1 (2015-08-29): First Release Version, since LuaLogisticNetwork was added and I no longer needed to program a complex system to use the mod.
Modpacks
Modpacks
Go ahead. I would be happy for people to use this.
Plans
Plans
Clean up/replace the graphics
Manage to do that without bothering YuokiTani
Add Personal Robotics Combinator and Local Robotics Combinator (see post below)
Special Thanks
GopherATL, for answering my questions at the start, and for making Nixie Tubes
kovarex and the team, Both for their work on the game, and also for adding LuaLogisticNetwork out of the blue...
waduk, for feedback on just how much script-update my additions had added... And for testing a pre-release... and general awesomeness.... can I fit anything else in h*cut*
WaylandSmith, for the Global Init fix, as well as a little global->local cleanup
Re: [MOD 0.12.5+] Robotic Combinators
Posted: Sat Aug 29, 2015 3:58 am
by Rseding91
That was fast I'm glad you like the LuaLogisticNetwork (and LuaLogisticCell). It's been something I've wanted to add for a while and finally just decided to do it the other day
It's always satisfying to see new parts of the API actually get used (and used correctly).
Re: [MOD 0.12.5+] Robotic Combinators
Posted: Sat Aug 29, 2015 4:08 am
by DaCyclops
Rseding91 wrote:That was fast I'm glad you like the LuaLogisticNetwork (and LuaLogisticCell). It's been something I've wanted to add for a while and finally just decided to do it the other day
It's always satisfying to see new parts of the API actually get used (and used correctly).
I was working on this mod back in 0.12.3, and was daunted by the need to calculate, well, everything on my own. The addition of the Lua interfaces and the "get network" methods on Surfaces/Forces just made like 99% of the extra work disappear, so there was no reason not to get up this morning and get it poured out. I already had (basic) graphics and prototyping done, so it was just getting the onTick code functional.
Im fairly sure it should still be functional cross-surface (so when space is released) or multi-force because of the "get network" methods allowing me to just chain my references off the entity properties. So thank you for the good work.
Re: [MOD 0.12.5+] Robotic Combinators
Posted: Sat Aug 29, 2015 4:22 am
by Rseding91
DaCyclops wrote:
Rseding91 wrote:That was fast I'm glad you like the LuaLogisticNetwork (and LuaLogisticCell). It's been something I've wanted to add for a while and finally just decided to do it the other day
It's always satisfying to see new parts of the API actually get used (and used correctly).
I was working on this mod back in 0.12.3, and was daunted by the need to calculate, well, everything on my own. The addition of the Lua interfaces and the "get network" methods on Surfaces/Forces just made like 99% of the extra work disappear, so there was no reason not to get up this morning and get it poured out. I already had (basic) graphics and prototyping done, so it was just getting the onTick code functional.
Im fairly sure it should still be functional cross-surface (so when space is released) or multi-force because of the "get network" methods allowing me to just chain my references off the entity properties. So thank you for the good work.
You can also use the LuaLogisticNetwork to read logistic contents (and modify them) - which you could use in your other mod until that functionality is added to the base game at some future point
Re: [MOD 0.12.5+] Robotic Combinators
Posted: Sat Aug 29, 2015 5:49 am
by DaCyclops
Rseding91 wrote:You can also use the LuaLogisticNetwork to read logistic contents (and modify them) - which you could use in your other mod until that functionality is added to the base game at some future point
Your thinking of Logistics Combinators, which is not actually my mod. Its GopherATL's, though his code did help me with mine. I did read that though, and think it would be useful for him to make use of. And seeing some of the additional stats that have opened up (like "full_or_satisfied_requesters") has given me some other ideas on the topic....
Re: [MOD 0.12.5+] Robotic Combinators
Posted: Sat Aug 29, 2015 6:01 am
by Neotix
What is difference between this mod and Logistic Combinators?
Re: [MOD 0.12.5+] Robotic Combinators
Posted: Sat Aug 29, 2015 6:13 am
by DaCyclops
Neotix wrote:What is difference between this mod and Logistic Combinators?
Robotics Combinators reads statistics from the Logistics Network, like the current robot counts, and outputs them to the Circuit Network so people can work with them.
Logistic Combinators reads the value of the items chosen from the actual value in the Logistics Network, and outputs to the Circuit Network.
Re: [MOD 0.12.5+] Robotic Combinators
Posted: Sat Aug 29, 2015 9:02 am
by Darloth
This is the mod you want if you like to say "If I have less than 50 construction robots, build more and add them to a roboport".
LogisticCombinators is the mod you want if you like to say "If I have less than 50 steel bars, smelt more and add them to the network storage".
Re: [MOD 0.12.5+] Robotic Combinators
Posted: Sun Aug 30, 2015 7:35 pm
by GopherAtl
man, I go out of town for 2 days and so many things. XD Nice work!
As many times as people asked me for this, I was planning to whip something out as soon as the api supported doing it sanely, but again someone has beaten me to it, leaving me free to work further down my list of mod ideas
Re: [MOD 0.12.5+] Robotic Combinators
Posted: Tue Sep 08, 2015 1:50 am
by DaCyclops
So I have been having some thoughts about direction to go with this mod, and just wanted to share. Hoping that by opening the thought process open to all to input, it leans towards a better mod for future use.
Now that I have sat down and looked through the LuaLogisticCell and LuaLogisticNetwork I am thinking about turning this into multiple entities:
Robotic Network Combinator
Deals with the Logistics Network the device is in. What the current device does, but with newer functions.
Add in Signal for "Roboport Count" based off LuaLogistcNetwork.cells count
Add in signal for "Storage Count" based off LuaLogistcNetwork.storages count
Add in signal for "Empty Storage Space" based off count of "empty chestspace" on LuaLogistcNetwork.storages table
Add in signal for "Pending Requesters" based off LuaLogistcNetwork.requesters count minus LuaLogistcNetwork.full_or_satisfied_requesters count
Add in less-updated signals (to counter lag from calculating all the cells) for the following LuaLogistcCell properties across Network
charging_robot_count
to_charge_count
Personal Robotics Combinator
Deals with the placing player's personal Robotics Cell (both their Requester/Provider stats, as well as their Personal Roboport stats).
Would output placing player's statistics no matter where they are on current surface. I could make it distance-limited, but I cant think of a situation in which that would be preferable and not totally annoying... Would need logic to deal with player removed from game and player not on surface.
Use signal for "Construct Available" and "Construction Total"
Add in signal for "Construction Radius" based off LuaLogistcCell.construction_radius
Add in signal for "Charging Robots" based off LuaLogistcCell.charging_robot_count
Add in signal for "Robots Needing Charge" based off LuaLogistcCell.to_charge_robot_count
(freshly thought)Add slowly updated Signal for "Robots Chasing Player" based off LuaLogistcCell.to_charge_robots that are greater than X distance from player.
Local Robotics Combinator
Considering this one as its more of a fringe use case, and would deal with the single closest "cell" (generally, the closest roboport only). Basically for people wanting to monitor a specific roboport, or want quicker information than the "Robotics Network Combinator" can deliver for its slower-updated values.
Would include values based off:
LuaLogistcCell.stationed_logistic_robot_count
LuaLogistcCell.stationed_construction_robot_count
LuaLogistcNetwork.charging_robot_count
LuaLogistcNetwork.to_charge_robot_count
Maybe split charging counts into logistics charging and construction charging.
Most of the values I am hoping to display would be ones that could be used for automation or information about the network. I generally lean towards "give them X and Y to do the maths for Z themselves" but make a small exception on the "Pending Requesters" being a X-Y=Z
Any thoughts would be appreciated.
Re: [MOD 0.12.5+] Robotic Combinators
Posted: Thu Sep 10, 2015 6:13 am
by waduk
Having more signal is always good, especially with the pending request. Does that signal is the info we get when construction bot reporting missing item from placed blueprint ?
That would be neat, no more over produce or prep item. Just produce it as needed.
Does adding all those new signal will rose the script update significantly ?
That's my main concern.
Recently i use a handful of sensor from Smarter circuitry mod, not much, only about 40 of them (even planning to add much more).
But then i notice the fps took a hard hit. With debug view, it rose to 12.xxx point ( i don't know what the number are representing, seconds ?). All i know bigger number is bad.
Now, even half of them actually in idle, no entity to detect in front of them.
So, will this new signal addition on this mod will do the same ?
If it does, i hope it can be configurable, i don't need real time count, but many user do (i know i would if i have faster computer).
Re: [MOD 0.12.5+] Robotic Combinators
Posted: Thu Sep 10, 2015 10:12 am
by DaCyclops
Do note its not actually the signals themselves (they are basically items) but rather the Combinators themselves that cause the lag. I can tell you the 0.1.0 branch was ULTRA laggy, because all I could do to calculate my figures was parse a slimmed-down version of the RobotStats mod every second. So basically you had a lag pause every second as the game calculated the content of every roboport on the map... The adding of LuaLogisticNetwork means i could get the figures straight from the game engine, which made fast updating possible, and hence lead to the 0.2.1 release.
With my current coding, I am making sure to take into account processes that might take a large amount of processing power to calculate. In fact, part of my refactoring has been re-integrating a config.lua file to allow adjustment of the update frequencies. There is a frequency for each of the 3 intended types, for both fast-tick and slow-tick updates. The Combinator updating as well as certain already-calculated values will process on fast-tick value per second, while certain calculations will be offloaded to calculate every slow-tick per second and stored for usage. Hopefully that will minimize possible lag, and let me adjust my default values after enough testing.
Once I have a working version (in this case, the 0.3.1 branch released) I will try to give it a test on some particularly heavy bases.... I have a couple of crazy ones in mind...
In the Github as of today, I have a first attempt at calculating charging robots going on the slow-tick updates (and failing to get figures), but my Storage Available will also end up in there... once I work out the code
Since I use the Github to store my code for when I move between computers, its possible to snatch a WIP preview that often works
Re: [MOD 0.12.5+] Robotic Combinators
Posted: Sat Sep 12, 2015 5:38 am
by DaCyclops
Okay, Version 0.3.1 has been released. You can find it on the first post or by going here.
I have updated the original item to the Robotics Network Combinator, and it now outputs 10 statistics of the Robotics Network it is placed within:
Available Logistic Robots
Total Logistic Robots
Available Construction Robots
Total Construction Robots
Roboports Count
Storage Chest Count
Empty Storage Stacks
Pending Requester Count
Robots Currently Charging
Robots Awaiting Charging
There are also a few more signals for future use (including Sad Robots )
I have also re-written the code to be a little less of a mess, and to make future additions much easier.
Do note that I still need to do testing on any impact this may have on very large networks. I am awaiting hearing back from a couple of people. But otherwise it appears to be stable.
Re: [MOD 0.12.5+] Robotic Combinators
Posted: Sat Sep 12, 2015 7:03 am
by waduk
0.3.1 crash on new game :
On current game, The script update rise significantly. Previously it's only about + 0.1
This version rise to + 2.1
Not major fps hit at the moment (3-5 fps), but i barely started, only using about 7 of them.
I'm reverting to 0.2.1 right now.
Re: [MOD 0.12.5+] Robotic Combinators
Posted: Sat Sep 12, 2015 9:49 am
by DaCyclops
Argh, that was totally my bad. I was so focused on a glitch with loading I forgot to check new games again after changing something....
I have fixed that mistake and adjusted down the default polling rates a little. Version 0.3.2 is up now. Sorry about that.
Waduk, if you could, could you give me a screenshot of one of these combinators running on your existing world showing the high scripting use? Just want some numbers to go by...
Re: [MOD 0.12.5+] Robotic Combinators
Posted: Sat Sep 12, 2015 12:56 pm
by waduk
Sorry for the late reply, have to cut a portion of the screenshot, to re-positioned entity info.
More than 10x script update increase between version.
The inserter that wired to combinator each set to "available construction/logistic=0"
Almost the same configuration in all outpost (currently 8).
0.2.1
0.3.2
Re: [MOD 0.12.5+] Robotic Combinators
Posted: Sat Sep 12, 2015 2:04 pm
by DaCyclops
Thanks for the screens. The main change between 0.2.1 and 0.3.2 was the addition of a few more calculated fields. I might have to do some investigation if some of my "fast-tick" calculations should be "slow-tick"... That being said, adjusting the fast/slow timers has reduced your expected load a little - if you want to adjust those yourself, you can find them in config.lua
The one other thing - could you pass me a screenshot of a whole combinator (so I can see your Storage Count and Roboport Count)
Re: [MOD 0.12.5+] Robotic Combinators
Posted: Sat Sep 12, 2015 4:06 pm
by waduk
0.3.2
Thanks, i change all value to 1 (that mean combinator is updating once every one second right ?). The 0.3.2 script update is now near the v0.2.1 value (but still twice as high).
Do note that the pic above was using the default you put in config .lua.
And the result seems "real time" for me.
Say i want to even lower the update value to once every 2 seconds, can i put the updating cycle in config.lua to 0.5 safely ?
Does using lower value than 1 giving a side defects on calculating cycle?
I think it's the current robot charging /waiting that give the high spikes/double the value. Each time the script was double in size, the current robot charging /waiting info is the one that pop-up in entity info windows.
I could be wrong though, it's hard to compare the entity box and script update since they were far away from each other.
Re: [MOD 0.12.5+] Robotic Combinators
Posted: Sun Sep 13, 2015 2:20 am
by DaCyclops
The way it calcs that value is basically how many ticks per second it tries to fire on. 1 would mean "once per second" in effect. I have done a little testing, and the game didn't complain about setting the value to less than 1 (I tried 0.5 and was getting it roughly every 2 seconds, and 0.01 was just not firing often at all).
Doing some analysis of my script update speeds with a variety of changes, I have found that the majority of the lag your experiencing appears to be related to the Empty Storage Stacks calculation (which is the most complex at the current point). I may release a version with that maths toggleable off (or defaulted to a faster version), as well as with a few more values moved to slowtick (we really dont need fast-updating on Cells and Storage count. its not like it is changing every halfsecond...). Maybe storage stacks needs to run on "ultraslowtick"...
EDIT: In fact, version 0.3.3 is up. Has the default polling rates again reduced, and also has the Empty Storage Stacks turned off by default. Should be much kinder on script-update.
[s]If you want values like 0.2.1, you can set the rc_polling_rate_network to 6 and the rc_polling_rate_network_slow to 0.01. looking back in my 0.2.1 code, rc_polling_rate_network was effectively hardcoded at 5 back then. Might lower the default values more too, considering that....[/s]
Re: [MOD 0.12.5+] Robotic Combinators
Posted: Sun Sep 13, 2015 8:34 pm
by waduk
This is perfect !
Before 0.3.3, even when setting all values to one still gives me double the script update compare to 0.2.1.
Now on 0.3.3 it even lower ! Sweet !
Thank you ! So much signal to play with !