5 INVALUABLE Godot 4 Code Patterns (feat.

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 ธ.ค. 2022
  • Code patterns help you solve common game dev programming problems and can make your life so much easier. Here are five GDScript patterns that we use all the time and that you should definitely have in your toolkit!
    Watch the other half of this collab on GDQuest's channel: • Five Must Have Code Pa...
    Watch our "Things About Godot You Should Know" series: • Things About Godot You...
    Wishlist our game Furcifer's Fungeon and play the demo:
    store.steampowered.com/app/17...
    Wishlist our other game, Super Kill-BOI 9000, and play the demo: store.steampowered.com/app/21...
    Join our discord server: / discord
    Follow us on twitter to stay updated on Furcifer news and tutorials:
    / tweetfurcifer

ความคิดเห็น • 85

  • @dairyfreelemonstreams9493
    @dairyfreelemonstreams9493 ปีที่แล้ว +69

    0:17 Asynchronous Callbacks
    1:45 Signal Bus
    3:49 Memory Management Discussion but mainly OBJECT POOLING
    6:50 Aggregation or/and DebugDrawCollisionShape showcase
    9:36 Managing Data, showcases Resources and tables

  • @smallguy241
    @smallguy241 ปีที่แล้ว +32

    Awesome video. There’s always a wealth of “hello worlds” out there - prod architecture and design stuff is always far and few between. Thanks!

  • @eerywax5631
    @eerywax5631 ปีที่แล้ว +2

    This video also led to me fiddling enough with Resources to finally understand how they can be used (and to stop being afraid to use the inspector for them). Thank you!

  • @goodwincek
    @goodwincek 9 หลายเดือนก่อน +2

    Awesome video! I'm still learning so tip #1 was a bit over my head, but tip #2 I think I could immediately start implementing!
    #3-5 I'm definitely bookmarking for later, especially data management! Thanks for the great video!

  • @bitbraindev
    @bitbraindev ปีที่แล้ว +3

    This is extremely useful. Thank you for this!

  • @YouTubsel
    @YouTubsel ปีที่แล้ว +1

    Can't say I completely understood how to use callables yet but I already understood that they are mighty handy!
    Thanks for all your videos. :)

  • @terrylyn
    @terrylyn ปีที่แล้ว

    Many useful tips there, I will be using these patterns, thanks!

  • @longdongsilver3267
    @longdongsilver3267 ปีที่แล้ว +1

    Nothing really to say, but I enjoyed this video. Thanks for making and sharing it.

  • @anarkyworld
    @anarkyworld ปีที่แล้ว +9

    As always a very useful and easy to understand content. Thanks

  • @GabrielVeda
    @GabrielVeda ปีที่แล้ว +66

    The Furcifer stuff presented was pretty advanced. You could have spent an entire video on each one. You skipped a lot of code that I wanted you to explain.

    • @Purpbatboi
      @Purpbatboi ปีที่แล้ว

      Exactly

    • @revimfadli4666
      @revimfadli4666 ปีที่แล้ว

      More content material! Yay!

    • @NateyC214
      @NateyC214 ปีที่แล้ว +1

      I especially would love to see more on the Object Pooling, it may not be seen as necessary but it is very interesting.

    • @revimfadli4666
      @revimfadli4666 ปีที่แล้ว +3

      @@NateyC214 it started to seem necessary once I realized how unnecessarily slow many amateur games were

  • @OgGhostJelly
    @OgGhostJelly ปีที่แล้ว +8

    crossover episode? 💀

  • @luislodosm
    @luislodosm 9 หลายเดือนก่อน

    Amazing tutorials

  • @kamrielus
    @kamrielus 8 หลายเดือนก่อน

    The most useful godot video I've ever seen ❤

  • @NaughtyKlaus
    @NaughtyKlaus 8 หลายเดือนก่อน +1

    Learned a lot, and never knew about the "owner" variable. Still, the sections could have been ordered better in terms of difficulty or complexity.

  • @Portponky
    @Portponky ปีที่แล้ว

    For ages I thought you were Nathan from GDQuest. If only this video had existed back then.

  • @rionhunter
    @rionhunter ปีที่แล้ว

    Instead of using an auto load signal hub, for quick projects I’ve found just adding new signals to the tree root. Also tree meta values ;)

  • @Marsleader88
    @Marsleader88 ปีที่แล้ว +2

    Going through GD's "Code from Zero" course.. Highly recommend for noobs like me

  • @TheSlimHim
    @TheSlimHim 2 หลายเดือนก่อน

    I'm interested in seeing the full code for the DebugDrawCollisionShape 8:12

  • @sslaxx
    @sslaxx ปีที่แล้ว

    For stuff like score, I've found myself preferring setters/getters.

  • @krzysztofswierzy4226
    @krzysztofswierzy4226 ปีที่แล้ว +6

    Great video, I wish it was uploaded month ago, so I wouldn't have to discover function-callback-argument-queue by myself :)
    About a pattern number five : I am disapointed with resources in Godot. I can't believe there is no built-in data structure, that lets us keep both exported and scripted variables. I often need to keep deeply nested dictionaries as data, and it is very impractical within export functionality. In the same time I have to use export to store data with visual components, like mesh or color. That problem forces me to keep data for every data-heavy object in two separate files :(

    • @Gdquest
      @Gdquest ปีที่แล้ว +5

      Have you tried resources? It sounds like what you need? Instead of deeply nested dictionaries, you can nest resources. Editing arrays of resources isn't amazing in Godot 3, but it's much better than dictionaries. Then if you make the leap to Godot 4, there, editing arrays in the inspector is way nicer.

    • @krzysztofswierzy4226
      @krzysztofswierzy4226 ปีที่แล้ว +2

      @@Gdquest thanks for the answer, it sounds very interesting, but I can't really imagine it ? For example : one resource stores arrays of meshes, colors and packed scenes, representing visual aspect of one themed tilemap. I wish to also store data which arguments pass to which functions for procedural layout of these objects and tiles. Should I introduce resource for every data patch of object-funcref-arguments and nest them into main theme resource ?

    • @Gdquest
      @Gdquest ปีที่แล้ว +5

      @@krzysztofswierzy4226 It's hard to answer because I would need to have the same understanding of what you've done and what you're trying to do as you have.
      Resources allow you to add any serializable fields you want, including other resources. So yes you could define a bunch of resource types and use those, Godot uses that extensively: whenever you create an object on a slot in the Inspector, you're nesting a resource. Mesh data, collision shapes, materials, etc. are resources.

    • @krzysztofswierzy4226
      @krzysztofswierzy4226 ปีที่แล้ว +1

      @@Gdquest Thank You very much, I will try to incorporate it, I suppose I will understand whole functionality on the way :)

  • @himihub
    @himihub ปีที่แล้ว

    you can export google doc as a json

  • @Doogin21
    @Doogin21 ปีที่แล้ว

    It’s simple. I see a Godot video, I subscribe. EZ

  • @imjust_a
    @imjust_a 10 หลายเดือนก่อน +4

    Very interesting video; would definitely like to see more explanation for certain topics, though! As a bit of a personal preference, I actually disagree on JSON being "really bad for holding data." I find a lot of strength in its flexibility. Unlike tables in which columns need to exist for every value, JSON allows you to flexibly add and remove values as-needed (as opposed to leaving a column blank if it's not being used, or adding a new column for data that only a handful of rows will use.)
    When loading data from JSON, you can simply have your code check to see if certain values it's looking for exist, and load them if they do (or use a default if they don't.) You can also easily include type names, allowing you to determine what kinds of objects to instantiate -- and within those different objects, use different values that aren't used by other objects.
    Obviously, it's up to personal preference, and each method of data storage has its pros and cons!

    • @Foreversun33
      @Foreversun33 8 หลายเดือนก่อน +2

      And with json i can use so nice things like jsonnata and co.

  • @pashakurozeev5516
    @pashakurozeev5516 ปีที่แล้ว

    Hello! Please make lessons on creating fishing in godot!

  • @felixjonsson4471
    @felixjonsson4471 ปีที่แล้ว

    Are these projects available somewhere?

  • @Flonkation
    @Flonkation ปีที่แล้ว +3

    So, use object pooling, if you need to? :D but not generally is the tip?

    • @igorthelight
      @igorthelight ปีที่แล้ว

      True!
      If you are NOT making a bullet hell game - you don't need it (most likely).

  • @eerywax5631
    @eerywax5631 ปีที่แล้ว +1

    Hello! I am trying to learn how to use CSV after seeing this. When I use the code from 10:19 (modified for use with 3.3 i.e. FileAccess -> File), it hangs in what seems an infinite loop. I found another tutorial that folows a similar approach but with dictionaries, and, well, same thing. If I stop before looping, and do a file.get_as_text() the output is blank, but printing the file itself confirms there is a File object. If I open my CSV in Notepad I can confirm it has content, and does not go on infinitely. Can anyone clue me in to what might be going wrong?

    • @twiederk
      @twiederk ปีที่แล้ว +2

      I had a similar problem. The problem was everytime I opend the file with the Godot editor, the editor added an extra empty line to the textfile. The solution was not to edit the files with the Godot editor, so no additional empty line was added.

    • @eerywax5631
      @eerywax5631 ปีที่แล้ว +1

      Hey I had given up on this and got back to it today. Finally got it working. For me I never opened the file with the editor, but it always had that extra line anyway. It might not be the smoothest workflow if I have to watch out for this all the time but at least now I know. Thanks!

  • @twiederk
    @twiederk ปีที่แล้ว

    Does Godot offers functions to read csv files or it is necessary to implement loading csv on my own.

  • @notarobot22
    @notarobot22 ปีที่แล้ว

    Concerning the first example. I'm not entirely sure about this, but aren't signals inherently asynchronous? If that's the case you should add a Mutex to lock access to your queue to ensure thread safety.

    • @Gdquest
      @Gdquest ปีที่แล้ว +5

      Signals are synchronous: callback functions get called as soon as the signal's emittted. It's the observer pattern but built into the engine.

    • @notarobot22
      @notarobot22 ปีที่แล้ว

      Learn something new every day 🙂
      Really appreciate these videos. There aren't many Godot resources on TH-cam that teach good programming principals. Coming from a software dev background myself, most of the stuff out there hurts my brain.
      Keep m coming!

  • @OnyxIdol
    @OnyxIdol ปีที่แล้ว +3

    signal bus is really amazing.. but I dread reworking my current project to use it -_-

  • @codinablack
    @codinablack ปีที่แล้ว

    The girl, who tells us about how to use self in the other video, she explains how to make resources and the asynchronous callbacks, does she have her own youtube or some place where she shares either tutorials or other learning materials?? I have to say, I really enjoyed both videos you guys did together, but between the three of you, I feel like I think the same way she does, and would love more of her content please!

    • @PlayWithFurcifer
      @PlayWithFurcifer  ปีที่แล้ว +2

      GDquest have their own channel, and the other two people make videos together here ;)

    • @jamesodonnell4771
      @jamesodonnell4771 7 หลายเดือนก่อน +1

      @@PlayWithFurcifer kinky

  • @pythonxz
    @pythonxz ปีที่แล้ว

    I really don't like that Signals call functions by string. I'd imagine there's a better way to handle that which isn't so brittle, right? (I'm new to Gadot)

    • @pythonxz
      @pythonxz ปีที่แล้ว

      Apparently 4.0 supports other ways to assign to signals. That's good.

    • @catgirlQueer
      @catgirlQueer ปีที่แล้ว +1

      4.0 allows you to connect callables (functions) directly yea

  • @alfredogodoy6854
    @alfredogodoy6854 11 หลายเดือนก่อน

    noice

  • @igorgiuseppe1862
    @igorgiuseppe1862 ปีที่แล้ว

    wait do you work for IEEE? thats impressive!

    • @PlayWithFurcifer
      @PlayWithFurcifer  ปีที่แล้ว

      That's not quite how it works. Scientists write and review papers for different journals. I work for a university :)

  • @rekiemr4501
    @rekiemr4501 ปีที่แล้ว +1

    brooo pls make tutorial game like a growtopia i hope u can🤗

  • @GodotWorld
    @GodotWorld ปีที่แล้ว +1

    It's too bad that Godot doesn't support Sqlite out of the box. Instead of building CSV or JSon files you could read and write from an actual local database without the need for a DB server.
    It's also too bad GDScript is 'python like' and not just python. Imagine all the stuff you could do with standard/advance python packages like numpy, fastAPI, Pydantic, Pandas, SQLAlchemy. Crunch all of the data. (I suppose I could always just learn C#)
    Conversely, PyGame, which does support native python is so much harder to use due to the lack of built-in visual and scene management tools Godot has.

  • @LivvieLynn
    @LivvieLynn 4 หลายเดือนก่อน

    Any Microsoft text editor scares me when it comes to data. Too many icky special characters and formatting issues.

  • @Malisti04
    @Malisti04 ปีที่แล้ว

    I struggled to keep up with the lady voice unlike the guy. Must be the accent I'm not sure.

  • @Rogueixpresents
    @Rogueixpresents 8 หลายเดือนก่อน +1

    i really hate how they are not making C# the main class citizen instead of this python looking ahh, sorry i just hate this syntax lmao

  • @AlexeyTutorials
    @AlexeyTutorials ปีที่แล้ว +1

    Actually GDScript is the only thing keeping me away from trying Godot. Not sure why they chose it over C# or JavaScript (TypeScript) which are more mature and times faster. These things can be done in a much more elegant way there.

    • @PlayWithFurcifer
      @PlayWithFurcifer  ปีที่แล้ว +4

      You can use C# in godot if you want to, it's really well supported.
      But honestly, GDScript is pretty great if you like the python-ish style

    • @AlexeyTutorials
      @AlexeyTutorials ปีที่แล้ว +1

      @@PlayWithFurcifer so isn't like C# better choice performance wise? Or it doesn't matter?

    • @PlayWithFurcifer
      @PlayWithFurcifer  ปีที่แล้ว +6

      @@AlexeyTutorials It is, but the vast majority of things you script are not performance critical.

    • @piousthepious
      @piousthepious ปีที่แล้ว +1

      If you want to use C# you can. There’s support for it. Just not everyone needs C# for their incredibly small game.

    • @whoisthis3038
      @whoisthis3038 ปีที่แล้ว +4

      the only performance bottleneck is the thing sitting between keyboard and chair. the language in 99% of times is not related

  • @bagboybrown
    @bagboybrown 6 หลายเดือนก่อน

    Anyone who uses vars cannot talk about good coding.

    • @PlayWithFurcifer
      @PlayWithFurcifer  6 หลายเดือนก่อน

      Yeah man, those dirty users of variables...!

    • @bagboybrown
      @bagboybrown 6 หลายเดือนก่อน

      @@PlayWithFurcifer It's just poor practice I don't care who's doing it.

    • @PlayWithFurcifer
      @PlayWithFurcifer  6 หลายเดือนก่อน

      @@bagboybrown You seem very passionate about it tho

    • @bagboybrown
      @bagboybrown 6 หลายเดือนก่อน

      @@PlayWithFurcifer That doesn't even make sense. About what I'd expect from someone who uses vars though.

    • @PlayWithFurcifer
      @PlayWithFurcifer  6 หลายเดือนก่อน

      @@bagboybrown See, you do care a lot :D

  • @leonf8199
    @leonf8199 ปีที่แล้ว

    feat. gdquest is awesome!

  • @ArabGameDev
    @ArabGameDev ปีที่แล้ว

    the handle must be like this @Gdquest
    not this @GDQuest