Space Engineers

Space Engineers

Automated Inventory Sorting
Autositz 8 Oct, 2014 @ 1:31pm
In a Multiplayer environment - who needs to run the mod?
Multiplayer with or without dedicated server who needs to run the mod?

Just any of the users?
The Hoster/Server?
Everyone?
< >
Showing 1-15 of 18 comments
tyrsis  [developer] 8 Oct, 2014 @ 2:00pm 
The host, hosts the mod. Every client runs it. The clients are what do the sorting, not the host.
Autositz 8 Oct, 2014 @ 2:24pm 
But won't it confuse everything when more than one client is running the sorting? Even tho the parameters are set by the Containers.. Wouldn't it result in overlaps or back and forth moving in Containers asking for same resources? Like Client 1 sorts always into Cargo 1 and Client 2 sorts always into Cargo 4 while both Cargo looking for the same resource?
tyrsis  [developer] 8 Oct, 2014 @ 2:52pm 
Only the owner of the blocks sorts for it's blocks. This is due to a limitation in that dedicated servers do not run scripts, only the clients do, making it impossible for the server to sort. Only clients can sort.
Autositz 8 Oct, 2014 @ 3:46pm 
What happens when Containers get set to Owner:"nobody" then? They won't be sorted in&out then?
But i can see another problem here, haven't tested it out yet.

Player 1 sorts Ingot into his Cargo 1 while Player 2 sorts Ingot aswell into his Cargo 2.
Wouldnt the Ingots be moved back and forth all the time then due to the fact that everyone sorts his own Containers? Or does he not take from other owners even tho it's shared (share with faction/everyone)?
Last edited by Autositz; 8 Oct, 2014 @ 3:48pm
tyrsis  [developer] 8 Oct, 2014 @ 4:10pm 
When something is set to nobody, nobody sorts it.

The only person sorting for any block is their owner. The reason for this is because you can't share states or information between clients easily. Nor does the server run scripts in dedicated. So the only way for this to work across all platforms (single, multi and dedicated) the clients need to run it, and only the owner can sort their own blocks.

Any yes, cargo is not pulled from containers not owned by that player. This is definitely not a faction friendly mod. Unfortunately that will be this way until they fix a few issues with the API.

As the API gets fixed and added to, this limitation will disappear.
Last edited by tyrsis; 8 Oct, 2014 @ 4:11pm
Autositz 8 Oct, 2014 @ 4:16pm 
Thanks a lot for clearing this out. This helps setting up the mod.
TaikoDragon 8 Oct, 2014 @ 6:09pm 
So if I'm understanding this corrently, your blocks will only sort when you're connected to the DS?
Autositz 8 Oct, 2014 @ 6:41pm 
If you mean by DS a dedicated server, then NO!
Your blocks will only sort when you are inside ANY GAME with containers OWNED BY YOU and demanding containers ALSO OWNED BY YOU.
tyrsis  [developer] 8 Oct, 2014 @ 10:58pm 
Yes this is correct. Dedicated servers do not run scripts. Only the clients on the server run them. This is a bug / limitation of scripting currently, and is why I had to do things the way I did them in order to get dedicated servers to sort at all.
Coreinsanity 9 Oct, 2014 @ 8:50am 
I don't have much experience modding this game, but I have seen that the SEServerExtender allows for plugins. Is there a way to incorporate this into it as a plugin, allowing the server to execute it? (It would have to look at who owns the containers, so it doesn't sort one person's stuff into some one else's container, but yeah)

I don't know if the SEServerExtender has enough access to be able to do this or not, as I haven't really looked into modding SE yet.
Last edited by Coreinsanity; 9 Oct, 2014 @ 8:52am
Coreinsanity 9 Oct, 2014 @ 9:26am 
I had a look at the ModAPI and the server extender source, as well as a plugin some one wrote to spawn meteors:

https://github.com/DraygoKorvan/SE-utils/blob/master/SE-Utils/Core.cs - Noting here that he is able to bring in mod API components:
SEModAPIInternal.API.Common (among others)

Then having a look at the mod API, the SEModAPIInternal includes:
SEModAPIInternal.API.Entity.InventoryEntity type, which has (among others):
InventoryEntity.RefreshInventory(),
DeleteEntry(InventoryItemEntity source)
NewEntry(InventoryItemEntity source)
UpdateAmount(InventoryItemEntity item, Decimal / float newAmount)

And the SEModAPIInternal . API . Eneity . InventoryItemEntity contains some stuff as well.

I'm still looking through it, I'm not sure if you can also utilize the base game's mod API, they reference stuff from Sandbox as well, but I don't know if you by extension can. I have to do some stuff now though, so can't continue looking for a while.
tyrsis  [developer] 9 Oct, 2014 @ 10:34am 
Extender is not in game API. I have already written many mods for extender. You can search for Blueprints and Shipyards, and also Safe Docking. While extender is great for server side mods, it is not good for client side only mods (or single player / multiplayer without dedicated).

That being said I could probably convert this mod for dedicated, but my goal is to keep this mod purely for in game API, as it was sort of a test mod to bring my other mods to single player.
Last edited by tyrsis; 9 Oct, 2014 @ 10:35am
Coreinsanity 9 Oct, 2014 @ 10:58am 
Yeah, I realized it was. Mostly just looking for options.

That being said, I can see this mod doing really well for a dedicated server script. As it stands now, even with the bugs fixed, the script won't run while my game isn't - which is the main reason why I have the server running as a dedicated in the first place, instead of just single player / self-hosted multiplayer.

So essentially what will happen is I log off, and the assemblers and refineries will eat through what they have and stop, and not be running for the rest of the time.

I can appreciate you wanting to make your other mods singleplayer, and keep the in game API, but I can really see this benefiting as a dedicated server script as well, if I might humbly ask you to reconsider (It would be nice to have both, really, but I can't blame you for not wanting to take on the upkeep on that, if that's a factor)
Last edited by Coreinsanity; 9 Oct, 2014 @ 11:50am
Dark 19 Oct, 2014 @ 8:27am 
Given that this mod is working on the client side only, and there is no way to coordinate clients...
Then how does it performs sorting of faction shared inventories without ending up with collisions/desyncs/race conditions?
Was the API improved enough to support some sort of a interclient synchronization?
I'm a little concerned about this.
Autositz 19 Oct, 2014 @ 9:23am 
Faction sorting should ONLY be enabled by ONE person, and also when using faction sort no other one should sort aswell!
Script is running very good on our dedicated server in current version.
< >
Showing 1-15 of 18 comments
Per page: 1530 50