[MOD 0.12.11+] Robotic Combinators

Topics and discussion about specific mods
User avatar
DaCyclops
Long Handed Inserter
Long Handed Inserter
Posts: 85
Joined: Mon Aug 25, 2014 12:37 am
Contact:

[MOD 0.12.11+] Robotic Combinators

Post by DaCyclops »

Type: Mod
Name: Robotic Combinators
Description: Adds combinators for reading Robotic statistics to circuit network.
License: The MIT License
Version: 0.3.6
Release: 2016-04-06
Tested-With-Factorio-Version: 0.12.20
Category: New Item
Tags: circuit network, robots
Download-Url: https://github.com/DaCyclops/robotic-co ... ses/latest
Website: https://github.com/DaCyclops/robotic-combinators

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
Long description
Pictures
Version history
Modpacks
Plans
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
Last edited by DaCyclops on Wed Apr 06, 2016 6:49 am, edited 12 times in total.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14561
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [MOD 0.12.5+] Robotic Combinators

Post by Rseding91 »

That was fast :D 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).
If you want to get ahold of me I'm almost always on Discord.
User avatar
DaCyclops
Long Handed Inserter
Long Handed Inserter
Posts: 85
Joined: Mon Aug 25, 2014 12:37 am
Contact:

Re: [MOD 0.12.5+] Robotic Combinators

Post by DaCyclops »

Rseding91 wrote:That was fast :D 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.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14561
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [MOD 0.12.5+] Robotic Combinators

Post by Rseding91 »

DaCyclops wrote:
Rseding91 wrote:That was fast :D 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 :)
If you want to get ahold of me I'm almost always on Discord.
User avatar
DaCyclops
Long Handed Inserter
Long Handed Inserter
Posts: 85
Joined: Mon Aug 25, 2014 12:37 am
Contact:

Re: [MOD 0.12.5+] Robotic Combinators

Post 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....
Neotix
Filter Inserter
Filter Inserter
Posts: 599
Joined: Sat Nov 23, 2013 9:56 pm
Contact:

Re: [MOD 0.12.5+] Robotic Combinators

Post by Neotix »

What is difference between this mod and Logistic Combinators?
User avatar
DaCyclops
Long Handed Inserter
Long Handed Inserter
Posts: 85
Joined: Mon Aug 25, 2014 12:37 am
Contact:

Re: [MOD 0.12.5+] Robotic Combinators

Post 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.
Darloth
Fast Inserter
Fast Inserter
Posts: 118
Joined: Sun Jun 08, 2014 3:57 pm
Contact:

Re: [MOD 0.12.5+] Robotic Combinators

Post 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".
GopherAtl
Fast Inserter
Fast Inserter
Posts: 177
Joined: Sat Jan 31, 2015 7:54 pm
Contact:

Re: [MOD 0.12.5+] Robotic Combinators

Post 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 :D
My Mods:
Nixie Tubes - numeric displays for your circuit networks!
Logistic Combinators - use logistics values in circuit logic! -
Autowire - automate red/green wire connections
User avatar
DaCyclops
Long Handed Inserter
Long Handed Inserter
Posts: 85
Joined: Mon Aug 25, 2014 12:37 am
Contact:

Re: [MOD 0.12.5+] Robotic Combinators

Post 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.
waduk
Filter Inserter
Filter Inserter
Posts: 372
Joined: Tue Feb 10, 2015 5:44 pm
Contact:

Re: [MOD 0.12.5+] Robotic Combinators

Post 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).
User avatar
DaCyclops
Long Handed Inserter
Long Handed Inserter
Posts: 85
Joined: Mon Aug 25, 2014 12:37 am
Contact:

Re: [MOD 0.12.5+] Robotic Combinators

Post 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 :P
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 :P
User avatar
DaCyclops
Long Handed Inserter
Long Handed Inserter
Posts: 85
Joined: Mon Aug 25, 2014 12:37 am
Contact:

Re: [MOD 0.12.5+] Robotic Combinators

Post 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 :D)
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.
waduk
Filter Inserter
Filter Inserter
Posts: 372
Joined: Tue Feb 10, 2015 5:44 pm
Contact:

Re: [MOD 0.12.5+] Robotic Combinators

Post by waduk »

0.3.1 crash on new game :
Image

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.
User avatar
DaCyclops
Long Handed Inserter
Long Handed Inserter
Posts: 85
Joined: Mon Aug 25, 2014 12:37 am
Contact:

Re: [MOD 0.12.5+] Robotic Combinators

Post 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...
waduk
Filter Inserter
Filter Inserter
Posts: 372
Joined: Tue Feb 10, 2015 5:44 pm
Contact:

Re: [MOD 0.12.5+] Robotic Combinators

Post 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
User avatar
DaCyclops
Long Handed Inserter
Long Handed Inserter
Posts: 85
Joined: Mon Aug 25, 2014 12:37 am
Contact:

Re: [MOD 0.12.5+] Robotic Combinators

Post 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)
waduk
Filter Inserter
Filter Inserter
Posts: 372
Joined: Tue Feb 10, 2015 5:44 pm
Contact:

Re: [MOD 0.12.5+] Robotic Combinators

Post 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.
User avatar
DaCyclops
Long Handed Inserter
Long Handed Inserter
Posts: 85
Joined: Mon Aug 25, 2014 12:37 am
Contact:

Re: [MOD 0.12.5+] Robotic Combinators

Post 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]
waduk
Filter Inserter
Filter Inserter
Posts: 372
Joined: Tue Feb 10, 2015 5:44 pm
Contact:

Re: [MOD 0.12.5+] Robotic Combinators

Post 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 !
Post Reply

Return to “Mods”