Network access in mods ?

Place to post guides, observations, things related to modding that are not mods themselves.
dewitpj
Inserter
Inserter
Posts: 28
Joined: Sat Jul 09, 2016 7:57 am
Contact:

Network access in mods ?

Post by dewitpj »

Hi,

I did a very quick Google and found that mods don't have access to networking (I'm looking for a simple HTTP(s) client) - is this true ? If so, is this something that will be considered in the future ?

Thanks !
eugenekay
Filter Inserter
Filter Inserter
Posts: 929
Joined: Tue May 15, 2018 2:14 am
Contact:

Re: Network access in mods ?

Post by eugenekay »

Some reasons this will never happen:
  • Allows for data exfiltration from the game sandbox by smuggling it in the request body
  • Multiple clients making HTTP requests (in multiplayer) could get different responses from the server, causing desyncs
  • Latency of waiting for a response would make for an awful user experience
The best you can do is write_file to the script-output/ folder. On multiplayer servers you can use the RCON interface to run console commands, including LUA scripts. There is also send_udp / recv_udp which requires the data to be replicated to all multiplayer users.

Good Luck!
dewitpj
Inserter
Inserter
Posts: 28
Joined: Sat Jul 09, 2016 7:57 am
Contact:

Re: Network access in mods ?

Post by dewitpj »

Sorry, but you answer seems to focus a lot on multiplayer - my focus is way more on single player. The idea is that you have 2 or more players and using this mod, you can share resources between players. Players will need to load said resources into a train and send it to a station. The train (including resources) will then "disappear" from the player's map and spawn on the target players map, where it will go towards a station, rinse repeat.

The network parts will be the exchange of resources, so no real player XP impact that I can see?

Does the mod code not run in it's own thread ?

Thanks !
Rseding91
Factorio Staff
Factorio Staff
Posts: 16452
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Network access in mods ?

Post by Rseding91 »

dewitpj wrote: Tue Jan 06, 2026 6:06 am Does the mod code not run in it's own thread ?
It does not.
If you want to get ahold of me I'm almost always on Discord.
eugenekay
Filter Inserter
Filter Inserter
Posts: 929
Joined: Tue May 15, 2018 2:14 am
Contact:

Re: Network access in mods ?

Post by eugenekay »

dewitpj wrote: Tue Jan 06, 2026 6:06 am Sorry, but you answer seems to focus a lot on multiplayer - my focus is way more on single player. The idea is that you have 2 or more players and using this mod, you can share resources between players.
Singleplayer and multiplayer follow the exact same game logic - the player’s character controller is just “local”.

You may find Subspace Storage and Clusterio interesting.
dewitpj
Inserter
Inserter
Posts: 28
Joined: Sat Jul 09, 2016 7:57 am
Contact:

Re: Network access in mods ?

Post by dewitpj »

eugenekay wrote: Tue Jan 06, 2026 2:39 pm
dewitpj wrote: Tue Jan 06, 2026 6:06 am Sorry, but you answer seems to focus a lot on multiplayer - my focus is way more on single player. The idea is that you have 2 or more players and using this mod, you can share resources between players.
Singleplayer and multiplayer follow the exact same game logic - the player’s character controller is just “local”.

You may find Subspace Storage and Clusterio interesting.
Oh I see - thanks !

I see we have (as you mentioned) send_udp,recv_udp - even thou this seems to only be "bound" to localhost I can still use this - TO THE LAB ! :)
dewitpj
Inserter
Inserter
Posts: 28
Joined: Sat Jul 09, 2016 7:57 am
Contact:

Re: Network access in mods ?

Post by dewitpj »

Rseding91 wrote: Tue Jan 06, 2026 2:00 pm
dewitpj wrote: Tue Jan 06, 2026 6:06 am Does the mod code not run in it's own thread ?
It does not.
Thanks !
Post Reply

Return to “Modding discussion”