No video

Game Programming Patterns in Godot: The Singleton Pattern (Godot Autoload)

  Рет қаралды 9,450

GameDev w/ David

GameDev w/ David

Күн бұрын

Пікірлер: 25
@GameDevWDavid
@GameDevWDavid 7 ай бұрын
🌟 If you liked this video, I recommend that you also watch another one in which I explain the Observer Pattern and how to use signals in Godot: kzfaq.info/get/bejne/q7R0qrmpxM7SdXU.html
@SquibbyJ
@SquibbyJ 29 күн бұрын
Thank you for explaining this in a video, I was reading documentation and it just wasn't clicking and as soon as you demonstrated I was able to work it how I needed to. Very helpful!
@ryoon2k
@ryoon2k 7 ай бұрын
i was confused at what a "Singleton pattern" was, turns out I was using it in godot for my Global variables
@fudo5944
@fudo5944 7 ай бұрын
I rarely comment and most of the time I am just a simple lurker. But your videos are amazing! Keep up the good work!
@GameDevWDavid
@GameDevWDavid 7 ай бұрын
Thank you for leaving your comment and for watching the video!
@easy_taco4651
@easy_taco4651 21 күн бұрын
great explenation!
@myme1474
@myme1474 7 ай бұрын
First time ever I've heard someone use Phonk as their background music in a tutorial, and I'm mega vibing with it
@GameDevWDavid
@GameDevWDavid 7 ай бұрын
It's a great track. I am very grateful to all the musicians who make their music available without copyright ❤️‍🔥
@samuraikina5908
@samuraikina5908 7 ай бұрын
I do this as well on my game. Also using Core as main scene and then instantiate and queue free levels is good too. Its similar as well for performance
@samuraikina5908
@samuraikina5908 7 ай бұрын
@@kishirisu1268 what you mean? What im describing its even suggested on docs
@mbg4681
@mbg4681 7 ай бұрын
Happy New Year! Thanks for the new tut!
@GameDevWDavid
@GameDevWDavid 7 ай бұрын
Thank you so much! And happy New Year!
@dibaterman
@dibaterman 2 ай бұрын
Technically script classes are resources which are in effect singletons. The Script Resource itself only has 1 version of itself in the project period. So making a static instance of the scripts instance would store the instance in the resource at runtime. Now why you would want to do this... to rage against the machine?
@Afreshio
@Afreshio 6 ай бұрын
really good explanation!
@GameDevWDavid
@GameDevWDavid 6 ай бұрын
Thank you!
@FernandoPujol
@FernandoPujol Ай бұрын
Thanks for the video David. I'm new developing games and I have been using the singleton pattern. Essentially for each object I create (player, levers, coins) I create a "controller" (singleton) script with essentially the variables and functions that I will need later for the actual scene script to consume. I'm not sure if what I'm doing is correct. I'm worried about later performance or code structure in general to turn into a mess. Any suggestions?
@brandonjacksoon
@brandonjacksoon 6 ай бұрын
Liked and sibscribed! Thanks mate!
@GameDevWDavid
@GameDevWDavid 6 ай бұрын
You're welcome!
@Sirlegna
@Sirlegna 7 ай бұрын
I noticed when using the autoload, if I call the script in a node within the game. Then it doesn't retain the singleton property of single instance.
@GameDevWDavid
@GameDevWDavid 7 ай бұрын
What do you mean exactly?
@Sirlegna
@Sirlegna 7 ай бұрын
@@GameDevWDavid So, you can attach the script to another node in the scene and try to get the data from that script instance. When you do, it will not be from the singleton instance. Which means it fails the restricted to on instantiation of the class. In the C example you showed, the "node" instance of the singleton would update the class variable _instance with a new instance. This however, will not happen in the auto-load and instead both instances will exist at the same time.
@GameDevWDavid
@GameDevWDavid 7 ай бұрын
@@Sirlegna Yes, correct. It is not a Singleton in the pure sense of the technical term, but it is what we have for now in Godot.
@Strategiusz
@Strategiusz 4 ай бұрын
The singleton antipattern.
@poleve5409
@poleve5409 Ай бұрын
the singleton pattern sucks. any other design choice is better.
How Games Make VFX (Demonstrated in Godot 4)
5:46
PlayWithFurcifer
Рет қаралды 338 М.
Please Help Barry Choose His Real Son
00:23
Garri Creative
Рет қаралды 23 МЛН
Nurse's Mission: Bringing Joy to Young Lives #shorts
00:17
Fabiosa Stories
Рет қаралды 4,8 МЛН
English or Spanish 🤣
00:16
GL Show
Рет қаралды 8 МЛН
Signals in Godot are Amazing!
5:17
Chaff Games
Рет қаралды 27 М.
Game Programming Patterns in Godot: The Command Pattern
14:41
GameDev w/ David
Рет қаралды 17 М.
This Godot 4 Scene Manager Does it ALL
28:50
Bacon and Games
Рет қаралды 25 М.
Finite State Machines in Godot | Godot Starter Kit FSM
9:46
ForlornU
Рет қаралды 27 М.
Godot Debugging Techniques EVERY Dev Should Know
16:23
Bacon and Games
Рет қаралды 26 М.
Do THIS Before You Publish Your Godot Game
3:33
StayAtHomeDev
Рет қаралды 165 М.
10+1 INCREDIBLE addons for Godot 4
8:28
MrElipteach
Рет қаралды 31 М.
Please Help Barry Choose His Real Son
00:23
Garri Creative
Рет қаралды 23 МЛН