Page 3 of 18

Re: [MOD 0.11.x] The Fat Controller. Remote train management

Posted: Sun Nov 02, 2014 8:09 pm
by JamesOFarrell
Boogieman14 wrote:If that is what I think it appears to be, I think I'll gladly overlook that leftover debug statement ;) Can't wait to give that a whirl!
It is and it is working :) I just need to tighten up the text format (as changing it once people start posting blueprints will be a pain), fix this multiplayer desync issue and then I'll release it.

Re: [MOD 0.11.x] The Fat Controller. Remote train management

Posted: Sun Nov 02, 2014 8:32 pm
by Boogieman14
I'll be happy to do some pre-release testing if you want, just shoot me a PM :)

Re: [MOD 0.11.x] The Fat Controller. Remote train management

Posted: Thu Nov 06, 2014 1:52 am
by JamesOFarrell
So my new mod has been posted and I have learned a lot about how factorio GUIs works in multiplayer. I also wrote a fat controller style GUI for it that I should be able to port over so we can start getting some train management in MP games. There is also a whole manner of train related API changes I want to explore so lookout for a new version of TFC with MP support and alerting on train related errors coming in the next week or so.

Re: [MOD 0.11.x] The Fat Controller. Remote train management

Posted: Sat Nov 08, 2014 8:50 am
by Rahjital
JamesOFarrell wrote:So my new mod has been posted and I have learned a lot about how factorio GUIs works in multiplayer. I also wrote a fat controller style GUI for it that I should be able to port over so we can start getting some train management in MP games.
Any chance of sharing what you have learned? It would be great if the rest of us could learn from your experience instead of having to go through the same ourselves.

Re: [MOD 0.11.x] The Fat Controller. Remote train management

Posted: Sat Nov 08, 2014 9:01 am
by JamesOFarrell
Sure. This thread has some code from jeroon that's probably your best bet and should get you working. The gist of it is that factorio is not syncing the GUIs of mods so you need to destroy all GUIs in the onsave event and then recreate them. Be careful though because can't use onload as the new player doesn't exist in the event so you need to trigger an ontick event to happen just after the player connects. If you do this right you will cause one of 2 issues, desync on save or desync on connect. Either way it is a hack to get it to work. Jeroon's code is a better example than mine because his has desync on connect where as mine has desync on save (auto save triggers it). Shoot me a PM or hit me up on irc if you want more help.

Re: [MOD 0.11.x] The Fat Controller. Remote train management

Posted: Sun Nov 09, 2014 3:12 pm
by Rahjital
Thank you very much, I think I got it now.

Slpwnd mentioned a new luaevent (onplayercreated) to be included in the next version of Factorio. I wonder if it could be useful in case GUI syncing doesn't make it to the next version.

Re: [MOD 0.11.x] The Fat Controller. Remote train management

Posted: Mon Nov 10, 2014 10:53 pm
by ssilk
By this I think how cool it would be to have an event onVehicleGenerated() or so, to get rid of manually adding the trains.

Re: [MOD 0.11.x] The Fat Controller. Remote train management

Posted: Tue Nov 11, 2014 12:17 am
by JamesOFarrell
ssilk wrote:By this I think how cool it would be to have an event onVehicleGenerated() or so, to get rid of manually adding the trains.
I can do this now I just haven't. It was written this way so it could be used with a already in progress game but it should have an auto add option really. There are some cool new train events in 0.11 that i have even looked at yet. I just have too many mods and not enough time
Rahjital wrote:Thank you very much, I think I got it now.

Slpwnd mentioned a new luaevent (onplayercreated) to be included in the next version of Factorio. I wonder if it could be useful in case GUI syncing doesn't make it to the next version.
This should make things a lot easier to handle. Looking forward to 11.2.

Re: [MOD 0.11.x] The Fat Controller. Remote train management

Posted: Tue Nov 11, 2014 6:05 am
by ssilk
Remark: as I understand it, every change on the train creates a new train (or change on the loco?). Can become soon complex to not get lost the sorting in the list.

