Avoid BUGS and Work FASTER - 10 Godot Engine Tricks

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 ธ.ค. 2024

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

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

    Share your Godot tricks (or else I'll call your grandma)!

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

      With what, a Ouija board?

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

      @@sslaxx If necessary!

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

      Prefer Police officer :)

    • @李亦淇Marisa
      @李亦淇Marisa 2 ปีที่แล้ว +4

      press ctrl+k to comment a bunch of code

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

      @@sslaxx I prefer the Luigi board.

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

    I have some trickery for you:
    You know that Godot does not have static variables? That means that your static func don't have where to store anything. Well, I have a solution: make a custom Resource, and a resource file, preload it in your static func and store your static variables there. But wait, there is more…
    You know that the scene tree is not available from a Resource? That is because - unlike nodes - resources are not in the scene tree. So what if you want - for example - to access an autoload from your custom Resource? Well, use the get_main_loop method from the Engine singleton. That will give you a reference to the MainLoop instance, which - by default - is your - main - SceneTree. Oh, and by similar means you can access the SceneTree form your static func.
    So if you have been passing a reference around to be able to access these form your static func or Resources, you can refactor that.

    • @Relivino
      @Relivino 2 ปีที่แล้ว

      Why would you use static vars/funcs tho?

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

      @@Relivino Mostly helper methods. In particular for operations that the Godot API does not have. They would logically belong to a built-in class. Which I can't modify without making a custom build of the engine. And remember that we can't make extension methods in GDScript. So I make a class called along the lines of WhateverHelper where I put static methods which take whatever they need to operate on as parameters.
      And why an static method might need variables? For cache, memoization or lazy initialization. In other words: the static method needs to compute or instantiate something to work, and not having to do it every time is a reasonable optimization.
      Anyway, I'm NOT saying we should make everything like this. Not at all. But if somebody is in a situation when they do, perhaps they can find useful what I posted.

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

      @Gary Oh good. And that would cover most cases, actually. So using a resource would be strictly for baking data form a tool script, I think.

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

      @Gary After trying to put that in practice, I have couple notes:
      - I lose type safety.
      - I can export vars from the resource for easy configuration.

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

    That shatter particle effect is exactly what I've been looking for. Thank you!

  • @Tenraiden
    @Tenraiden 10 หลายเดือนก่อน +1

    That girl grabbing the money flying out of the bag, where is that clip from? 0:09

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

      Probably pexels if it looks like stock footage

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

    I was having this exact problem with a timer continuing during the game being paused, and it was causing a situation where if a player died, then quickly paused, a player object would respawn even while paused. Thank you so much for this.

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

    I had not considered using modulate like that. Now I can rewrite my hue rotation shader to use modulate.

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

    I wish scene tree timers also had a parameter to run on physics process. that would be so useful.
    That modulate stuff is really clever!

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

    Some really great stuff guys, constanly getting some juicy info here! Thanks! Any chance there is a Video on a good way of making top down trails on water?

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

      Thank you!
      What do you mean exactly? Maybe you can just use a particle system that you turn on when the player is in water? (particles in global space so they make a trail)

    • @DjPerception91
      @DjPerception91 2 ปีที่แล้ว

      @@PlayWithFurcifer I was thinking of some sort of a simple wave function. A shader, but i think i have another solution. The actual problem i have is, as funny as it sounds, the z index. I have a whole lot of layers for the background/floor and usually my complex water objects land on top, not behind them. So the particles cant be cast between the floor and the water layer, ending up on top of water borders from time to time. So i thought about an additional layer/s with some sort of wave function shader for a trail. I will test another solution soon and might inform you on how it worked out if you wish.

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

    that exploding sprite thing is very cool. wouldn't have thought of that

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

      Glad you like it. It's one of these fun little hacks that can come in handy sometime :)

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

    This is one of the most useful videos you lot have made. (For me, at least.)

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

    I love your sense of humor.

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

    yield(get_tree().create_timer()) is a safety hazard and honestly should never be used. for any poor fella who try to use this thing on your project, the likely hood of this causing headache is massive, please just generates regular timer nodes.

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

    Very nice! I love getting these tips!

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

    these videos are exactly what I need thank you!

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

    the tests show awesome results, thank you for this ❤

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

    Awesome! Great Stuff!

  • @Siberiius
    @Siberiius 2 ปีที่แล้ว

    You save me so much time. Great videos!

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

    Thank you guys for this video!
    I was using an algorithm to break my sprite into many objects. The issue is that it can get laggy... I´ll use this method instead. Though I did not understand why you added an animation at the end. ( I am noob and I would just emit the particles once).
    Regards!

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

      There are many ways to achieve a break/dissolve effect, maybe this one works for you!
      I made an animation to quickly fade out the underlying sprite, but you can also just switch it to invisible and emit the particles.

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

    More videos like this please! :)

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

      Oooh, for sure :D
      For the meantime: Have you seen all our other tricks videos already?

  • @Gazaze
    @Gazaze 2 ปีที่แล้ว

    The modulate trick is gonna solve my shaders problem! thank you!

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

    Thanks for the useful tips!

  • @andreamassa2176
    @andreamassa2176 2 ปีที่แล้ว

    Thank you very interesting and useful trick!

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

    I love these videos

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

    I just found out if you change the icon.svg file in your project, that icon will be the one that shows in the project manager. Fun stuff

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

    oh my god that create_timer thing makes me feel like an idiot. i always kinda felt that cluttering a node with timers was kind of an ugly looking thing so to know that there's been a code-based workaround for that is both relieving and irritating.

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

    So the thumbnail says do not create a get_tree(). create_timer() but on 0:26 so say the opposite?

  • @rocket007
    @rocket007 2 ปีที่แล้ว

    i always laugh when you say "like animals". =D

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

    Amazin vídeo, is really helpfull, tnx

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

    Never had to use a scene tree timer, for me it's either signals when I need to wait for an animation or tween to complete. Or a variable that I update in _process when I need to do something periodically. It also allows me to randomize periods, make them dependent on circumstances or reset them prematurely.

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

    how did u guys make your coins bounce in your demo? ive only been coding for a month and cant even find a place to start. Did you do it with code or a shader or something else?

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

      More or less just an animation player :)

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

      @@PlayWithFurcifer
      yea but i see them bounce off in different directions... you must add some kind of code or perhaps have a bunch of animations for all those directions? anyways tnk for the respond.

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

    If you use in your code any non defined actions in project settings your FPS will drop to several FPS per minute. :D
    There are not any error messages as far as I remember. This occurs often when transferring parts of the code from one project to another. Do not use this trick. :D

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

    For particle explosions, is there a way to randomize the shape of the pieces as well? In many cases, the "all-square-pieces" don't produce a very appealing result.

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

      That spunds like theres a little particle shader wizardry involved.

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

      You can mask it with another texture using a fragment shader

    • @Relivino
      @Relivino 2 ปีที่แล้ว

      @@PlayWithFurcifer Like here? th-cam.com/video/eT9ztkG2PTU/w-d-xo.html

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

      @@PlayWithFurcifer Can you describe a little more on how to do this? I cant apply a second pass shader.. Do I need to convert the particle to a shader and work from there? I'm trying it out but particle shaders dont have UVs so cant figure out how to use a sampler2D to mask them.

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

    And i thought you guys were going to talk about the perils of yielding from _ready() :D

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

      Which one exactly? :D
      It deservs its own video honestly

    • @hilfazer
      @hilfazer 2 ปีที่แล้ว

      @@PlayWithFurcifer 'ready' signal is emitted either with return or... with the first yield. If something connects to that 'ready' and relies on _ready() function having done all of its work... well, it won't go well. Creating a custom signal and emitting it at the end of _ready() is an option but one needs to remember to connect to that signal instead of 'ready'. Not ideal.

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

    Nice!

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

    For unique input to the same shader through uniform why do you need to make multiple shaders? Can't you just check "Local to scene" (under resource) in the inspector for the shader. I created a tilemap shader that I dynamically instance copies of and send different parts of the map this way. Or did I misunderstand something?

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

      We said that you can make it unique. So yes, making it local to scene works BUT this internally makes multiple materials which prevents batching.

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

    Does anyone know how to add auto-complete for functions I write? I made some global functions and put them into autoload, but I have to always look up how I spelled them. It never suggests the functions I wrote inside of the global script.

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

    Okay that call_group command is great how did I not know that before?

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

      We also just found it, i wonder when it will come in handy :)

    • @paulosullivan3472
      @paulosullivan3472 2 ปีที่แล้ว

      @@PlayWithFurcifer I have already found a way to use it in the game I am making! It helped me solve a problem with communicating between groups!

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

    OK OK I'll Like! PLEASE DON'T CALL MY MOM!!!

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

    haha i will love to watch this video but the thumbnail is something i have discovered for myself because sometimes the object is not there after the timeout.

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

      Haha yup, we also rarely use yields in general. A typical function connect (with CONNECT_ONESHOT if needed) is safer.

  • @Galomortalbr
    @Galomortalbr 2 ปีที่แล้ว

    i had no idea about call_group, this seems so useful.

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

    First comment! :D I love you guys!

  • @UsernameDoesntCare
    @UsernameDoesntCare 2 ปีที่แล้ว

    Ive been having a bug with SceneTree Timers where if I change a scene in the middle of one, the game will produce an error but still run in debug mode. To fix this, I had to make my own timer nodes.

    • @Willior47
      @Willior47 2 ปีที่แล้ว

      same here. i swore off SceneTree timers forever after this.

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

    I don't know if this is already in a video, but probably I have invented it, STOP using get_node("Path"), I hate it because when you change the path on files/tree or the object is deleted in-game it gets errors, instead, I create a var for example "Player" on the main global script "GS" then on node's ready call I set var to itself.
    extends KinematicBody
    func ready():
    >>> GS.Player = self
    In that way, the path doesn't matter and if the player is deleted on death it is replaced automatically when you instance another because it is on ready(), note: if you want to use "Player" but the node hasn't called to ready you need to yield a frame.

  • @KyleLuce
    @KyleLuce 2 ปีที่แล้ว

    Lol @ photo cuts to Juan in Barcelona. I hope he watches these.

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

      Haha, I don't think so but it would be hilarious

  • @netyimeni169
    @netyimeni169 2 ปีที่แล้ว

    Oh the timer

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

    👍👏

  • @danieltudor94
    @danieltudor94 2 ปีที่แล้ว

    one thing im curious about is who has the 1060 and who has the 3080 ?

  • @muerasangre
    @muerasangre 2 ปีที่แล้ว

    👍

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

    vulkan errorororoororororororoororororororo😢😢😢

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

    I really liked your content but i unsubscribed because of flag

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

      That's one of the advantages of that avatar :D
      Your need to let me know confirms that you are quite the asshole.

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

    I have a problem for you guys to solve, since I tryied the Godot Discord channel and even the subreddit but could not solve it: My game is ready do be published on Google Play Store, but I can't upload it because, since the beggining of this year, Google only accepts .AAB files no larger than 150mb, but my game has lot of big textures and Godot exports it as a 600mb .AAb file.
    Reading in the Android's documentation, I see they have a new way to upload those big apps called Play Asset Delivery which has 3 types of "upload": install-time (this is like it was before with apk, but being .aab files. Just one 150mb file), on-demand (your game downloads all the heavy assets after installing the game) and fast-follow (this got me a little confused, but I think is when you split your app in several 150mb .aab files and upload eachone to the store). I don't know if I'm understanding this right, but seems like Godot right now only has support for the install-time method, which is a bummer, cause this limits a game to only 150mb :(
    This is my first commercial game, and me and my really small team worked 18 months on it. We know it's not the greatest game, but we would like to publish it. Thanks for reading this.

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

    Maybe this is common knowledge but I found out a godot thing today. Say you have an area and monitoring was set to false for some reason. Now if you set monitoring to true to detect something, it will not emit 'area entered' signal for monitorable areas that are already intersecting the monitoring area. But if you want to get that signal, just give a zero translate to the monitoring or monitorable area right after you set the monitoring to true. Like $monitorArea.monitoring = true, followed by a $monitorArea.translate(Vector3(0,0,0)).
    Edit: This is in Godot 3.4

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

    GODOT is hard but y'all make it look easy 👍
    Love the video, don't call my mum 🥲

  • @nickhatboecker
    @nickhatboecker 2 ปีที่แล้ว

    CONNECT_ONESHOT was a game changer for me!! Thank you very much