Godot 4 Dedicated Servers with Multiplayer Nodes and RPC

Поделиться
HTML-код
  • Опубликовано: 4 янв 2025

Комментарии • 48

  • @jonafin_gd
    @jonafin_gd Год назад +8

    You, my friend, have saved my life. I learned Godot 3's multiplayer, and a lot changed in Godot 4. You taught me everything I needed to know in a 5 minute video. THANK YOU!

  • @caiocesar3647
    @caiocesar3647 8 месяцев назад +4

    I was having trouble trying to make rpc calls, but I was just missing having the same calls in both client and server, tysm!

  • @mauigamestudio
    @mauigamestudio Год назад +5

    This video is so dense with information, I feel like I watched it 100 times and am still noticing stuff I missed

    • @ditzyninja
      @ditzyninja  Год назад +5

      Hopefully that's a good thing lol

  • @fenyx5430
    @fenyx5430 2 года назад +2

    I just love you man, this was perfectly timed. just when I needed it.

  • @Darkest-Kn1ght
    @Darkest-Kn1ght 2 года назад +1

    DitzyNinja, thank you so much for your videos concerning multiplayer in Godot 4.0. I've been super busy over at work since 4.0 alphas have begun being released back in Jan or Feb., and haven't been able to properly research all the differences between 3.x and 4.0 so I haven't been able to update my project accordingly. I don't know if you've ever come across Game Development Center with Stefan, but he did a 20 part series on dedicated multiplayer back in 2020 using Godot 3.x that I was able to follow along with and reference to build my own framework specifically for what I wanted to accomplish. This video, along with some of your others, has been helping me begin to bridge the gaps between the two versions. Still have a long LONG way to go, but will eventually get there. Thank you again for sharing your knowledge with us to help steer us the right way using this new 4.0 version of Godot!!

    • @ditzyninja
      @ditzyninja  2 года назад

      Hey sorry for the late reply man. I watched a few of Stefan's videos from that series. It's awesome. I can't even imagine how much work that took. And you're very welcome. I'm really glad my videos have been so much help!

  • @themaydayman
    @themaydayman Месяц назад

    Amazing tutorials, absolute godsend, but I have a couple questions:
    What’s the advantage of having a separate project for the server, wouldn’t that make adding new networking features an extra hassle? Why not just add - server to the launch flags?
    Do the multiplayer nodes handle client prediction on their own?

  • @pand2aren
    @pand2aren 8 месяцев назад

    thanks for this video, helped a lot, so if i understand correctly networkNodes/synchronizers are more for prototyping part i guess ?

  • @archiebaldry
    @archiebaldry 2 года назад +1

    Awesome video! Thanks a bunch :)

  • @lukesmith5680
    @lukesmith5680 2 года назад +3

    Why do you put position and y_rotation variables on the multiplayersynchronizer? You can just get them to sync direct from the player script and it still works..

    • @ditzyninja
      @ditzyninja  2 года назад +2

      There was a bug that prevented the properties set on the clients from syncing to the server.

  • @CrushingJosch
    @CrushingJosch 2 года назад +1

    Thanks for the video - that's a valuable contribution :)
    Just so that I understand it correctly.. What you set up here, is a dedicated server, but not an authorative server, right? So the players still send the commands to set their locations on all connected peers, rather that the server would have authority over that, right?
    Therefore you also need these empty rpc-placeholder-functions in the server project..?

  • @woutrottiers910
    @woutrottiers910 Год назад +3

    So what is the difference between the 2 projects? Like what are the advantages of the rpc project vs the multiplayer nodes project?

    • @ditzyninja
      @ditzyninja  Год назад +1

      Multiplayer nodes do a lot of the work for you, but you don't have as much control. So if all you need is spawn/despawn and property synchronization, use the nodes. If your project requires more complex networking, use the RPC functions or use even lower classes.

  • @andrewthompson14
    @andrewthompson14 2 года назад +2

    Thanks for posting this! I'm new to Godot, and I decided to use Godot 4 in part because of the new networking nodes, but it's hard to find resources on Godot 4 networking. Your tutorials are very helpful.
    Did you ever figure out why you couldn't sync the position, rotation, etc. variables directly from the Player/CharacterBody3D? I think that was a problem in the last video.
    Also, do you have any plan about showing how to make this server authoritative (ie in charge of actually moving the player positions based off of their input)? If so, that would be super super helpful!
    Thanks again!

    • @ditzyninja
      @ditzyninja  2 года назад +2

      No problem! I'm glad they've been helpful!
      I wasn't able to figure it out. I tested it out with the beta and it still wasn't working as I would expect. I did submit it on Github and it was marked as a bug though, so it seems like our lord and saviors (The Godot team) are looking into it :)
      I wasn't planning on making a video on that, but it is a good idea! Maybe sync properties for each is_action_pressed input and use rpc for is_action_just_pressed inputs?

    • @michasengotta2295
      @michasengotta2295 2 года назад

      In order to make this server authoritative, you could sync just the input actions e.g. by making RPCs from the clients to the server and let the server actually move the characters and then sync those positions etc. to the clients.

  • @lifelife3061
    @lifelife3061 Год назад

    when i use the tutorial networking demonstration demo i do not see any characters when i press play on the editor . just chatbox and green floor. i cant move or anything

  • @indieology7336
    @indieology7336 2 года назад +1

    Thank you so much!

  • @23oddo
    @23oddo 2 года назад

    Thanks for your content, big help as there is no documentation around. Do you also have a video how to implement to cheat safe network code? so basically clients can only offer input, but the server decides all movement.

    • @ditzyninja
      @ditzyninja  2 года назад

      I don't yet. Someone else suggested to this as well though, so I might get around to it at some point.
      And you're welcome! I'm glad it's helpful!

  • @CodingKaiju
    @CodingKaiju 2 года назад +2

    When would you want to use RPC vs the multiplayer nodes?

    • @ditzyninja
      @ditzyninja  2 года назад +4

      MultiplayerSpawner for scenes that are added and removed from the scene_tree at run time.
      MultiplayerSynchronizer for properties with values change often and should be synced at regular intervals.
      RPCs for everything else.

  • @olmrgreen1904
    @olmrgreen1904 2 года назад

    Awesome video!

  • @rodrigoum
    @rodrigoum 2 года назад

    Is it possible install server project inside AWS EC2 for example?

  • @AboElmdameed
    @AboElmdameed 11 месяцев назад

    is this gonna be public or local?

  • @Gandalf_Le_Dev
    @Gandalf_Le_Dev 2 года назад

    I have a problem with you multiplayer nodes project, the player is not added on the client side do you know why ?

    • @ditzyninja
      @ditzyninja  2 года назад

      Hmm. Did you download the project I have in the description?

    • @Gandalf_Le_Dev
      @Gandalf_Le_Dev 2 года назад

      @@ditzyninja yes I cloned both repo from GitHub :/
      The add character method on the client is never called when I press join, you placed it in the host button but we are not using this button anymore with a dedicated server (did I get something wrong ?)

    • @Gandalf_Le_Dev
      @Gandalf_Le_Dev 2 года назад

      it was my fault the player path in my server multiplayer spawner was not the same as the client one ... sorry

  • @michaelbrannaka4046
    @michaelbrannaka4046 2 года назад

    That is cool. Thank you for sharing this multiplayer online tutorial. Is there any way you could create a cyber security anti-aimbot cheat online tutorial video very soon?

    • @ditzyninja
      @ditzyninja  2 года назад

      You're very welcome. Unfortunately I'm not very well versed in anti-cheat/security stuff

  • @Jazztache
    @Jazztache Год назад

    Is there a way to do both P2P networking and Dedicated Server using the same project and code?

    • @ditzyninja
      @ditzyninja  Год назад +1

      Like an option to create a server without adding the host as a player?

  • @hooman1439
    @hooman1439 Год назад

    Is it possible to implement the server in Typescript but keeping the same code in the client? Also is it recommended to do it?

  • @r.mapplethorpe7469
    @r.mapplethorpe7469 Год назад

    thanks

  • @MrPelikala
    @MrPelikala 10 месяцев назад

    Does this work if i add this to html game

    • @tebogokolobe9535
      @tebogokolobe9535 8 месяцев назад

      I just tried and it doesn't. Maybe with websocket

  • @will7466
    @will7466 Год назад

    Is anyone else struggling with this?

    • @lifelife3061
      @lifelife3061 Год назад

      yes like how did he get that client name like that. Am i downloading the right sht?

  • @dee_ooo1413
    @dee_ooo1413 Год назад

    hey I am in the 2 min mark and i get these errors when the second client connects.
    E 0:00:08:0643 get_node: Node not found: "Main/320213936" (relative to "/root").
    Method/function failed. Returning: nullptr
    scene/main/node.cpp:1620 @ get_node()
    E 0:00:08:0643 process_simplify_path: Condition "node == nullptr" is true.
    modules/multiplayer/scene_cache_interface.cpp:77 @ process_simplify_path()
    E 0:00:08:0645 get_node: Node not found: "Main/320213936" (relative to "/root").
    Method/function failed. Returning: nullptr
    scene/main/node.cpp:1620 @ get_node()
    E 0:00:08:0645 _process_get_node: Failed to get path from RPC: Main/320213936.
    modules/multiplayer/scene_rpc_interface.cpp:165 @ _process_get_node()
    E 0:00:08:0645 process_rpc: Invalid packet received. Requested node was not found.
    Condition "node == nullptr" is true.
    modules/multiplayer/scene_rpc_interface.cpp:228 @ process_rpc()
    I am pretty sure I did everything according to the tutorial. Can you help me with these?

    • @melon9089
      @melon9089 Год назад

      you are referencing to a node that doesnt exist, check if your node path is correct( the one with the $ or in get_node )