Export and Run a Godot Dedicated Server
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
please make and post the improvement video too!!! This stuff is gold! please continue making such awesome videos
Working through it now! Thanks for tuning in!
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...
Glad it helped! 👍
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
Thanks, I appreciate the feedback!
This is amazing, you’ve explained how dedicated server works perfectly, looking forward for more advanced features
Thank you! That's the goal!
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
I appreciate that! Let me know what else you'd like me to cover!
@@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 :)
I'll probably circle back to this approach ...
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.
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!
@@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.
Dude thanks, i been learning Godot and knowing it can be used for multiplayer games is great.
Yea and it's only going to get better!
This channel is actually a gold mine, you are criminally underrated sir, don’t stop doing what you’re doing it’s awesome
haha thank you!
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
I appreciate that! Thank you for watching!
This is what I'm trying to find from 3 mi!!! Sir you are amazing ❤
Glad I could help!!
Thank you so much for sharing this knowledge in so much accessible way
You are very welcome!
Super excited to see the next video!
Thank you! I'll probably need a little more time on the lag compensation but hopefully soon!
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.
Awesome, thank you!
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!
Thanks! It may be a couple weeks but I’ll get there
Great video! Super unique and useful content! Keep it up!
Thank you! Will do!
Great stuff!
Glad you enjoyed it
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!
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!
Great tutorial. Thank you.
You are welcome! Thank you!
Let me know what else you'd like me to cover!
Keep going with these series 👍👍👍
Thanks, will do!
Let me know if there's anything specific you'd like me to look at!
thanks!
Thank you!
This video is awesome 👍🎉.
Waiting for the next video super excited 🔥
Thanks!
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)
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
These vids are great, would love to see you fix latency issues.
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!!
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.
you are my god now
🧖♂️
awesome!
Thank you! Cheers!
Nice video
Thanks
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!
opa, o projeto tem discord? gostaria de conhecer
@@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!
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!
Hey! Incredible job on this tutorial. Do you plan to make one on how to set up a server for a game on Steam?
Thank you! Yes, my plan is to release that in a few weeks, stay connected!
Imagine turning Brackeys tutorial into a full MMO. lol.
Define MMO…
I love this!!
Can we go into things like user accounts and saved user data?
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!
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.
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.
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?
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!
I would be super interested how to run a godot server in a docker / kubernetes cluster.
I have this in the queue, thanks for the suggestion!
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.
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!
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!
Yes that’s the plan! Thanks for the feedback!
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.
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!
gold
💚
I would be super interested how to run a godot server in a docker / Agones.
I have the Docker thing in the queue... so stay connected!
Prost!
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.
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!
*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!
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 🤷♂️
@@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. 👍
@@olivehillstudios Oh nice! Well, now you know 2 ways of doing it!! Thank you for the follow up!
😖💚 Fastest sub button of my life
Haha! Much appreciated!
Waiting for the management of entities after join of a player, if a first player collect money the second one will see It right?
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.
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 😔
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
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 ?.😃
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
@@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 🤗) !!!!...
Now, show how to make a dedicated server on rasberry pi 😊
Hmmm does the distro support the Godot Linux builds? Or Docker? Should be easy if either of those do!!
I think you can Get docker on it.
Can you make some easy MMO for more than 6000 people this way? 🤔
With this alone, probably not, but it’s heading in the right direction!
My game is so laggy when I play it
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!
so many people using brackeys stuff
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!!
Is it really that easy? Wtf
Yup!