Page 1 of 1
UDP packets on chest listener
Posted: Thu Jul 11, 2019 12:33 pm
by gamecompiler
Hi
,
i guess theres a way to create for example a "chest listener", are there any ways to create a udp socket from inside the mod?
I would like to implement a chest listener that broadcasts its inventory via udp..
I never used to code in Lua, im more familiar with Java. If my goal is not possible i would actually throw away my idea - would not involve much time into it.
Did someone tried to archive this or know if theres a udp interface?
Ive got some old dot matrix displays next to me. Wouldnt it be fun to use those to display production statistics?
With kind regards, gamecompiler
Re: UDP packets on chest listener
Posted: Thu Jul 11, 2019 1:39 pm
by mrvn
check out the clusterio mod
Re: UDP packets on chest listener
Posted: Thu Jul 11, 2019 5:01 pm
by gamecompiler
Thank you very much for your answer
Its not really what i am searching for (but nice mod!). The mod writes its data to a file, a "back" - backend from outside the game - then parses the data and serves it.
That is one way to get it done. But it would be a way better if factorio it self will archive this.
If there is no other possibility i actually will do it like Clusterio. I am searching currently for ways to do it. It seems that UDP is not supported - but maybe i am missing something.
Maybe i am wrong, the read/write operation of the clusterio mod must/should be synchronized. Otherwise a race condition will happen. I am not sure if the os will secure this.
Re: UDP packets on chest listener
Posted: Thu Jul 11, 2019 5:20 pm
by eradicator
gamecompiler wrote: Thu Jul 11, 2019 5:01 pm
That is one way to get it done.
That is the *only* way to get it done. Mods are not allowed to read any data from the "outside world".
Re: UDP packets on chest listener
Posted: Fri Jul 12, 2019 2:46 pm
by slippycheeze
gamecompiler wrote: Thu Jul 11, 2019 12:33 pm
i guess theres a way to create for example a "chest listener", are there any ways to create a udp socket from inside the mod?
There is not, no. Your mental model is wildly far from the reality of the situation, I'm afraid. I can see how you came by it, but the way it works in practice is radically different from any sort of network interface inside the game.
Re: UDP packets on chest listener
Posted: Fri Jul 12, 2019 3:05 pm
by BlueTemplar
While probably limited to stay inside the game for now, this feels relevant to the discussion :
Feathernet: Autoconfigured Native and IPv6 Networking over Factorio Circuit Networks
Re: UDP packets on chest listener
Posted: Sat Jul 13, 2019 3:48 am
by slippycheeze
Nah, the author mentioned they implemented a (custom) ClusterIO server protocol wrapper to provide a GRE tunnel to their router, so Factorio was on the IPv6 Internet. ...or at least adjacent to it. Given support for publicly routable addresses, though....