Тёмный
Cadoink
Cadoink
Cadoink
Подписаться
Комментарии
@roktinfast
@roktinfast Месяц назад
Thank you. I have been searching for anything remotely useful on this topic in c#. This was really good.
@goodxp
@goodxp 2 месяца назад
very nice and informative video. thank you very much!
@luckyknot
@luckyknot 3 месяца назад
Immediate subscribe! useful and to the point!
@DrZ_5000
@DrZ_5000 3 месяца назад
Great Tutorial, thx a lot! liked&subbed :) You have a nice way of explaining the software design behind your ideas. Good to see you using C#, I just started godot and prefer static typed languages. I will try this out in in my project for sure. Would it be possible, that you push that specific code in a minimal Godot project to github? Maybe that way people (including me) can collaborate and share their ideas about this topic there. We could also copy&paste the code more easily ;) cheers mate
@cadoink
@cadoink 2 месяца назад
Thank you for the kind words! I am glad you found the video useful. I've had a busy time with life stuff lately and would like to get back to RU-vid soon! When I do, I'd like to begin putting the code on GitHub for people to reference.
@MimoTooThanks
@MimoTooThanks 4 месяца назад
That was very helpful, thank you!
@0HHC
@0HHC 4 месяца назад
For 4.3: WORLD_MATRIX is now MODEL_MATRIX. My caustics look horrible, I followed strictly though. A bit unsure what it could be.
@regen-Q
@regen-Q 4 месяца назад
from what i understand, increasing the max polyphony attribute of an AudioStreamPlayer node achieves the same result as your SoundQueue system. is there a particular reason why you chose this system over simply increasing the max polyphony?
@The_JCM
@The_JCM 4 месяца назад
9:30 U can tween even easier by tweening the parameter directly like this: tween.TweenProperty(shaderMaterial, "shader_parameter/color", color1, color2, 5.0f); To get the correct path, u can just right-click the parameter in the editor -> "Copy Property Path"
@CCLawhon
@CCLawhon 4 месяца назад
Hey, I'm new to shaders and was wondering why WORLD_MATRIX and SMOOTHNESS aren't options, and throw errors? I changed smoothness to ROUGHNESS and both work, though. Then, as you changed your code, smoothness (lowercase) worked there. The only thing not working by the end was CAMERA_MATRIX but changed to PROJECTION_MATRIX and it works! Really cool effect and good intro to shader basics! Thank you for the tutorial :)
@cadoink
@cadoink 4 месяца назад
Are you using Godot 4? In this video I am using Godot 3. Some of the shader variables were renamed in Godot 4, so you'll need to do some googling to find alternatives. I believe the WORLD_MATRIX for example is now called MODEL_MATRIX. Sounds like you got it working regardless! Glad to hear. :)
@6ocram
@6ocram 4 месяца назад
@@cadoink Thank You. Great content :)
@redwolf6334
@redwolf6334 6 месяцев назад
Thank you very much you are very good at making videos its really impressive
@crabirl
@crabirl 6 месяцев назад
You mentioned having a signal dictionary between the classes around 9:10 -- I would love to know more about that. Thank you!
@cadoink
@cadoink 6 месяцев назад
I kind of flubbed my word there. I was trying to say a single dictionary. 😅 What I meant was that instead of having a Dictionary for SoundQueues and a Dictionary for SoundPools, they could each implement a C# interface that defines a Play method. Then you could store both the queues and pools in one dictionary.
@tastedaspear7948
@tastedaspear7948 7 месяцев назад
btw, is it possible for me the to get my hands on that fireball png?
@cadoink
@cadoink 7 месяцев назад
Its from the Kenny Micro Roguelike spritesheet: www.kenney.nl/assets/micro-roguelike
@tastedaspear7948
@tastedaspear7948 7 месяцев назад
gr8 video mr.KING-GAMEDEV!
@yusarimahubara
@yusarimahubara 7 месяцев назад
Awesome tutorial, helps me a lot to organize my sounds in the project. I found that the AudioStreamRandomizer exists and does a similar job to SoundPool, do you think the SoundPool is no longer needed anymore ?
@chocolatelasagna3328
@chocolatelasagna3328 7 месяцев назад
great video, enjoyed the visual/explanation of the math as to avoid magic numbers.
@lunarcanvasdev
@lunarcanvasdev 7 месяцев назад
If you're getting an error, replace "COLOR.a = 0f;" with "discard" Works for me.
@joshhoffman7811
@joshhoffman7811 7 месяцев назад
Your introduction to these concepts is fantastic. This is exactly what I was looking for, thank you for putting this video together! :)
@cadoink
@cadoink 7 месяцев назад
Thank you so much! I'm glad you enjoyed it! :)
@Coralori
@Coralori 7 месяцев назад
How would you implement this to play upon clicking a button in a different scene (i.e. the code needed)?
@cadoink
@cadoink 7 месяцев назад
What I typically do is I have a main scene that contains two children, the scene with the button, and the cutout scene. The scene with the button will have an event that the main scene will listen for. When that event fires, the main scene will receive the event and tell the cutout scene to play the animation. I'll also typically have events for when the animations finish. So once the screen is completely black, I can clear out my scene with a button (typically my main menu), and add whatever scene I want to transition to. Then I call the cutout scene to fade back in.
@Кашель-о5у
@Кашель-о5у 7 месяцев назад
I lost all my day before find your video, now its co clear, big thx!
@cadoink
@cadoink 7 месяцев назад
So glad it helped!
@franciscoalmeida3241
@franciscoalmeida3241 8 месяцев назад
Sup, how would you go about if you had to transport the settings from one scene to another?
@cadoink
@cadoink 8 месяцев назад
I like to keep a static class of settings that any scene can reference to get the volume settings. An alternative could be to create an autoloaded script where you store the settings.
@ricardopereira2390
@ricardopereira2390 4 месяца назад
@@cadoink Hey! Could you please explain the alternative? I've been trying, but when i try to change the slider value with the ready() function it just doesn't do anything... doesn't even return any errors
@cadoink
@cadoink 4 месяца назад
@@ricardopereira2390 The alternative meaning using an autoloaded script? This script would just contain settings values, then your UI component containing the slider would ask the autoloaded script what the setting should be and then set the value of the slider. This doesn't solve persistence, so each time you run the game it would use whatever the default value of the property on the autoloaded script is. If you want changes in values to persist you'll need to serialize them to disk, and deserialize from disk when you run your game.
@ricardopereira2390
@ricardopereira2390 4 месяца назад
@@cadoink thank you!
@sziklamester1244
@sziklamester1244 9 месяцев назад
Actually I created a simple menu for my game but actually the game is a single image and now not that matters. I managed from another video tutorial to play a music by using a music controller and autoload which is nice because I wanted the music works on the main menu and the options menu but actually not want to use it on the game scene. I only have currently one music to play but later when I start to build up my game I want to play different sounds and musics but now I would want to mute the music when I start my game scene. Actually what you shown in the video is good but I did not followed because not want to mess it up more than what may I did currently. Already used 3 peoples tutorial and mixed into one but not managed to fix this yet. I am using Godot 4.2 right now and currently none of the 7 tutorial I watched for helped me that much because they have had already a game or was just a mess.
@FPTGOG
@FPTGOG 9 месяцев назад
It says that "playback can only happen when a node is inside the scene tree", i can't use Sound Queue at all
@cadoink
@cadoink 9 месяцев назад
You will need your SoundQueue somewhere in the scene tree. This could either be a part of a singleton that is autoloaded, for example a sound manager to manage all your sounds, or you can use these SoundQueue directly in the scenes that needs the sound, like a Player scene could have a SoundQueue for its footsteps sounds.
@moose6459
@moose6459 10 месяцев назад
I ended up converting it all into a singleton with a PlaySound(Node3D owner, AudioData data) and PlayRandomSound(Node3D owner, IEnumerable<AudioData>). My AudioData is just a resource containing the stream and all the stream variables. Then I check in the singleton if the dictionary of sounds already contains an active AudioStream playing the sound, in which case I replay the sound, otherwise I create a new AudioStream child. This way all my active audio in the game is in one central location and any script can request to play a sound.
@moose6459
@moose6459 10 месяцев назад
The SoundQueue isn't necessary. AudioStreamPlayer has a MaxPolyphony which does the same thing, allowing a sound to be played again while already playing if set higher than 1.
@cadoink
@cadoink 9 месяцев назад
I either came up with this before MaxPolyphony was implemented (maybe an older version of 3.X), or before I learned about this. Thanks for the tip!
@E62147
@E62147 6 месяцев назад
But then SoundPool isnt't necessary either, If I can use AudioStreamRandomizer? Im getting lost what is the best aproch to implement sound system.
@cadoink
@cadoink 6 месяцев назад
@@E62147 So this looks to be a new feature of Godot 4. Its not a node, but a selection for the Stream on AudioStreamPlayer. This stream setting has a Streams property where you can add multiple streams. Pretty cool! My recommendation would be to use this in your Godot 4 projects and see if it meets your needs. You can also implement my solution if there is some specific behavior you want that the new Godot 4 option doesn't provide.
@juanjosepenabecerra7746
@juanjosepenabecerra7746 10 месяцев назад
How to prevent from playing the sound pool every frame? wait until the current sound ends?
@cadoink
@cadoink 10 месяцев назад
You should play the audio when the event happens. So when the player presses jump, or is hit by a projectile, etc. If you play the audio on the frame something happens, it shouldn't restart on other frames. Sometimes an event may occur very frequently. In those causes you may want to limit how many times a sound can be played. The size of your queue of sounds and how long they play can limit how frequently the sound will occur, so for some events it may skip playing the sound so that its not overwhelming.
@DibyoshreeSarkar
@DibyoshreeSarkar 10 месяцев назад
Okay so I have a bunch of sounds that I want to play, based on a dialogue script, What I did was set a new stream to the same audio player at runtime, so that when the script says "play a pop sound" the code looks in the asset library for a pop sound and sets the stream of the audio player to that sound. This works fine for a small project, but I was wondering if this is too inefficient for a larger project ?
@cadoink
@cadoink 10 месяцев назад
I'm not entirely sure, but I think the resource stream is the expensive part. Once its loaded, creating and destroy AudioStreamPlayers should be efficient.
@Fresh4
@Fresh4 11 месяцев назад
I'm confused as to why your shader overlays atop not only the background but the coral and other decorations when you only applied the material to your backdrop node. I'd like to achieve a similar effect but applied over every mesh in my scene (as though I were projecting the noise over the 3d space) but for me this just seems to apply flatly to just my terrain.
@cadoink
@cadoink 10 месяцев назад
All the objects in my scene share the same material. I often use a single texture with a grid of colors as my albedo, and move the objects UV map to the color I want. I like to do this to keep the number of materials I use low.
@b1uezer
@b1uezer Год назад
How would you do this for an Area2D Node with C#? I have a player character that can pick up a power up to dash, and I want it to have a 50% opacity white color while the power up is going. I can create the Shader just fine with uniforms, but I don't know how to access the Shader properly with code. "Material as ShaderMaterial" is something I came across, but when I a set a new shader material to it, I can't SetShaderParameter as the object reference keeps returning null, which means I'm grabbing the wrong thing or the wrong way. Any insight is appreciated. SOLVED EDIT: Figured it out. I'm just incredibly green to this and was not getting the reference from the right node. My script was on the Area2D node, but it was my AnimatedSprite2D that I needed to get a reference to, which was a child of this node. Since the Area2D had no material, of course it would be null; I'm still getting used to the idea of needing references despite things appearing connected in the scene list. May be a teachable moment.
@cadoink
@cadoink Год назад
Glad you were able to figure it out! Its a bit tricky at first, but you'll get comfortable with Godot over time!
@bitbutter
@bitbutter Год назад
very nice! idea for extending this: SoundQueue is renamed SoundGroup. SoundGroup can play children of type: AudioSteam, SoundPool, or SoundGroup. SoundGroup has a checkbox for 'play simultaneously'. When not ticked, SoundGroup works as the sound queue currently does. When ticked, all child Playables play simultaneously. This allows playback of layering sounds from a single sfx play call, where each layered part can be randomly selected from a set of sound variations for extra richness. Sound nodes can be nested arbitrarily deeply for complex variation schemes.
@petersonnormil6799
@petersonnormil6799 Год назад
awesome video for godot! it honestly taught me some things that I've never even tried in Unity. thanks so much!
@andres_mpr
@andres_mpr Год назад
This was amazing... I like mi code well structured and this is awesome, thanks
@mcaped
@mcaped Год назад
what is the code like using GDScript
@RyanNaddy
@RyanNaddy Год назад
I believe you can just create this function and call it as seen in the video: ``` func log10(x: float) -> float: return log(x) / log(10.0) ```
@zaftnotameni
@zaftnotameni 11 месяцев назад
or to generalize ``` func logWithBase(value, base): return log(value) / log(base) func log10(value): return logWithBase(value, 10.0) ```
@sporktank
@sporktank Год назад
Super clear, nice tutorial vid yet again! :)
@Zikes
@Zikes Год назад
When I try this in Godot v4.0.2 the sampler2d texture repeats at scales less than 1.0, even when I use repeat_disable in the shader uniform. Is this a recent bug, or am I missing something? UPDATE: I've tried this in 4.0.3-rc1 and it works as expected. It seems 4.0.2 had a bug and it has been resolved.
@Paruthi.618
@Paruthi.618 Год назад
cool tutorial.. thanks
@cadoink
@cadoink Год назад
Glad you enjoyed it! :)
@matiturock
@matiturock Год назад
Hello excellent video. One suggestion is to please make the editor code letters bigger. Thank you.
@cadoink
@cadoink Год назад
Thank you for the suggestion. I'll increase the font size in future videos. :)
@marquesguilherme3746
@marquesguilherme3746 Год назад
Hey. I just signed up. I have a doubt, if I use what you teach in your tutorials, the codes and shaders, I can use it in my projects freely, do I need to give credits? And is it free for commercial use?
@cadoink
@cadoink Год назад
Hello! You do not need to give me credit to use this in your project! You can use my shader code and/or my C# code from any of my videos for personal or commercial use without any attribution. I try to use only CC0 resources when I am working on tutorials or my own personal projects. The Fresnel function I use in this video comes from godotshaders.com, which requires uploaders to license their code/resources with with CC0, MIT or GNU GPL v.3. (see here godotshaders.com/license/)
@AgnisNeZvers
@AgnisNeZvers Год назад
Lovely video! It's a nice glimpse into C# workflow.
@cadoink
@cadoink Год назад
Thanks! I love working with C#!
@WeirdGoat
@WeirdGoat Год назад
Practical, clear and easy to follow, what can I ask more?
@yvanvan3729
@yvanvan3729 Год назад
Great tutorial ! Thank you for taking the time to make this tutorial for the Godot community.
@cadoink
@cadoink Год назад
Thank you! Hope its useful! 😀
@WeirdGoat
@WeirdGoat Год назад
Great work! Could you please make a video to tell us how to set and get shader parameters with C#? Thanks alot!
@cadoink
@cadoink Год назад
Thank you for the suggestion! I'll see if I can get a video made about that. :)
@WeirdGoat
@WeirdGoat Год назад
@@cadoink Happy to help. Sometime we need to switch from different shaders, or make a tween animation. And there are lots of shader you can find all over the internet, but how to use them properly is the problem. Like I got a water shader, how could I put a water pit in my Top-Down game, when character walk though it, it will show waves and reflection. There are really few tutorials that talking about it.
@cadoink
@cadoink Год назад
@@WeirdGoat Finally got some time to make a video about interacting with shaders and materials using .NET. I briefly cover a way to tween shader uniforms. ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-hHi11LVQbis.html&lc=UgwKnMY12akseUJhOUx4AaABAg I didn't cover waves and reflections for a character, but my suggestion would be to fake the effect rather than complicate the water shader. You could spawn a quad that has a water ripple texture under the character, or use particles. For the reflection, one common technique is to spawn a copy of the player or object upside down underneath the player with a material/shader that makes it look under water. There may some some tricks around using the water as a mask for that copy. Might look into it myself, could make a good video.
@WeirdGoat
@WeirdGoat Год назад
@@cadoink Thanks for the advise, and I'm gonna check your new video out!
@yogurtroyale831
@yogurtroyale831 Год назад
very cool. one suggestion i would have is incorporating a button to return the values to default. eiher individually or all together.
@cadoink
@cadoink Год назад
That's a great idea! Another thing I've seen that people can add is a button to quickly mute. I think I've typically seen this as a little speaker icon next to the volume that you can click to mute or unmute.
@yogurtroyale831
@yogurtroyale831 Год назад
@@cadoink yeah that would make a nice addition aswell. i like the concept of having simple audio nodes like that that fit any project and are customizable. great work on this tutorial
@abradotcs
@abradotcs Год назад
berry nice
@0HHC
@0HHC Год назад
Thank you! But can't you just increase max_polyphony in godot 4 for a queue?
@cadoink
@cadoink Год назад
I don't know! I've only recently started messing around with Godot 4. While I used Godot 4 for this video, I had typically been using these in Godot 3.5. Its possible that Godot 4 already solves queueing natively. I'll have to investigate! Thanks for the heads up!
@fkeyzuwu
@fkeyzuwu Год назад
@@cadoink yeah im pretty sure they have polyphony for this in godot 4. still a nice video tho! also, instead of having the audiostreamplayer as a child shenanigans and having to check for errors, you could just add an @export variable for the audio file you want to play and when you add new audiostreamplayers you just set their audio file to the one you put inside the variable. that saves a bunch of code that seems kinda messy and unneeded imo.
@cadoink
@cadoink Год назад
@@fkeyzuwu Hadn't thought to use an export to get the audio stream and just create the audio stream players in the ready method. That's a great idea! Thanks for the suggestion!
@cadoink
@cadoink Год назад
@@fkeyzuwu One upside to my approach is that you can tweak the AudioStreamPlayer for particular sound effects if you need to adjust the db, the bus you want to use, or some other setting (especially spatial audio). This could also be achieved with exports passing these values through though.
@eeek143
@eeek143 Год назад
I love seeing people talk more about audio aspect of things, excellent video
@baumwolle2548
@baumwolle2548 Год назад
Nice one! Since good Godot projects depend on strong software architecture its awesome you shared your work
@cadoink
@cadoink Год назад
Thank you! I'm always looking for better ways to organize my code. :) I've gotten a lot of reuse with these structures over various game jams, so I hope they'll be useful for others.
@felbecker
@felbecker Год назад
Thank you for putting time into this tutorial! Going further, one could think about implementing a priority system. The game should be able to prioritize sounds if there are too many. For instance, the fire sound from the player should have very high priority, whereas the same sound but from an enemy could be silenced if there are too many of them. I think this will require a small rewriting of you current SoundQueue approach.
@cadoink
@cadoink Год назад
That is a very interesting idea! I wonder if something like that could be achieved with a priority queue. I haven't run into this requirement before, but it would be fun to try and figure out.
@ld2studio675
@ld2studio675 Год назад
Thanks. Very interesting
@cadoink
@cadoink Год назад
Glad you enjoyed it!
@sporktank
@sporktank Год назад
Great video! Very nice way of solving these audio issues. Thanks for all the tips! 😄
@cadoink
@cadoink Год назад
Hope its useful! Its been great for the game jam projects. I typically stuff everything in the Sound Manager so I can quickly validate that everything is on the right audio buses for my sound settings. Perhaps an abuse of the singleton pattern, but acceptable for jams.😅
@sporktank
@sporktank Год назад
@@cadoink Everything is acceptable in a jam. 😂
@projectavalongame
@projectavalongame Год назад
nice vid, I had actually been thinking about this recently for my own game but hadn't searched anything about it. Seems very random for this to come up in my youtube home page 24 minutes after upload lmao
@cadoink
@cadoink Год назад
Serendipity! Hope its helpful! Let me know if it works out, or if you come up with some other cool ways of organizing sound. :)