Soooooo, I was working back again on my multiplayer extension and couldn’t figure out what is the best option: Should the server tell every client to send data whenever he needs it and redistribute it however he wants (Full controll of the server, can cause lag, see mario maker 2 online multiplayer for example), or if I should give the client more control (he decides when he sends the data and the server has to deal with it), but that would make the server more sensible for DDoS and potentially do unwanted stuff. This would make omly the player who laggs lagging and not the whole connected playerbase. Example would be minecraft.
As the community will use the extension in the end, I let all of you decide how you would like to have your online game.
Another option would be to add an option to decide between the two but would make the server installation process and general compatibility less easier for everyone, developer (me) and users (you).
Well, this is a surprise. I am glad I did that poll, I thought everyone would want the client one. Are you sure tho? The lag difference between SMM2 and MC is not negligable, and with the server-is-the-master architecture, one could create special clients that laggs a lot to make the game unplayable for everyone.
In general it is better if the server control everything. It is safer and should be getting better performance if the server decide when to listen, process and update data.
The avoid lag on the client side however in case a player send data too late or something, the server should update the state for each player and interpolate the position and rotation, sort of guessing where the players are and which way they are rotating based on the last received information. Including for me.
So I press W to move forward, I send to the server that I am moving forward and this is my current location an this is my current speed and the server should make the calculations where am I going to be in the next frame and send my own location back to me and everyone else and I and everyone else use that info to update my location, this way, there is no way I can cheat because I can not send false info to the server and the server should keep everyone in sync.
This is exactly as complicated as it sounds like, I would never in my life consider to make real-time multiplayer. It is not so easy as some people might think.
There should be no way you can cheat with that. It’s just the updates: should the server decide when the player needs to update (like for example sending a “feed me data” packet every 100 ms) and then the client responds to that or the client sends whenever he wants a packet whenever he wants. Basically the one who makes the “timer” for the packets. Actually the more I think about it the more I think there is no point in letting the server do that, because even if the server says whenever he wants the packets to be sent the client decides in the end soooo…
What I meant if the server do all the calculations, there is no way you can cheat because the server tells you about your state based on what you did and not the other way around and also if the server control when to receive, process and update data the server can keep everyone in sync by interpolating, “guessing” the state of those who has slower connection and missed the window when the server was listening. Yes people with dead slow connection if missing multiple windows, it is going to lag but only those people, it should not effect the other players so I think it is the best way to go about it.
If you allow players to send their state to the server any time they want and the server process and update people on each individual request, how are you going to keep everyone in sync? You can’t, you can only hope everyone have a decent internet connection and a good PC running the game the same speed, but as soon some join the game with slower connection and running the game slower, it is going to turn in to a mess.
But it is your plugin and your decision, I honestly don’t mind. I won’t be making real-time multiplayer in my life that is 100% and for turn-based multiplayer either is good.
It is also seems people agree with you because at the moment more people want client. Good luck
The problem is I cannot process everything from the server, except if I convert the server to an extension, as the game logic remains in each persons game and I cannot predict it. What I could do but I won’t in the first place at least is to make the server an extension or a modified gdevelop exporter that executes the logic or to modify the complete gdevelop architecture to a client server architecture (like many engines do) but it would be massive work and would only be doable by 4ian as he is the owner and he has to make such important decisions and to decide how to implement it, if he even wants to. For now I will only have a server that keeps user data and sends users the public data of the others and let other users send their data basically. It’s everything but secure, but to keep the server as open as possible, it’s the only way for now. I will come back to this when the extension is stable enough tho. Or else I might never be able to release it lol.