Export and Run a Godot Dedicated Server

Sdílet
Vložit
  • čas přidán 18. 06. 2024
  • This video looks at how to create Godot dedicated servers. We review how to run and connect game clients from a local computer, a local network (LAN), and finally a cloud deployment (AWS EC2). I also explore how to create an AWS EC2 instance and upload the dedicated server export.
    This introductory video covers the basics of what a dedicate server is and what it is used for. Based on the last video's changes, where we converted Brackeys first project into a multiplayer game, we add some additional code to make it work for running a dedicated server export.
    [Looking for the code?]
    ⭐️ github.com/BatteryAcid/first-...
    👉 / batteryaciddev
    [Previous Video]
    • Add Multiplayer to you...
    [Exporting Dedicated Server]
    docs.godotengine.org/en/stabl...
    [ICACLS Changing file permission Windows]
    stackoverflow.com/a/43317244/...
    • How to do the CHMOD 40...
    [Using FileZilla]
    docs.aws.amazon.com/en_us/lig...
    [What is SSH?]
    www.cloudflare.com/learning/a...
    [What is SCP?]
    en.wikipedia.org/wiki/Secure_...
    [Brackeys Godot Tutorial]
    • How to make a Video Ga...
    github.com/Brackeys/first-gam...
    👋 Let's talk shop 👇
    [Discord] / discord
    [Twitter] / batteryaciddev
    [Support the channel] www.getyourgamedone.com/chann...
    -----------------------------------------------------------------
    00:00:00 TOPICS AND SETUP
    00:00:35 EXPORT DEDICATED SERVER
    00:02:38 ENABLE ENET SERVER START
    00:03:27 START DEDICATED SERVER
    00:03:55 CONNECT TO LOCAL SERVER
    00:04:47 PREVENT ADDING DUMMY PLAYER
    00:05:12 👍 FIRST SUCCESSFUL RUN
    00:06:06 WHAT IS A DEDICATED SERVER
    00:06:30 EXPORT OPTIONS - STRIP VISUALS
    00:08:13 😎 CONNECT ON LOCAL NETWORK (LAN)
    00:09:10 HOW DOES CLOUD DEPLOYMENT WORK
    00:10:12 BUILD LINUX EXPORT
    00:10:40 CREATE EC2 INSTANCE (AWS)
    00:12:19 🔥 CONNECT TO LINUX SERVER (EC2)
    00:14:10 UPLOAD LINUX EXPORT TO EC2
    00:15:12 START GODOT LINUX EXPORT ON EC2
    00:16:15 ALLOW CONNECTIONS TO SERVER (SECURITY)
    00:17:27 CONNECT CLIENT TO CLOUD SERVER
    00:18:34 ALLOW MORE PLAYERS TO JOIN
    00:19:06 RUN SERVER IN BACKGROUND (EC2)
    00:20:17 SHUTDOWN GODOT SERVER
    00:21:20 ⚠️ STOP EC2 INSTANCE
    00:21:48 LATENCY ISSUES AND FUTURE IMPROVEMENTS
    Icons made by www.freepik.com/
    #dedicatedserver #aws #ec2 #localnetwork #lan #export #2dgame #respawn #pvp #health #animations #gamedevelopment #2dmultiplayer #godotstartertemplate #godot #godottips #gametech #gamedev #indiedev #multiplayer #network #godotengine #brackeys

