This Godot 4 Scene Manager Does it ALL

  Рет қаралды 30,377

Bacon and Games

Bacon and Games

Күн бұрын

Пікірлер: 107
@baconandgames
@baconandgames 11 ай бұрын
If you're looking for more Godot 4 tutorials, check out my Let's Make Snake series which takes you from opening Godot through making a complete game. kzbin.info/aero/PLiJ2loFXqTO1_raZB5MhIYLtqdvT5CdSP
@martinrovere7937
@martinrovere7937 8 ай бұрын
I love that you don't make me copy your code but explain your code and reasonings behind. It forced me to think how to aproach this. Something like "wait, i should be taking notes"
@baconandgames
@baconandgames 8 ай бұрын
That’s really helpful (and kind) feedback. Thank you!
@gdomjan83
@gdomjan83 10 ай бұрын
Thank you for creating more intermediate tutorials. A lot of Godot youtubers are teaching beginners, content like this is sorely needed.
@baconandgames
@baconandgames 10 ай бұрын
Aw, thank you so much. That’s very nice of you to say 🥹
@Peter-wl5xm
@Peter-wl5xm 8 ай бұрын
Thanks for walking through the code and giving us your logic behind it. I'm really excited to see more of your work.
@baconandgames
@baconandgames 8 ай бұрын
Thanks Peter! Is there anything in particular you’re looking to learn?
@Peter-wl5xm
@Peter-wl5xm 8 ай бұрын
@@baconandgames Hi Sean, appreciate the reply! I'm currently working on an android and steam release single player game. A video on cross-platform general thoughts and implementation tips would be awesome. Just a greedy desire but if it doesn't follow the content totally understood! Your videos are amazing just to reiterate. Will thoroughly watch all of them 😃.
@baconandgames
@baconandgames 8 ай бұрын
Thanks Peter! Mobile development and I have a long and storied history 🤣 I’m not sure I can go back down that road… been burned by Google too many times. But I’ll keep that in mind 🤔
@babyjay1386
@babyjay1386 7 ай бұрын
Hello, great tutorial! Very well organized and easy to understand. This helped me immensely in my journey to learn game development. If anyone is stuck and failing to load the scene, I added the following line to the ready function of the scene manager in order to connect the signal to the appropriate function. content_finished_loading.connect(on_content_finished_loading) This is necessary in order to actually call the function that loads the level! I also had to create the update_bar function in my loading_screen script. func update_bar(progress): progress_bar.value = progress The modulo expression was not working so I changed the progress_bar path in order to not receive a null instance error. @onready var progress_bar: ProgressBar = $Control/ProgressBar These things may have been in the code, but seem to have not been referenced in the video (perhaps I just missed them). Thanks!
@baconandgames
@baconandgames 7 ай бұрын
Hey baby Jay, thanks for the comments. Just a heads up, there’s a newer version of this up on my GitHub as part of my Game Template, if you want to check that out. I’ll be maintaining the scene manager and other things there moving forward.
@nickbdawg6777
@nickbdawg6777 9 ай бұрын
Thanks so much for this tutorial! I threw together an incredibly janky scene manager during my last game jam and decided I needed to find a more robust solution and this is perfect for me!
@baconandgames
@baconandgames 9 ай бұрын
Awesome! Love the pup photo in your profile, by the way. ❤️🐶
@DavidReidChannel
@DavidReidChannel 7 ай бұрын
Really useful video. Also really like this solution to scene management. Thanks for sharing.
@baconandgames
@baconandgames 7 ай бұрын
You’re welcome David. Be sure to check out my most recent video. It’s on my godot game template and it includes an updated version of the SceneManager and a bunch of other stuff too!
@the_disco_option
@the_disco_option Ай бұрын
I'm loving the detailed explanations and reasoning behind your code.
@baconandgames
@baconandgames Ай бұрын
Awwww thank you. I appreciate that
@DanielMcNeely
@DanielMcNeely 11 ай бұрын
Thanks for making these great resources for developers.
@baconandgames
@baconandgames 11 ай бұрын
Aw, Dan. 🥹
@officialraylong
@officialraylong 4 ай бұрын
This is awesome! As a general software engineering improvement, we can replace magic strings like "fade_to_black" with an enumeration to avoid bugs from typos.
@baconandgames
@baconandgames 4 ай бұрын
In future versions I intend to replace those with enums. Thanks for watching! ❤️🙏
@petterialanen2467
@petterialanen2467 10 ай бұрын
Great content! I'm building a similar type of approach to my game and this helped to wrap my head around the between scenes transitions.
@baconandgames
@baconandgames 10 ай бұрын
That’s wonderful! Keep us posted on your project!
@federicomaciasvidal7857
@federicomaciasvidal7857 2 ай бұрын
This is absolutely beautiful, thanks a lot man!!
@baconandgames
@baconandgames 2 ай бұрын
You bet! I’m carrying this forward through my game template (there’s a video on that and its available for free on GitHub too) 🙂
@andreamassa2176
@andreamassa2176 11 ай бұрын
Thank you for the tutorial is very interesting and useful, i try to implement a similar thing in my game :)
@baconandgames
@baconandgames 11 ай бұрын
Good luck! Let me know if you get stuck. Thanks for watching. ❤️
@holdim387
@holdim387 10 ай бұрын
Good day, any particular reason you went with this scene route (that is a scene that contains a player and GUI) and not having one main scene, under which player, GUI, and the level scenes are separate. And loading offloading only level scene, while keeping GUI and player (just changing players position, animating) loaded?
@baconandgames
@baconandgames 10 ай бұрын
It's actually really funny you mention that. The game I pulled this from does it the way you describe and it had been my intention all along to make this tutorial work that way. The thing I'm learning as I get into making tutorials is that the more you put in, even as simple as it may be, the harder it gets to clearly talk about certain things OR the longer the video gets. My original cut of this video was over 50 minutes long and over the course of editing, some stuff just has to go, in favor of length, simplicity or both. I was actually debating doing a short follow up showing how to do exactly what you're describing... so maybe I will 🤔 Great question!
@holdim387
@holdim387 10 ай бұрын
@@baconandgames I see, I think if you will continue on this, it would be a cool idea to explain pros and cons of both ways for the new developers.
@baconandgames
@baconandgames 10 ай бұрын
I really like that idea. I'll add it to the list. You first comment has been one of my favorite so far - I worried about cutting that and you got right to the core of wondering whether I should keep it or not. I think, in the interest of keeping the tutorial more simple and digestible, it was the right call to cut it but I'm glad you called it out because I think showing the next evolution WOULD be a good idea that I wasn't necessarily considering. Again, great question and a great idea!
@luckyknot
@luckyknot 10 ай бұрын
Very thorough and well explained tut, really helpful thanks a lot!!
@baconandgames
@baconandgames 10 ай бұрын
That’s very kind. Thank you so much!
@soirema
@soirema 6 ай бұрын
wow amazing!!! i need to check it out!!
@miaoumixed4268
@miaoumixed4268 11 ай бұрын
Thank you for your videos (coming from another engine, and want to make a quick transition 😄)
@baconandgames
@baconandgames 11 ай бұрын
You’re quite welcome and thanks for watching! Bonus points for dropping by with a pun. 🌟
@RafaMartinelli
@RafaMartinelli 11 ай бұрын
I can already tell this tutorial is so valuable and I’m only a couple of minutes in. Thank you for sharing it!
@baconandgames
@baconandgames 11 ай бұрын
I’m glad I could help. Thanks for checking it out🙏
@RafaMartinelli
@RafaMartinelli 11 ай бұрын
@@baconandgames it will be useful for what I’m working on, especially cause it looks like your code is really polished. Thank you!
@baconandgames
@baconandgames 11 ай бұрын
@RafaMartinelli That’s great! I will be uploading the source code to my itch page tomorrow free to download. I wanted to do that the same day the video came out but it has been a busy month.
@RafaMartinelli
@RafaMartinelli 11 ай бұрын
@@baconandgames that’s really appreciated - sometimes people might get feel entitled and forget there’s a human being with a life behind the video. 😅 Plus, one learns a lot more by following along than by just copy-pasting. I’ve discovered through experience with my channel that prioritizing oneself is the best bet long-time! Don’t hesitate reaching out if you need some help!
@baconandgames
@baconandgames 11 ай бұрын
I appreciate that. I will probably take you up on that. I’ve only been at this a few weeks, so I’m learning all this in real time. It’s super helpful to have someone to bounce questions and ideas off for perspective. 🤜🤛 I appreciate the self-care advice. Easy to lose sight of that part but you’re right that it’s critical.
@glovebox098
@glovebox098 2 ай бұрын
23:35 Hi i'm new to all of this so apologies for the stupid question, I've been trying to adapt this to have a camera follow the player instead of having room transtions I would like for it to be a continuous transition. I thought of having the player scene on the gameplay scene and the camera as a child node of the player instead of having the player scene on each level scene. how could I get this to work?
@baconandgames
@baconandgames 2 ай бұрын
First of all, there are no stupid questions here :) Secondarily, you can absolutely make the camera a child of your player. Just make sure that when you add the camera that it's the active camera. To add the player via code you'll need to look at instantiating scenes. The gist is that you'll need to preload the scene you want to add via code (instantiate) and then use that preloaded scene (a PackedScene) to call instantiate() on it and then add it to your scene tree. You will likely find that having the camera as a child of your player solves some problems and creates others, but it's a good place to start. If you dead end on that approach, you'll learn why and know where to look for another approach. If you don't dead end, then you have your solution :) Good luck!
@spacerobotTR
@spacerobotTR 2 ай бұрын
Say I need doors of different sizes for different sized openings. I see I can scale the door scenes but it does not seem to abide by my 16 x 16 grid. I just want to grab handles on the side and make longer or shorter. Is there a way to do this? I'm new to Godot.
@baconandgames
@baconandgames 2 ай бұрын
You can scale the parent or scale the sprite itself (or bring the sprites in at a different size). The thing you're going to want to be mindful of is the distance you need to push the player into the room when they enter through a door. I forget the variable name, but as the doors bet bigger, that too will have to get bigger as well (so they don't spawn on top of the door but instead next to it).
@exantier
@exantier 8 ай бұрын
Dude, this plugin is sick. It helps me a lot with my game. Otherwise, I probably would have had a lot of headaches trying to manage all the doors in my RPG game on my own. Thank you for sahring it! :D However, I have a question: In my game, the camera follows the player on a large map. When he walks through a door, the camera is removed, causing the scene origin (0, 0) to be seen during the screen fade instead of the camera's last position. Would you by any chance know how to fix this? thnks :3
@baconandgames
@baconandgames 8 ай бұрын
There’s a couple of ways you can fix this. One, which I omitted from this tutorial would be to keep the camera live a node above your level and instead of destroying the camera and level, just destroy the level. This would mean loading your level into a holder node, instead of the root. I had originally written this SceneManager this way, but it was one extra step to explain so I removed it to make the video simpler. The other thing you can do is to pass desired coordinates for the new camera into the new level (data passing is covered here) so that when you initialize the new camera it’s at the place you want it to be. Both would work, it’s just a matter of preference. I’m glad you found this video helpful!
@exantier
@exantier 8 ай бұрын
​@@baconandgames Sounds good! I tried the first solution. In levels when I only got one door, works excelent. But when I got more of two cameras showing each door (because I have more of one door in some levels level in different places) just it shows the first one on the herarchy instead of the right one. And about the second solution, I think I know what you mean and I think it will be the right solution. But... I don't know how to do it. Can you give me a simple example, please? :3 And very thanks for the fast reply! I'm new at this. You're helping me a lot, dude! qwp
@baconandgames
@baconandgames 8 ай бұрын
I’ve had a few people ask me out this setup. I’m going to make a video on it this week. Granted, it probably won’t solve your problem out of the box because you will still likely need to define where you want the camera to start, but that part is easy. Keep an eye out (subscribe and hit the bell and all 🤣). Coming soon!
@exantier
@exantier 8 ай бұрын
​@@baconandgames I really appreciate it, man. I'm already a sub, so I'll be waiting for it haha! Thank you for being so attentive to your community :'3 👍
@baconandgames
@baconandgames 8 ай бұрын
@exantier it’s my pleasure!
@nelsonguedespaulojunior977
@nelsonguedespaulojunior977 9 ай бұрын
Hi. This was an fantastic tutorial, please continue to create such good ones with amazing techniques and details! I noticed that on SceneManager, on the monitor_load_status() callback, even if it's still loading and progressing, you don't rearm the timer, so I guess that after the first time the timer timeout's, you will update progress, and progress will get stuck to that much until end of time. Could not setup a test yet to check this. Is this correct, or I'm wrong?
@baconandgames
@baconandgames 9 ай бұрын
monitor_load_status() is called every 0.1 seconds (each time the timer completes). Since the timer is not a one-shot, meaning it restarts itself each time it finishes, it effectively checks the load status 10x per second (framerate aside). So you only need to start the timer once you begin loading a piece of content. After the content finishes loading, the timer is freed and the next time you load something a new timer is created and the process repeats. Does that answer your question? Please forgive me if I misunderstood your question. I THINK perhaps you're thinking of a timer more like one in the real world (like a kitchen timer) that you'd set for 5 minutes and after the time runs out, it buzzes and then is done. Timers in Godot repeat until you stop them (unless set to one-shot) in which case they're more like "loops" than "timers".
@nelsonguedespaulojunior977
@nelsonguedespaulojunior977 9 ай бұрын
@@baconandgames Hi, thanks for the answer. Actually, I was looking the loading screen scene and there's a Timer object there and it was configured to one shot. Latter I realized that the one you use on the code is created there and is not the same object. But thanks anyway for the answer.
@nelsonguedespaulojunior977
@nelsonguedespaulojunior977 9 ай бұрын
@@baconandgamesI got another problem here, in my case, the Level is bigger than the viewport size and can have multiple rooms that are distant from one and another. When you set the player position you see the map on the default camera position on it (which usually is not on the door) and then it blinks to the player position. I tried a few thinks but still couldn't fix this problem. On my Level, I have the Camera2D object and my player has the RemoteTransform2D. I changed the Level code to actually instantiate the player after it loads and then set the RemoteCamera2D. This works fine. The problem is that we see this blink in the screen showing the position that Camera2D is when you build the map. Any thoughts on that?
@nelsonguedespaulojunior977
@nelsonguedespaulojunior977 9 ай бұрын
By the way, this happens using the fade_to_black transition.
@baconandgames
@baconandgames 9 ай бұрын
There are a lot of ways you could address that. Without looking at your code, two things come to mind. You could try hiding the player in the _init() function and then showing it after you position it. You could also use a placeholder object like a Marker2D/3D and instantiate your player at runtime instead. These are just two of many solutions you could investigate. Good luck!
@dotspak
@dotspak 10 ай бұрын
Hey I'm having problems loading the actual scene file. On the line var loader = ResourceLoader.load_threaded_request(path), it can't find the path I'm giving it no matter what the file is (I tested with files other than scenes just to be sure). I'm not sure what's wrong, any ideas?
@baconandgames
@baconandgames 10 ай бұрын
Under Project (in the menu) try "Reload Current Project" - if you've moved scenes around, sometimes paths or other metadata can get a little gummed up. Are you entering the path in manually or are you using the drag method from the video? If you want to send me some screenshots of your project on Discord @baconandgames I will have a closer look. My guess is there's another error elsewhere but it could be a whole bunch of things. We'll get you straightened out 😉
@dotspak
@dotspak 10 ай бұрын
I'm quite experience with the reload project button lol😅I'm using this for a slightly simpler use case than in the video, just transitioning from a title screen to the main game since the main game is currently contained in one main scene (for prototyping simplicity). In my case I'm just doing a call in the title screen code load_new_scene(path), where path is the string I get when I click copy path in the FileSystem. Doesn't change anything when I make an export and put the path there instead
@baconandgames
@baconandgames 10 ай бұрын
Hm. Well if you want to hit me up on Discord with your code, I'll be happy to take a look. It's probably something goofy.
@dotspak
@dotspak 10 ай бұрын
@baconandgames just added you sorry for the late reply
@baconandgames
@baconandgames 10 ай бұрын
@dotspak all good 🤜🤛
@watchandlearnLboard
@watchandlearnLboard 4 ай бұрын
This is really cool! I've watched through this video and the follow up update, and I'm still not exactly sure how to integrate this into my game 😅 copying the whole folder ignores it because of the .godot and copying only the folders returns a ton of errors. I imagine I could comb through the videos and copy it all myself but I feel like surely there's an intended way to use it? Sorry if this is a silly question and great work!!!
@baconandgames
@baconandgames 4 ай бұрын
I have a game template available on GitHub which includes this. That might be a better option for you, since it’s more than just the SceneManager. It’s not a sample game, per se, but it might be easier to understand in that context. Give this a look and let me know if that helps… I might just make a small game live so people can see the process I use when starting from the template. kzbin.info/www/bejne/qn_Ud3-jl7yKY7ssi=SoqJhLnUpkH4-iKM
@watchandlearnLboard
@watchandlearnLboard 4 ай бұрын
@@baconandgames thanks, will definitely check it out. love the content and tools you're making.
@baconandgames
@baconandgames 4 ай бұрын
@watchandlearnLboard thanks so much 🙏
@musicdudejoe263
@musicdudejoe263 Ай бұрын
Why do some devs create timers in code and others just make one in the editor? Is there a difference or reason why you'd choose one over the other?
@baconandgames
@baconandgames Ай бұрын
That's an excellent question. Functionally, they're identical. So for a lot of people, it's a matter of preference. I prefer to do them via code because the node just clutters up the tree and it feels cleaner to me to have all the logic in text (next to all the other logic) rather than hidden in the inspector. Aside from that, sometimes you don't always know how many timers you will need. In those cases, creating them on the fly via code is the only solution. If you only ever need one, it really just comes down to which method you prefer :)
@musicdudejoe263
@musicdudejoe263 Ай бұрын
@@baconandgames Yeah that makes sense. I was also wondering about your line `get_tree().root` and was wondering if it's any different to using `owner`, or if those are also the same.
@cr0c0dile-Gena
@cr0c0dile-Gena 10 ай бұрын
First of all - great tutorial, thanks a lot! 🙏💚 There is only one issue: I added one spin animation to the loading screen and it's stutters during "heavy" background loading (a few large png pics for testing purposes). I tried to move "monitor_load_status" logic to the "_process", turn off V-sync, make spin animation in code - nothing helps. Any suggestions? 🤔
@baconandgames
@baconandgames 10 ай бұрын
Make sure that the call to report_midpoint() (in your AnimationPlayer) is after you TO animation completes. If that call happens too early, Godot will be trying to load the new scene while also playing your animation. If it's in the right place (after for IN transition has finished playing), whatever stutter you're seeing is just coming from the animation itself rather than the SceneManager loading anything heavy. Have a look at that and get back to me. If that doesn't help, we can look at some other things. I would also test the animation you're using itself in a different project (no loading) - you might just need to simplify the animation - more complex transitions than simple fades and wipes can be more efficiently achieved using shaders rather than animations (but we don't need to go there. yet 😀) Thanks for watching and for reaching out. We'll get you squared away 💪
@cr0c0dile-Gena
@cr0c0dile-Gena 10 ай бұрын
@@baconandgames Thanks for the quick response! 🙏 The "report_midpoint" call is in the right place and the spin animation is very simple (just one Sprite2D rotating in a loop). I ran some tests: loaded the "heavy" scene and loaded the "base" scene with a delay before calling "finish_transition" (to test the rotation animation) - in the "light" version the rotation animation works smoothly. I also found a thread on the Godot forum with a similar problem, and the thread's author has an idea that the problem comes to the surface when a new scene is instantiated and added to the root tree. 🤷‍♂
@baconandgames
@baconandgames 10 ай бұрын
If you have a moment, send me a link to that thread. I'd be curious to read it. YT might flag the post if you put a link here, but my email is on the about page. Or you can hit me up on Discord @baconandgames (with the same avatar as my channel). Does the delay you added solve your problem or does that just rule something out? Let me know how else I can help 🤜🤛
@cr0c0dile-Gena
@cr0c0dile-Gena 10 ай бұрын
@@baconandgames I'll get in touch with you in Discord (same avatar as well 😁) shortly 💚
@yubenzuo
@yubenzuo 5 ай бұрын
Really useful video. Thank you so much for the tutorial. But I have a little question. When I run the demo in Godot4.3,the game will be get freezed in the zelda mode. Godot4.3 will report a error,“gameplay.gd:35 @ _on_level_added(): Parameter "p_child" is null.” Is there any way to fix it? Sorry for my poor English,thank you again😀☺
@baconandgames
@baconandgames 5 ай бұрын
Oh no! Thanks for letting me know. I haven’t tried it in 4.3 yet. But I’ll have a look when I get a free minute and see what might have changed that’s breaking something. And your English is just fine 😀
@dailyshadow
@dailyshadow 4 ай бұрын
@@baconandgames Did you ever figure this out I'm currently trying to get this to work also
@yubenzuo
@yubenzuo 4 ай бұрын
@@baconandgames Everything is ok in Godot 4.3 beta3!I think the error was caused by the Godot Engine Itself! Thank you so much for the tutorial again!😀
@baconandgames
@baconandgames 4 ай бұрын
@yubenzuo you bet, thanks for following. I’ve been juggling a bunch of things lately so I apologize if I seemed slow to act here.
@Peter-wl5xm
@Peter-wl5xm 8 ай бұрын
crow is confirmed dead
@baconandgames
@baconandgames 8 ай бұрын
He’s… on a long vacation
@Fragnatix
@Fragnatix 9 ай бұрын
Complaint: Your camera is hidding lots of stuff
@baconandgames
@baconandgames 9 ай бұрын
Response: What do you mean? Are you talking about the headshot covering up part of the file explorer in the bottom left? I don’t think it gets in the way very much, the meat is all up in the code editor. But I’ll be more careful in the future to move it. Thanks for the feedback. 🙏
@DannyArchive
@DannyArchive 11 ай бұрын
SOUCRE CODE (coming soon)
@baconandgames
@baconandgames 11 ай бұрын
I’ll bump you here when I have a moment to upload it. I’m on the road but hope to have it up in a few days.
@baconandgames
@baconandgames 11 ай бұрын
Source code link has been added to the description. Thanks for your patience... it was a BUSY month.
@DannyArchive
@DannyArchive 11 ай бұрын
@@baconandgames thank you good sir!
@swampshack1018
@swampshack1018 8 ай бұрын
25:37
@baconandgames
@baconandgames 8 ай бұрын
Hi 👋 Is there something at that timestamp I should be aware of?
@RequstingFlyby
@RequstingFlyby 3 ай бұрын
Crow.is_confirmed_dead = true
@baconandgames
@baconandgames 3 ай бұрын
🤣🤣🤣🤣🤣🤣
This Godot SceneManager Does even MORE now!
35:07
Bacon and Games
Рет қаралды 7 М.
Godot Debugging Techniques EVERY Dev Should Know
16:23
Bacon and Games
Рет қаралды 30 М.
Turn Off the Vacum And Sit Back and Laugh 🤣
00:34
SKITSFUL
Рет қаралды 6 МЛН
The Ultimate Sausage Prank! Watch Their Reactions 😂🌭 #Unexpected
00:17
La La Life Shorts
Рет қаралды 8 МЛН
Как Я Брата ОБМАНУЛ (смешное видео, прикол, юмор, поржать)
00:59
Натурал Альбертович
Рет қаралды 4,9 МЛН
Yay😃 Let's make a Cute Handbag for me 👜 #diycrafts #shorts
00:33
LearnToon - Learn & Play
Рет қаралды 117 МЛН
Godot Scripts I add to Every Game
12:34
Aarimous
Рет қаралды 46 М.
Everything to Know About PARTICLES in Godot 4
17:29
DevWorm
Рет қаралды 39 М.
How to Add Interaction in Godot 4
16:48
Nagi
Рет қаралды 22 М.
Optimizing my Game so it Runs on a Potato
19:02
Blargis
Рет қаралды 658 М.
My Experience Moving to Godot from Unity
16:54
DarkDax
Рет қаралды 35 М.
Godot Rendering Update - Clay John - GodotCon 2024
46:03
Godot Engine
Рет қаралды 14 М.
Do THIS Before You Publish Your Godot Game
3:33
StayAtHomeDev
Рет қаралды 186 М.
How Games Make VFX (Demonstrated in Godot 4)
5:46
PlayWithFurcifer
Рет қаралды 360 М.
I Tried Godot VisualScript In 2024 ( And Found An Alternative )
8:19
Turn Off the Vacum And Sit Back and Laugh 🤣
00:34
SKITSFUL
Рет қаралды 6 МЛН