Re: [MOD 0.11.x] The Fat Controller. Remote train management

Posted: Tue Nov 11, 2014 7:55 am
by JamesOFarrell
ssilk wrote:Remark: as I understand it, every change on the train creates a new train (or change on the loco?). Can become soon complex to not get lost the sorting in the list.
Thats true. I keep track of them via loco now and if the train object becomes invalid it gets readded to the table so that issue is fixed mostly. The sorting is annoying. I can get the train name now though (and set it i think) so that will give me something to sort by.

Re: [MOD 0.11.x] The Fat Controller. Remote train management

Posted: Wed Nov 19, 2014 6:49 am
by SuperSandro2000
When I load my newly created world the game crashes with that report:

Code: Select all

Error while running the event handler: ...dcore - 0.11\mods\TheFatController_0.0.8.zip|control.lua:16: attempt to index upvalue 'tech' (a nil value)

Re: [MOD 0.11.x] The Fat Controller. Remote train management

Posted: Wed Nov 19, 2014 7:13 am
by JamesOFarrell
SuperSandro2000 wrote:When I load my newly created world the game crashes with that report:

Code: Select all

Error while running the event handler: ...dcore - 0.11\mods\TheFatController_0.0.8.zip|control.lua:16: attempt to index upvalue 'tech' (a nil value)
Should be a new version with a fix though I don't know how that happened as tech is set the line above. If this version doesn't display the button for you after you unlock rail signals please let me know. It should also fix another annoying bug stopping it from working on maps that have been played in multiplayer.

Re: [MOD 0.11.x] The Fat Controller. Remote train management

Posted: Wed Nov 19, 2014 7:48 am
by SuperSandro2000
Thx. I can start my game now.

Re: [MOD 0.11.x] The Fat Controller. Remote train management

Posted: Wed Nov 19, 2014 8:26 am
by JamesOFarrell
SuperSandro2000 wrote:Thx. I can start my game now.
No worries. Glad it fixed the issue.

Re: [MOD 0.11.x] The Fat Controller. Remote train management

Posted: Sat Nov 22, 2014 1:36 am
by ColonelWill
Would it be possible for it to work in a MP game for just one person (the host) so that person could be reasonable for managing the trains ?

Re: [MOD 0.11.x] The Fat Controller. Remote train management

Posted: Sat Nov 22, 2014 4:45 am
by JamesOFarrell
ColonelWill wrote:Would it be possible for it to work in a MP game for just one person (the host) so that person could be reasonable for managing the trains ?
The plan is to have it working in MP as soon as the devs fix this bug. It should work for every player individually with the train list being shared. It will take a small update to get TheFatController there but as soon as the bug is fixed I'll be working on it.

Re: [MOD 0.11.x] The Fat Controller. Remote train management

Posted: Thu Dec 04, 2014 9:31 pm
by Damrus
Seems the bug has been fixed in 11.4!

Re: [MOD 0.11.x] The Fat Controller. Remote train management

Posted: Thu Dec 04, 2014 10:23 pm
by JamesOFarrell
Damrus wrote:Seems the bug has been fixed in 11.4!
I've re-written it to support multiplayer but it still has to many bugs to release. I'll stop playing in a few hours and have a look at fixing the last bugs.

Re: [MOD 0.11.x] The Fat Controller. Remote train management

Posted: Thu Dec 04, 2014 11:16 pm
by Boogieman14
Updated to 0.11.4, single player game, a few seconds after loading an original 0.11.3 game (75 hours in)
Image

Not entirely surprising, the error goes away after changing that to 'destroy' ;)

Re: [MOD 0.11.x] The Fat Controller. Remote train management

Posted: Thu Dec 04, 2014 11:18 pm
by JamesOFarrell
Boogieman14 wrote:Updated to 0.11.4, single player game, a few seconds after loading an original 0.11.3 game (75 hours in)
Image

Not entirely surprising, the error goes away after changing that to 'destroy' ;)
I should probably learn to spell =)

Edit: also there are bugs in the current version when removing trains before removing them from TFC. I've fixed it for the next version