Komentáře • 116

  • @rohithvishaal
    @rohithvishaal Před měsícem +19

    please make and post the improvement video too!!! This stuff is gold! please continue making such awesome videos

    • @BatteryAcidDev
      @BatteryAcidDev  Před měsícem +1

      Working through it now! Thanks for tuning in!

  • @newerton2806
    @newerton2806 Před 19 dny +2

    The amount of time i spent figuring out how to do this on my own is a crime... Thank you for this golden gem, I almost gave up working on my dream game because of multiplayer complications if it was not for you...

  • @jnvoigt
    @jnvoigt Před 7 dny +1

    I love where you went with this video, maybe also adding splitscreen and a mixed mode where splitscreen and network are combined would be interesting to see

  • @amirosman8797
    @amirosman8797 Před měsícem +5

    This is amazing, you’ve explained how dedicated server works perfectly, looking forward for more advanced features

  • @piousthepious
    @piousthepious Před měsícem +5

    Dude you’re such a beast. I love the incremental building method you’re doing where you’re slowly teaching methods by building on previous stuff.
    Going to finish video later but wanted to note that 5 minutes in and you’re already impressing me by teaching a very basic idea of how to do a dedicated server

    • @BatteryAcidDev
      @BatteryAcidDev  Před měsícem +1

      I appreciate that! Let me know what else you'd like me to cover!

    • @piousthepious
      @piousthepious Před 29 dny +1

      @@BatteryAcidDev This video was really good!
      I think what could’ve been a nice in-between before jumping to AWS is showing how the server build could’ve been run on your machine and port forwarding could’ve been an option with playing with your friends but comes with the problem of not being a *dedicated* server that runs always unless you want to run your machine 24/7 (hence the AWS option comes to fix that).
      I understand though the scope is more oriented to dedicated servers in particular and honestly this is probably something I can figure out myself with the foundation you gave in this video. But just something I thought about as I went through this video!
      Keep doing what you’re doing cause I love the production quality and educational value of your videos :)

    • @BatteryAcidDev
      @BatteryAcidDev  Před 12 dny +1

      I'll probably circle back to this approach ...

  • @TheRealAfroRick
    @TheRealAfroRick Před 26 dny +1

    You should spend some time chatting about how to do a Graviton build for the dedicated server. That will make this the best video ever!
    Probably would have been good to do this with CDK as opposed to having people logging into a server and ssh'ing to the remote linux server and all that.

    • @BatteryAcidDev
      @BatteryAcidDev  Před 19 dny +1

      I think the Graviton route would be interesting to look at! This is an introductory video and having beginners go through the CDK process would be a bit advanced for this stage, but it’s definitely a powerful tool!

    • @TheRealAfroRick
      @TheRealAfroRick Před 19 dny +1

      @@BatteryAcidDev Don't disagree, but there are so many more steps to get wrong doing it in the console. Especially making sure everything is undeployed or that you aren't creating multiple EC2 instances.
      Would gladly create a video or work with you on one that can do this in a container and all that.

  • @Tcgtrainer
    @Tcgtrainer Před 29 dny +1

    Dude thanks, i been learning Godot and knowing it can be used for multiplayer games is great.

  • @housebased7
    @housebased7 Před 27 dny +1

    This channel is actually a gold mine, you are criminally underrated sir, don’t stop doing what you’re doing it’s awesome

  • @ArtRaven_
    @ArtRaven_ Před měsícem +2

    You are doing such a good job educating new developers. Im not at a level where this is useful yet, but I watch them anyways. Thank you for the effort

  • @tejaswithme3713
    @tejaswithme3713 Před měsícem +1

    This is what I'm trying to find from 3 mi!!! Sir you are amazing ❤

  • @panakap2186
    @panakap2186 Před měsícem +1

    Thank you so much for sharing this knowledge in so much accessible way

  • @I2ed3ye
    @I2ed3ye Před 27 dny +1

    Super excited to see the next video!

    • @BatteryAcidDev
      @BatteryAcidDev  Před 26 dny

      Thank you! I'll probably need a little more time on the lag compensation but hopefully soon!

  • @tilobramer8152
    @tilobramer8152 Před měsícem +1

    Loved this video, definetely feels like an improvement on the last one. I'm just coming back to game dev after a year or two of mostly doing art but I'd be glad to help you out, already joined the discord.

  • @bmxchamp4
    @bmxchamp4 Před 29 dny +1

    This was a great intro to dedicated servers! Never actually got around to implementing one. Really looking forward to the improvements video and all that is to come!

    • @BatteryAcidDev
      @BatteryAcidDev  Před 29 dny

      Thanks! It may be a couple weeks but I’ll get there

  • @yuriynovytskyy7984
    @yuriynovytskyy7984 Před měsícem +1

    Great video! Super unique and useful content! Keep it up!

  • @RetroBright262
    @RetroBright262 Před měsícem +1

    Great stuff!

  • @Patrity
    @Patrity Před měsícem +1

    super interested in seeing what was done to improve latency. I'm not familiar with godot at all, but every time I see one of your videos, it pushes me more and more towards it! It seems really nice to work with in multiplayer situations these days! Keep up the amazing work!

    • @BatteryAcidDev
      @BatteryAcidDev  Před měsícem +1

      I'm struggling through the latency issues as we speak, it is not an easy task! I think there's only so much you can do before you just have to spin up a new server closer to the player! But yea, I'm also excited! Thanks for watching!

  • @thomasparker7305
    @thomasparker7305 Před měsícem

    Great tutorial. Thank you.

    • @BatteryAcidDev
      @BatteryAcidDev  Před měsícem

      You are welcome! Thank you!
      Let me know what else you'd like me to cover!

  • @marcelpriztonsikorski
    @marcelpriztonsikorski Před měsícem +1

    Keep going with these series 👍👍👍

  • @wishymashy
    @wishymashy Před měsícem +2

    thanks!

  • @vyasnavneet
    @vyasnavneet Před měsícem +1

    Thank you!
    This video is awesome 👍🎉.

  • @martijnstok9141
    @martijnstok9141 Před 27 dny +1

    Hello, thank you very much for this explanation. This is going to help me a lot. I'm very curious how you will tackle latency issues. 👍👍
    In addition, I may have some inspiration for future projects:
    - create a lobby (with a list of active servers to join)
    - Working with different levels. (only see players who are in your level)
    - Saving player states (also regristration / login page)

    • @BatteryAcidDev
      @BatteryAcidDev  Před 26 dny

      You're welcome! Yea I'm going to work on the lag issues soon! Thanks for the feedback! I already have a whole series on creating lobbies (not Steam, coming soon!) but the rest of those are in the queue! Thanks for the inspiration! czcams.com/play/PLOtt3_R1rR9WrcyDRsRF3oSrzffmBtJbu.html

  • @rock2much
    @rock2much Před měsícem +2

    These vids are great, would love to see you fix latency issues.

    • @BatteryAcidDev
      @BatteryAcidDev  Před měsícem

      Haha there's no silver bullet for fixing latency, as most gamers will have experienced that even on the biggest titles... However, I hope to look at some strategies to make it a little more tolerable! Thanks for feedback!!

    • @SamuTheFrog
      @SamuTheFrog Před měsícem +1

      Yeah, that's far out of scope for this particular topic. What I think you would be interested in is net coding, which isn't specific to Godot but just general coding philosophy.
      You can't really "fix" latency, but what you can do is program FOR it, if that makes sense. I obviously won't dive too deep in a comment & i'm not super confident in my knowledge with it yet but the idea is that you just code everything around the idea that the internet isn't perfect. Simplify as much as possible, rely more on signals & pure data server side, and anything and everything you can get away with pushing to the client, should probably be handled on the clients end. Etc.
      For example
      Client side: renders anims, graphics, handles input, handles logics, etc.,
      Server side: only takes the outputs of client side's data & updates server side to match it, and sends simply that information to the rest of the players, then making their clients do all the hard logic to update to the new information set. Using prediction methods for the most part with controlled update-sync intervals type thing that just occasionally makes sure everything matches, and if not, quickly interpolates between them or what have you.
      It's more about making sure what happens client side simply matches what happens server side, because you cant fix latency.

  • @Marco-ft1fd
    @Marco-ft1fd Před 23 dny +1

    you are my god now

  • @doomnotron
    @doomnotron Před 20 dny +1

    awesome!

  • @goldenman5895
    @goldenman5895 Před měsícem +1

    Nice video

  • @Prof_Natanael
    @Prof_Natanael Před měsícem +1

    Friend of Brazil? I'm also from Brazil! (if the translation is bad, sorry 😂) For you promised and brought. I'm not a professional programmer, but I started a project with my brothers. An online MMO RPG, with just 5 players at the start. A game focused on traditional tabletop RPG but in 3D and active combat, where each campaign would be unique thanks to a huge probability options. All of this created in Godot if everything goes well. However, I admit to being sad when I couldn't make the multiplayer actually work and you made me hope again! If you want help, with online testing or whatever comes up, it will be a pleasure to collaborate and learn! You've already helped a lot and I'm sure that when my ambitious and giant project progresses I won't forget the initial encouragement to continue with the dream!

    • @Olixis
      @Olixis Před měsícem +1

      opa, o projeto tem discord? gostaria de conhecer

    • @Prof_Natanael
      @Prof_Natanael Před měsícem +1

      @@Olixis Salve cara!
      Ainda estamos em desenvolvimento e decisão de mecânicas, mas assim que concluirmos nosso primeiro grande mapa lançaremos o Alfa 1.0 e te dou acesso para teste e dicas é claro!
      Assim que dominar o multiplayer lançaremos o beta! Esse projeto é gigante, será um prazer ter sua participação logo nas primeiras campanhas teste!

    • @BatteryAcidDev
      @BatteryAcidDev  Před 29 dny

      Yes we had people around the world helping me test, including Brazil! Glad you were able to be inspired by these videos! Please join the discord if you want to participate in my journey! Thank you!

  • @leoncgp
    @leoncgp Před měsícem +1

    Hey! Incredible job on this tutorial. Do you plan to make one on how to set up a server for a game on Steam?

    • @BatteryAcidDev
      @BatteryAcidDev  Před 29 dny +1

      Thank you! Yes, my plan is to release that in a few weeks, stay connected!

  • @lebobshark
    @lebobshark Před 5 dny +1

    Imagine turning Brackeys tutorial into a full MMO. lol.

  • @shawn14isme
    @shawn14isme Před měsícem +1

    I love this!!
    Can we go into things like user accounts and saved user data?

    • @BatteryAcidDev
      @BatteryAcidDev  Před měsícem

      Oh! We so are! I've already covered some of that with Unity so it's time to remake some of those with focus on Godot!

  • @brofessorxx
    @brofessorxx Před 24 dny +1

    Hey quick question, when you exported the dedicated server, you built the server logic into the client app? I always thought you'd build them separate with a shared library between them for assets.

    • @BatteryAcidDev
      @BatteryAcidDev  Před 12 dny

      You CAN do that - each approach (and there are a few) has it's own set of challenges, but for these beginner videos, I'm going to keep everything in one project. I don't want to deviate too far away from the original Brackeys project.

  • @jordan.rushing
    @jordan.rushing Před 29 dny +1

    Super helpful! What about Steam Networking Messages? Do you think this is needed or is out of the box Godot Networking the way to go?

    • @BatteryAcidDev
      @BatteryAcidDev  Před 26 dny

      Glad to hear! Well that's two different approaches. Steam networking is using their networks and is going to be P2P. I'm not 100% if they have a dedicated server host, I'm doubtful, but the approach in the video will be a dedicated server approach, so no P2P. You CAN use Steam to setup your lobbies and then once ready to play you can probably send them the IP to connect to your dedicated server. I'm going to research that some more and see if it's possible. I would be surprised if it wasn't. I'll put out a video on this once I can get to it!

  • @BennysRadio
    @BennysRadio Před měsícem +2

    I would be super interested how to run a godot server in a docker / kubernetes cluster.

    • @BatteryAcidDev
      @BatteryAcidDev  Před 29 dny

      I have this in the queue, thanks for the suggestion!

  • @thomasparker7305
    @thomasparker7305 Před měsícem +1

    Question for you. Do you think in the future that you will be making a video where you can have a server and client in the same program. This is needed if you want to have a server with a gate way and authentication server that they all connect to. game development center made a video set on it but it's for Godot 3 and not Godot 4.

    • @BatteryAcidDev
      @BatteryAcidDev  Před měsícem +1

      All my videos so far have client/server in the same project... There are several ways to setup authentication, just depends on what your requirements are. Can you link to that video here so I can take a look to have a better idea?
      Thanks!

  • @CarlosCTC123
    @CarlosCTC123 Před 25 dny +1

    and about database connection...? usually this is the hardest content to find about engines and frameworks. if you find how to do it, bring to us, please!

    • @BatteryAcidDev
      @BatteryAcidDev  Před 19 dny +1

      Yes that’s the plan! Thanks for the feedback!

  • @yurinativo
    @yurinativo Před 14 dny +1

    Hey BAD, awesome tutorial. Thank you very much.
    I was wondering how could this be more scalable?
    I mean, this way, we have a player limitation defined by the MultiplayerSpawner, and also all players will be playing the same game.
    How would it work to have multiple instances of the game, so a thousand of players could play with their friend different instances?
    I guess we would need the dedicated server to be a matchmaking and electing one of the players to be the server, but then the code of the server would be completed different from the client.
    Would be nice a tutorial showing that.

    • @BatteryAcidDev
      @BatteryAcidDev  Před 12 dny

      Thanks for watching! Yea that's a whole other discussion - scaling for games - which greatly depends on your game's requirements. It's hard to make a generic video on things like that. I do plan to work my way through some scaling techniques, but that's a bit off into the future... Stay Connected!

  • @Olixis
    @Olixis Před měsícem +2

    gold

  • @aminebensalah4139
    @aminebensalah4139 Před měsícem +1

    I would be super interested how to run a godot server in a docker / Agones.

    • @BatteryAcidDev
      @BatteryAcidDev  Před 29 dny

      I have the Docker thing in the queue... so stay connected!

  • @equ3333
    @equ3333 Před měsícem +2

  • @minadaniel814
    @minadaniel814 Před 26 dny +1

    Thank you for this great tutorial.
    What if I need to make a simple 2d online multiplayer game that runs on my website without this host button? I mean all players are connected to a server like AWS instance you created. Would you give me the steps to do this? Also, could I use AWS as you used? I am new to multiplayer game development and I don't know much or how things work.

    • @BatteryAcidDev
      @BatteryAcidDev  Před 26 dny

      Browser based games have their own set of challenges! Sounds like you want to host your game where there's an index.html as an entry point. You could do that in a similar manner as this video but instead, you'd just need to start a local webserver (or nodejs or whatever you're using) to run it on the instance. The host button in this example is not relevant, it's just there from the last video. Players would then just go to the DNS of your server running the game. There are several ways to tackle this but that's the gist of it!

  • @olivehillstudios
    @olivehillstudios Před 27 dny +2

    *EDIT: I was not using the correct command, Battery Acid Dev helped sort me out though. Gonna leave my comment up in case anyone else makes the same mistake I did*
    One nasty little hang up that I ran in to that I want to share with fellow Windows users. Sometimes when you try to login with SSH even after you have changed permissions on your keypair file it will still deny you. Turns out that it can also be really picky about which user name you are logging in with. So my final command I used to login to the linux server ended up being:
    ssh -l ec2-user -i
    So basically what the -l flag does if I understand correctly is it changes your login name, and by default I think that the cloud is looking for ec2-user.
    Hope this helps someone!

    • @BatteryAcidDev
      @BatteryAcidDev  Před 26 dny

      Thanks for the tip! I'm suprised my command with appending ec2-user@ didn't work the same way. I thought it would essentially be the same command... but Windows is funny like that 🤷‍♂️

    • @olivehillstudios
      @olivehillstudios Před 25 dny +1

      @@BatteryAcidDev you know what, now that I am looking back at it I did not notice you appending ec2-user in your command that was my bad, just an oversight on my part. Now that I tried it with the correct command as demonstrated by you in the video it works perfectly. 👍

    • @BatteryAcidDev
      @BatteryAcidDev  Před 25 dny

      @@olivehillstudios Oh nice! Well, now you know 2 ways of doing it!! Thank you for the follow up!

  • @teo2805
    @teo2805 Před měsícem +1

    😖💚 Fastest sub button of my life

  • @fedyfausto
    @fedyfausto Před měsícem +1

    Waiting for the management of entities after join of a player, if a first player collect money the second one will see It right?

    • @BatteryAcidDev
      @BatteryAcidDev  Před měsícem

      If collecting money is event based, like with an RPC, then they may not see it if they join after the event has passed. However, if you are synchronizing a variable for money that you update, when a new player joins, they should get the latest amount.

  • @HCMSainacr
    @HCMSainacr Před měsícem +1

    lets say your server reached maximum capacity and you made the server expand dynamically in the future if you add chatting system how do you link between the two server chats to make it global? or do you make a standalone chat server and players write [msg,id,player_name] to it and then the server rewrite it in the other servers box chat?
    sry if my english is bad 😔

    • @BatteryAcidDev
      @BatteryAcidDev  Před měsícem +1

      I would make your chat system separate, independent of your game servers. It may be a more complicated setup to manage addition components of your architecture, but I would do that for a production game. You could leverage their user_id or whatever you use to identify them. Your example data structure sounds like a good start!
      Yes, that's how I would do it. A Websocket is a really nice way to make a chat server, I have several videos on that:
      czcams.com/video/9_HFMulPNls/video.html
      czcams.com/video/P-1oD2R3HYE/video.html

  • @DutchJDoe
    @DutchJDoe Před 13 dny +1

    Thx for this enlightening tutorial, I really appreciate it !!. Can you show us how to get your local ip adres of your server via code, please ?.😃

    • @BatteryAcidDev
      @BatteryAcidDev  Před 12 dny

      Yea mean like this: docs.godotengine.org/en/stable/classes/class_ip.html
      Also check this out: forum.godotengine.org/t/how-to-get-local-ip-address/10399

    • @DutchJDoe
      @DutchJDoe Před 11 dny

      ​@@BatteryAcidDev Thx just what I needed, and please go on with info about networking in game development, especially Godot because Iwill not return to Unity. I develop for handicaped people and they will be thrilled when I let them play in a network. A big THX from me and my clients (human 🤗) !!!!...

  • @ChristianHaugland74
    @ChristianHaugland74 Před 29 dny +1

    Now, show how to make a dedicated server on rasberry pi 😊

    • @BatteryAcidDev
      @BatteryAcidDev  Před 29 dny

      Hmmm does the distro support the Godot Linux builds? Or Docker? Should be easy if either of those do!!

    • @ChristianHaugland74
      @ChristianHaugland74 Před 28 dny +1

      I think you can Get docker on it.

  • @toladim
    @toladim Před 21 dnem +1

    Can you make some easy MMO for more than 6000 people this way? 🤔

    • @BatteryAcidDev
      @BatteryAcidDev  Před 19 dny

      With this alone, probably not, but it’s heading in the right direction!

  • @leandrevincent2476
    @leandrevincent2476 Před 28 dny +1

    My game is so laggy when I play it

    • @BatteryAcidDev
      @BatteryAcidDev  Před 26 dny

      That can happen if you are far away from the server. Also, this current setup hasn't been optimized for lag compensation. I plan on covering that soon, so stay connected!

  • @paulbecket7399
    @paulbecket7399 Před 19 dny +1

    so many people using brackeys stuff

    • @BatteryAcidDev
      @BatteryAcidDev  Před 19 dny

      Yes that video has been viewed almost a million times, I think it’s smart to build on top of that success and bring more attention to the power of Godot!!

  • @SamuTheFrog
    @SamuTheFrog Před měsícem +1

    Is it really that easy? Wtf