5 Beginner Multiplayer Mistakes
21:18
Godot + Steam P2P Multiplayer
1:02:29
Пікірлер
@HueStudios-i5e
@HueStudios-i5e 17 сағат бұрын
I know you are a lovely guy and I already bothered you with questions under your other video, but could you please tell me if there's another way of handling input than what you mentioned at around 23:00? I strongly dislike the fact that server has to process player's input, doesn't it create a delay equal to the ping of the players? I.e. if I have 50ms ping and I press spacebar it takes 50ms for my player to jump? I really wish Godot multiplayer would just allow us to have authority over player scenes, it would make things so much easier.
@killuad0
@killuad0 Күн бұрын
did you arealdy see OpenGB? similar to nakama
@Iron99789
@Iron99789 Күн бұрын
@Jerburger
@Jerburger Күн бұрын
Client-Server will not fully prevent cheating, it still takes a lot of resources. Hosting servers takes a lot of resources as well. In my (admittedly limited) experience, if you have a small team, competitive multiplayer isn't possible, especially if its your first time with multiplayer period.
@HueStudios-i5e
@HueStudios-i5e 2 күн бұрын
Solid implementation. I wonder if you maybe got an idea on how to find a solution to a problem I got. I pulled your solution and it's working fine as is, but I have an issue in my project where client's player nodes position is always 0, 0, 0 on spawn, no matter what I do via script. I was hoping that after adapting your solution to my project it would disappear cause you do the spawns slightly differently, but no - it still is on zeroes on spawn, it's like it doesn't care about logic in add_player() My theory is that multiplayer sync node is overriding the position. I'm pretty sure at some point I noticed that breakpoint on _ready() for player prefab is hit twice, once for host and once for the client, and I'm pretty sure that I saw that from host's perspective the prefab had the correct position, but from client's it was just 0, 0, 0 as if add_player() didn't happen and so probably MultiplayerSync is just overriding the new position with zeroes. I really have no idea what I may be missing out :(
@BatteryAcidDev
@BatteryAcidDev 2 күн бұрын
I've ran into this before, but can't remember off the top of my head. Does your server have authority over the player object? If so, set the player's position before you add it to the game and it should synchronize to the clients. It's hard to say...
@HueStudios-i5e
@HueStudios-i5e Күн бұрын
@@BatteryAcidDev yeah that's probably some authority issue, I'll keep digging, thank you for your response. Also, could you please tell me what is MultiplayerSpawner actually for? It feels so redundant to add nodes to that thing and also have to instatiate them via script, but if you don't do that everything breaks. Is there anything more to it other than "if you spawn a scene in runtime it probably should be in spawner too"?
@brandb16
@brandb16 3 күн бұрын
Please get rid of the glare in your glasses. Thank you!
@BatteryAcidDev
@BatteryAcidDev 3 күн бұрын
Noted
@J0nssi
@J0nssi 3 күн бұрын
Are you going to add Steam networks for this project too? Or should I try to implement it myself to the game instead of the local port used?
@BatteryAcidDev
@BatteryAcidDev 2 күн бұрын
I do not have plans to add steam to this project. My plan for this wasn't P2P. You COULD update to work that way using steam, but for that just follow my steam tutorials.
@J0nssi
@J0nssi Күн бұрын
@@BatteryAcidDev thanks! I found a good solution for steam and lobby system, going to make prophunt game of that
@jdubz8173
@jdubz8173 4 күн бұрын
Is it better practice to have a project with both server and client code side-by-side? or would it be better to have separate projects?
@BatteryAcidDev
@BatteryAcidDev 2 күн бұрын
That really depends on what you're trying to accomplish and whether or not you have some sensitive logic that you need to hide. I would say if you're just starting out, just keep everything in one project. It will be much easier. Once you have a better understanding, then you can make a more informed decision about it. You can keep all the code in one project and just exclude the files/folders you don't want to export for the respective client/server build. Or you can separate them out into separate projects, but there are some headaches involved with that too. It really depends on what you're comfortable with and if it's even necessary.
@CiscoStu
@CiscoStu 6 күн бұрын
loving this explanation!, I will really love if you can take a look at Nakama and more specifically, their Godot 4 client sdk, it looks very promising and I'm struggling to put it together, so with your help I'm pretty sure it will be an amazing tool to use
@CiscoStu
@CiscoStu 7 күн бұрын
great tutorial! question: how scalable would this be when connecting over 100 players at the same time? should this scenario be approached a different way? would love to hear your thoughts
@BatteryAcidDev
@BatteryAcidDev 2 күн бұрын
That's a hard question to answer. I guess you could refactor this to work with more players, not sure at what point it would start to fail. You'd have to experiment with some lag compensation strategies like Netfox, and host some test servers to see if that would work.
@SuperBobs22
@SuperBobs22 8 күн бұрын
dude i spent months fighting the godot websockets, didn't even need to watch the whole video and all of my code just works now thank you so much man
@BatteryAcidDev
@BatteryAcidDev 2 күн бұрын
Glad I could help
@rasmus9311
@rasmus9311 8 күн бұрын
As someone who's just starting out, this has been a bit all over the place with different videos jumping back and forth, and fixing issues in the code, and I think this Full player client authority is the best bet for most starting out. Would be great in the future to get a redo video of this concept but from start to finish with the new knowledge so it's easy to follow the thought process. Great videos either way, very helpful in getting me started in the right direction!
@BatteryAcidDev
@BatteryAcidDev 8 күн бұрын
Thanks for the feedback! Do you think a guide, like a roadmap of videos would be helpful? I could put one together on my website or something? The fix video is just correcting a bug, concepts remain.
@rasmus9311
@rasmus9311 8 күн бұрын
@@BatteryAcidDev Hmm I think that could be useful , or a playlist to know which order videos are. But I think what confused me the most with the adding multiplayer to this brackeys game videos/series were the battle between single player and multiplayer, I think it would have been more clear to start clean with building the multiplayer from the start. As it's confusing enough as it is with multiplayer, so it wasn't a very clear path from start to finish. (speaking from someone with little experiece, so it's harder for me to follow along and understand the logic)
@Syvies
@Syvies 8 күн бұрын
Can't wait for the next episodes and the Netfox implementation, I'm following this series like a code along even if I'm doing some things my own way.
@BatteryAcidDev
@BatteryAcidDev 2 күн бұрын
I just started adding Netfox to the project in today's stream. It's not finished yet, still have some issues to work out, but I made progress!
@TotallyAccurateCodingSimulator
@TotallyAccurateCodingSimulator 8 күн бұрын
I would like to know if it is always preferable to host in clouds using third party services. Like, for a small scale (play with friends or small community) game. Also, are there any major considerations to have for security in the event of hosting on a owned dedicated server?
@BatteryAcidDev
@BatteryAcidDev 2 күн бұрын
There are different security concerns for P2P versus dedicated server (I'm assuming that's what you meant). You can use whatever service you are comfortable with. Some are more easier to use than others, but may cost more.
@TotallyAccurateCodingSimulator
@TotallyAccurateCodingSimulator 8 күн бұрын
Everything multiplayer related that you cover is helpful, please keep on making that aspect of game dev more accessible and comprehensible.
@BatteryAcidDev
@BatteryAcidDev 2 күн бұрын
I will do my best!
@TotallyAccurateCodingSimulator
@TotallyAccurateCodingSimulator 9 күн бұрын
That's very useful. Thanks a lot!
@BatteryAcidDev
@BatteryAcidDev 2 күн бұрын
Glad to hear that!
@cyborganic
@cyborganic 11 күн бұрын
This was so useful and helpful, thank you for making these tutorials!
@BatteryAcidDev
@BatteryAcidDev 10 күн бұрын
You're very welcome!
@porkman1838
@porkman1838 11 күн бұрын
super underrated tutorial thanks a lot
@BatteryAcidDev
@BatteryAcidDev 10 күн бұрын
Glad it helped!
@Gr33n
@Gr33n 14 күн бұрын
Nice tutorial as well, but i got stuck in the part where u did the jump thing, said add do_jump and _is_on_floor , explained the do jump i did everything correctly, but then got issue with the is on floor, error, that the variable is declearead but never used in class... but i didnt see in the video that part for the is floor , but mine didnt work after that.... maybe i did something wrong still...
@Gr33n
@Gr33n 14 күн бұрын
found the code, to control if i did any mistakes, everything was correct just code alignment issue that is kinda wierd in godot kinda....
@BatteryAcidDev
@BatteryAcidDev 14 күн бұрын
Yea sometimes that happens, glad you got it. I've changed how I do my jump stuff over time, there's even a different branch on the Github where I change how I do it, so check that out too. There's several ways to handle jump, this was just a very basic method.
@killuad0
@killuad0 14 күн бұрын
i plan to make a multiplayer game and i have a question: if someone data mined the code would they find out secrets that only the server executes? for example i wanted to add a secret boss trigger, is it possible to make clients unable to see this trigger in the server code or separate it from client code?
@BatteryAcidDev
@BatteryAcidDev 10 күн бұрын
I talked about this in my last stream, checkout the clip here: www.twitch.tv/videos/2235427038 I'll probably do a video on this eventually!
@MattEatsMochi
@MattEatsMochi 15 күн бұрын
"Yea, but then I have to implement that thing that he's doing and I'm not sure I wanna do it that way." - so freaking relatable
@BatteryAcidDev
@BatteryAcidDev 14 күн бұрын
Absolutely !!
@bmxchamp4
@bmxchamp4 15 күн бұрын
Edit: Solved the issue, I was a dumb dumb and forgot to set the InputSynchronizer as a child of the PlayerInput node. For anyone that may come across this issue in the future, be sure to set the synchronizer as a child node of the node you're trying to sync values for. Still figuring out Godot's little quirks. Can you provide a link to the repo? Doesn't matter too much if it's not done yet, you can just add a disclaimer that it's WIP but having access to the repo during this series is good for checking for code inconsistencies. I'm having a hell of a time trying to figure out what i did wrong. After changing the authority to just give player input client authority, suddenly i can't move on the clients and the server is controlling their WASD movement. Clients can still rotate with the camera fine, but for some reason they have lost the ability to move with WASD. I've checked that PlayerInput has multiplayer authority in Remote mode for clients and have watched the values in PlayerInput only sometimes change during play for clients. If I spam the controls sometimes the client's input direction will update for a single frame and then go back to 0. No clue where I messed up but clearly i am missing something
@will7466
@will7466 15 күн бұрын
Been waiting to reach the point in my game to jam to this. It may not be in real time but it's irl for me
@BatteryAcidDev
@BatteryAcidDev 14 күн бұрын
Awesome you'll get there!!
@will7466
@will7466 13 күн бұрын
@@BatteryAcidDev yup just watching it a few times over to work out the order of op. I have a SignalManager(Singleton that contains all the code) and a NetworkManager(node that manages the game) and signals like peer_connected are hard to establish which one of the two they fall under and at what point in the process are they triggered
@will7466
@will7466 11 күн бұрын
@@BatteryAcidDev I really don't appreciate getting trashed on your discord after following your videos, by people who have clearly not watched your videos
@BatteryAcidDev
@BatteryAcidDev 11 күн бұрын
@@will7466 I'm not sure what this is referring to but everyone is welcome in my Discord and I try to make sure things stay cordial. Please let me know if there's something I can do!
@will7466
@will7466 10 күн бұрын
@@BatteryAcidDev after all them people talking to me sideways I don't feel that way but don't worry about it I'm gone.
@castleclashbot5452
@castleclashbot5452 15 күн бұрын
@BatteryAcidDev
@BatteryAcidDev 14 күн бұрын
❤️
@MikeFic
@MikeFic 16 күн бұрын
id be curious how character data and items like inventories and player login and signups could work. been googling around for this a bit and there is some stuff out there but nothing very cohesive.
@BatteryAcidDev
@BatteryAcidDev 14 күн бұрын
I'm planning on covering this over the next few months, stay connected! Thanks for watching!
@johannesneyer4421
@johannesneyer4421 16 күн бұрын
Wow, this is a really great video. Thanks alot. The way you explain all the details is awesome. Please keep going with this style and pace! It helps me a lot.
@BatteryAcidDev
@BatteryAcidDev 14 күн бұрын
Much appreciated, glad it helped! I will do my best!
@ntngamedev
@ntngamedev 16 күн бұрын
Netfox have support for C#?
@BatteryAcidDev
@BatteryAcidDev 14 күн бұрын
I don't think so, but you can double check the docs or ask in their Discord! - github.com/foxssake/netfox - discord.gg/MnzaZDCn
@castleclashbot5452
@castleclashbot5452 16 күн бұрын
i got it... was hard to understand this tutorial, please dont hide more so many things, i like to see the complete project... zoom in zoom out swap here and there... holy no, i like to see where we are and what for nodes is in the scenes, sry my english is trash... but who cares
@BatteryAcidDev
@BatteryAcidDev 16 күн бұрын
Glad you got it! Yea this was one of my first tutorials, check the later ones for better walkthroughs!!
@castleclashbot5452
@castleclashbot5452 16 күн бұрын
@@BatteryAcidDev ah nice, i struggle hard here, i dont know how... but i got some good things, i can spawn and hit and kill in multiplayer mode all enemies, but if anyone join later, he will see "enemy ghosts" maybe you know how to fix that?
@BatteryAcidDev
@BatteryAcidDev 14 күн бұрын
@@castleclashbot5452 I think you have to despawn by running a queue_free so they don't show up. Let me know if that doesn't work and I can check on it again! Glad you made some good progress!
@eyeland1024
@eyeland1024 16 күн бұрын
thx for all the content for multiplayer for godot. Finally can get my game multiplayer now :). Good luck with the streams and videos !
@BatteryAcidDev
@BatteryAcidDev 14 күн бұрын
Hey thanks! I appreciate the support! Good luck too!
@danielthompson8993
@danielthompson8993 16 күн бұрын
You're the man BAD! The BAD man!
@AlexR_OR
@AlexR_OR 17 күн бұрын
Little by little it took me 2 weeks to get to the end of this video. Finally moving to the part 2 now.
@BatteryAcidDev
@BatteryAcidDev 14 күн бұрын
Happy to hear! Keep going!
@charlesjordan3677
@charlesjordan3677 18 күн бұрын
hello i have a question because even after reading the documentation and asking questions to chatgpt my understanding is still unclear : “if get_multiplayer_authority() == multiplayer.get_unique_id():” is used to check the peer's authority and compare it with the current peer's network id. This makes it possible, for example, to perform behaviors only on or from the peer that initiated an action (an input for example). what's the difference with @rpc(“call_local”)? because in this case, we're also making sure that the annotated method is called only on the client (or server) that initiated the RPC call. It seems very similar to me, but I guess it's not he same at all, and that's where I can't tell the difference between these two concepts.
@BatteryAcidDev
@BatteryAcidDev 14 күн бұрын
Can you describe the use case in more detail? Or drop by the discord to hash it out. RPCs, by default will call to all OTHER clients except the one making the call. If you add call_local, it will ALSO call to the one making the call. I think it would help to hear a use case so I can provide a more clear answer.
@BatteryAcidDev
@BatteryAcidDev 2 күн бұрын
kzbin.info/www/bejne/j37HindjaM-AfKM
@GreenCrowDev
@GreenCrowDev 19 күн бұрын
Hello! What's a better system for racing games, instead?
@BatteryAcidDev
@BatteryAcidDev 14 күн бұрын
Client side prediction and server reconciliation should work fine for a racing game. Netfox should work out of the box, but there may be some improvements to it that you'll notice once you get into it. I'll try to post some more links to this later! Also drop by the discord for more info!
@johannesneyer4421
@johannesneyer4421 19 күн бұрын
Thank you again for your video. This series is really great and I'm really looking forward to the next steps. Please keep doing this dope stuff. You help us a lot!
@BatteryAcidDev
@BatteryAcidDev 14 күн бұрын
Thanks for watching! Will do!
@BigEraser42
@BigEraser42 19 күн бұрын
Hey so I tried this out and it mostly works. The only problem is when testing with 3 or more players. Whenever we try to test, the multiplayer synchronizer for the 2nd player will not work for the 3rd player. Basically players will not be able to see the movements of other players who joined before them. Do you know how to fix this?
@BatteryAcidDev
@BatteryAcidDev 14 күн бұрын
This is likely an authority problem, where you're not correctly synchronizing the positions. Drop by the discord and we can chat more about it!
@johannesneyer4421
@johannesneyer4421 20 күн бұрын
This is again a really really great tutorial! Wow, thank you so much. I'm really interested in creating an p2p multiplayer game over internet. Is it possible that one player hosts the game on the pc and provides the ip and port over an matchmaker like you showed in your video with AWS? Or do I need a dedicated server anyways which will run all the game instances? Maybe one day you could make a video for creating a player hosted game which can be joined over internet with a matchmaker.
@yosapps
@yosapps 20 күн бұрын
Thank for the amazing video!! I have a question, when I join to host, the camera is jittering when moving. Camera is enabled of position smoothing with 5px/s. Is there any solution?
@BatteryAcidDev
@BatteryAcidDev 14 күн бұрын
Thank you!! Are you synchronizing the camera? where is that smoothing happening? Shouldn't be jittering... In certain setups, if you have the camera under the player object, that could also cause problems, but depends...
@licha11
@licha11 20 күн бұрын
this is the best godot multiplayer tutorial i've seen
@BatteryAcidDev
@BatteryAcidDev 14 күн бұрын
Happy to hear that! Thanks for watching!
@gthpgth
@gthpgth 20 күн бұрын
It's such a wonderful course. I hope to see your paid content on sites like udemy as well as Patreon. Because English is not my main language, I need a machine translation function.
@BatteryAcidDev
@BatteryAcidDev 14 күн бұрын
I'll have to look into that and see if my free Patreon can support the translation functions. Let me know if you have any more information on it!
@dans-designs
@dans-designs 21 күн бұрын
hey i really like your tutorials, wondering if you can help with a starship bridge game i'm working on, trying to figure out how to have multiple players (different pcs each) affect different aspects of the same Player instanced spaceship... i.e Helm controls steering and speed, tactical weapons etc.. I have the separate scenes already made up for each player-console but not sure how to tie them into the same ship... thank you
@BatteryAcidDev
@BatteryAcidDev 14 күн бұрын
I plan on doing a video on this sometime in the future, off the top of my head I think you can leverage Spawner and visibility with the scenes to provide the separate scenes. I also talked about this on my latest twitch stream, so stay connected!
@antivirusjrelax9155
@antivirusjrelax9155 21 күн бұрын
I have a question, could somebody help? 😅 Have you ever tried W4 Games? How do you think, worth it to use or there're better options for multiplayer game? I'm honestly already confused with multiplayer theme)) I wanna publish my game on steam, maybe it has better options?
@BatteryAcidDev
@BatteryAcidDev 10 күн бұрын
I talked about that in my latest stream, you can checkout the clip here: www.twitch.tv/videos/2235424412
@MykMallett
@MykMallett 22 күн бұрын
Very informative mate, how did you find the image holding up over the long term? Main thing I’m curious about is the image becoming misshapen over time.
@BatteryAcidDev
@BatteryAcidDev 22 күн бұрын
It’s as new as the first day! I don’t have it in any sunlight, so that’s helped keep the colors crisp, and it hasn’t sagged either!
@erickindratara3307
@erickindratara3307 23 күн бұрын
hi @BatteryAcidDev, hope you read this comment. your game is wonderful. I wonder if you make this just for fun, or if you are actually making money from it? if yes. then, how? did you sell it somewhere?
@BatteryAcidDev
@BatteryAcidDev 22 күн бұрын
Hello! This is just a tutorial, there's no "game" to it. I do not have this listed anywhere and make negative money each month! You could try to list your games on itch.io/steam/etc and ask for donations or just sell the game. I do plan on listing a game soon, I'm working towards that now, but it will take some time! Good luck!
@sodden_steam
@sodden_steam 23 күн бұрын
Hello. Please tell me how to organize the working windows in Godot so that they are like yours: an "Inspector" next to the "Scene". Thank you. A video on this topic would also be nice.
@BatteryAcidDev
@BatteryAcidDev 22 күн бұрын
So there are little stacked 3-"dots" around the Godot editor that when you click on, it will show which panel you want that menu to exist in, so just select the area. Once you have it set the way you want, use Editor -> Editor Layout -> Save Layout so you can quickly setup any project.
@jogogg4956
@jogogg4956 24 күн бұрын
Hello, does this method really work for players with different IP addresses? Regarding lag, does the game run well or is it very slow when other networks are connected? hug!
@BatteryAcidDev
@BatteryAcidDev 22 күн бұрын
This matchmaker is hosted in the cloud, which means it can point your clients to any DNS/IP in the world - basically wherever you decide to host your game server. This is a matchmaker video, the lag your clients will experience is based on whether or not you have lag compensation in your game and proximity of server to peer. Hope that helps!
@Haunchfluff
@Haunchfluff 24 күн бұрын
@BatteryAcidDev If I was to want to have the server spawn something in the game when a player clicks, what might that RPC function look like?
@Haunchfluff
@Haunchfluff 24 күн бұрын
Also, follow up question... When the server disconnects how do you manually disconnect all clients?
@BatteryAcidDev
@BatteryAcidDev 22 күн бұрын
You make an RPC call from your client, to the server like "do_a_thing.rpc_id(1)" # 1 is the server, then on the server, you can spawn using the multiplayer spawner which I've talked about extensively on my channel, just spawn the thing instead of a player, or use a custom spawner: www.reddit.com/r/godot/comments/1ctlrx5/how_to_custom_spawn_with_multiplayerspawner/
@BatteryAcidDev
@BatteryAcidDev 22 күн бұрын
If a server disconnects, the clients will be disconnected automatically... not sure if that's what you mean here.
@Haunchfluff
@Haunchfluff 22 күн бұрын
@@BatteryAcidDev I solved this :) Here is the function to handle the server disconnecting. func _server_disconnected(): print("Server was closed, disconnecting client... ") multiplayer.multiplayer_peer = null get_tree().call_deferred(&"change_scene_to_file", (MAIN_MENU)) You move them to the main menu or some sort of disconnect screen. And I modified the ready of multiplayermanager to handle client and server disconnect using a simple if else: if NetworkManager.is_hosting_game: multiplayer.peer_connected.connect(_client_connected) multiplayer.peer_disconnected.connect(_client_disconnected) if not OS.has_feature("dedicated_server"): _add_player_to_game(1) else: multiplayer.server_disconnected.connect(_server_disconnected)
@SILVERjavier
@SILVERjavier 24 күн бұрын
This helps alot to hear what you are thinking instead of just going by something you have prefab and just copy(what i mean is the format of not having a script is good) Thank you for being real and keep your mistakes 🙏🏼 keep up the amazing work 👏
@BatteryAcidDev
@BatteryAcidDev 24 күн бұрын
Haha yea, well, I do some "copy/paste"-ing as I don't want to re-type some stuff that I already figured out, but at least you can see the full process. I'll make the template available once I complete the first milestone in the series!
@helmialauddin
@helmialauddin 24 күн бұрын
I hope you can integrate it with Nakama. I want to know how to make NPCs move.
@BatteryAcidDev
@BatteryAcidDev 24 күн бұрын
This video details how to make NPCs move, you can do it several ways, like changing position. Yea maybe someday I'll circle around to them, they seem to have a decent amount of options.
@helmialauddin
@helmialauddin 24 күн бұрын
@@BatteryAcidDev I saw the documentation on Nakama. For server-side, I need to use Lua code, and I'm not very familiar with it. I hope there will be a video explaining server-side development using Lua in Nakama.
@BatteryAcidDev
@BatteryAcidDev 14 күн бұрын
@@helmialauddin Checkout this video series: kzbin.info/www/bejne/nYaZmHx_gr6geq8si=9PI19a65eTg98GDr
@ollie-d
@ollie-d 24 күн бұрын
Very useful, especially since the 4.x docs aren't up to date for WebSockets
@BatteryAcidDev
@BatteryAcidDev 24 күн бұрын
Glad it was helpful!
@deeamerson
@deeamerson 26 күн бұрын
This is an amazing series. Thank you so much for these tutorials.
@BatteryAcidDev
@BatteryAcidDev 24 күн бұрын
Glad to hear it! Thanks for tuning in!