Page 1 of 1

add server-side player

Posted: Sat Nov 21, 2020 12:15 pm
by Thiske
There is currently no way to add extra players using mods.
I would like a way of adding extra players to the game witch are server-side, this means that they don't have a link to a real player and IP but for the rest they just behave like normal ones.
This would be extremely helpful for creating a multiplayer tas, so It can be ran without having to connect multiple real clients to the server.

Re: add server-side player

Posted: Sat Nov 21, 2020 4:48 pm
by ptx0
Thiske wrote:
Sat Nov 21, 2020 12:15 pm
There is currently no way to add extra players using mods.
I would like a way of adding extra players to the game witch are server-side, this means that they don't have a link to a real player and IP but for the rest they just behave like normal ones.
This would be extremely helpful for creating a multiplayer tas, so It can be ran without having to connect multiple real clients to the server.
i know it's not what you're asking for but in the meanwhile you can disable authentication on the server and run multiple local clients to connect, and after that you can close them because the players are already created in the game save for you.

Re: add server-side player

Posted: Sat Nov 21, 2020 5:09 pm
by Rseding91
Any reason you wouldn't just use create-entity and create a character entity to control directly through script?

Re: add server-side player

Posted: Sat Nov 21, 2020 5:30 pm
by Thiske
Rseding91 wrote:
Sat Nov 21, 2020 5:09 pm
Any reason you wouldn't just use create-entity and create a character entity to control directly through script?
That would work but then I have to recreate the spawning algorithm of players in multiplayer.
How does that work?

Re: add server-side player

Posted: Sat Nov 21, 2020 5:44 pm
by Rseding91
Thiske wrote:
Sat Nov 21, 2020 5:30 pm
Rseding91 wrote:
Sat Nov 21, 2020 5:09 pm
Any reason you wouldn't just use create-entity and create a character entity to control directly through script?
That would work but then I have to recreate the spawning algorithm of players in multiplayer.
How does that work?
They spawn at the player forces spawn position https://lua-api.factorio.com/latest/Lua ... n_position

Re: add server-side player

Posted: Sun Nov 22, 2020 5:49 pm
by Thiske
I have tested it but created the entity on top of my character and not next to it like in multiplayer.
Also this would mean I have to recreate Luacontrol completely.
Where is this class stored in memory so I can copy most of the code?

Re: add server-side player

Posted: Sun Nov 22, 2020 5:55 pm
by Rseding91
Thiske wrote:
Sun Nov 22, 2020 5:49 pm
I have tested it but created the entity on top of my character and not next to it like in multiplayer.
Also this would mean I have to recreate Luacontrol completely.
Where is this class stored in memory so I can copy most of the code?
Uhhh; that's not something you can do. Also you don't need to since LuaEntity (which a character is) also uses LuaControl.

Also also; find-non-colliding-position (on LuaSurface) will get you a position that isn't on top of an existing player.