Тёмный
Barney Codes
Barney Codes
Barney Codes
Подписаться
I make games and creative coding tutorial videos.

On this channel I'll share cool things I've learned and the projects I'm working on.
You can expect to see videos on data structures, algorithms, graphics programming, game development and more!
My videos are a mix of tutorials, that teach you how to create your own creative coding projects, and devlogs, that keep you up to date with my personal projects!
Should you make games from scratch?
11:29
2 месяца назад
Star Mining Co. Devlog - New Drop Ship System
14:52
4 месяца назад
Real-time 2D shadows | HUGE improvements!
9:32
5 месяцев назад
Making my game more replayable (devlog)
7:50
6 месяцев назад
Completely overhauling my game
5:50
8 месяцев назад
Realtime shadow casting on 2D terrain
4:33
9 месяцев назад
Using noise in shaders (texture blending)
8:28
10 месяцев назад
Using shaders for terrain destruction?
12:03
2 года назад
Simulating Water Colour Paint in P5js
12:06
2 года назад
Комментарии
@tiagomoraismorgado
@tiagomoraismorgado 4 часа назад
cool. perlin noise
@ColinPaddock
@ColinPaddock День назад
One thing you can do to vary the flow pattern is to use a Perlin noise with one more dimension than your display(3d on a flat screen, 4d on a 3d space), and vary that value(z for the 2d case, t for 3d) over time. That should create a smooth change in the flow pattern…
@BarneyCodes
@BarneyCodes Час назад
I love this technique, thanks for the comment!
@BarneyCodes
@BarneyCodes 3 дня назад
Didn't realise there was an audio delay, or that the game sound was SO loud sorry! Hopefully will get that fixed up for the next one!
@_devilfish303
@_devilfish303 11 дней назад
ive always subscribed to the idea that you code the game in mind and an “engine” is the end result of that. It is not a general purpose engine though, but a highly specialized one only designed to run the game you set out to make, no more no less
@BarneyCodes
@BarneyCodes 11 дней назад
That's sort of what I've been doing with my current game, it's definitely not a general purpose engine! The issue with that is you've basically got to re-start any time you want to do a different style of game, which can eat up a lot of time! I totally get the appeal of doing things from scratch, but from a practicality stand point, if you're trying to get things done, I think it makes sense to use an off-the-shelf engine or at least a framework, so that the heavy lifting is already done for you!
@_devilfish303
@_devilfish303 11 дней назад
@@BarneyCodes there's a set of programming paradigms that i recommend you look into: SOLID When you understand SOLID you will not only become a better programmer, but code that you write, no matter how specialized, will tend to be modularized in a way that can be reused for other projects. That said, i totally get where you're coming from. I started out writing a game from scratch myself only to stop and think if what im doing is even fun. In my case i do require a custom renderer, as it is meant to be a voxel ray traced game and in such a case i need to squeeze out as much performance as possible out of the hardware. Godot is a non-starter for me unless i modified the engine code and stripped out absolutely everything i don't need... HOWEVER! i am planning on prototyping it first, in Godot, to see if it would even be worth making. Is my game idea fun? is the question i want to answer before i dig myself in too deep with a custom "engine"
@Niktmnieniechciej
@Niktmnieniechciej 15 дней назад
One of the best on youtube.
@BarneyCodes
@BarneyCodes 14 дней назад
Thanks so much!
@sasho_b.
@sasho_b. 21 день назад
Just cuz i searched for conway one too many times and now, 2 weeks later, my youtube is just conway's game of life: I made a c++ implementation that can run thousands of generations in a few seconds, but more important: it works on an infinite grid. So, take that Barney Codes! I mean, it doesnt really matter but that doesnt stop me. cool vid
@BarneyCodes
@BarneyCodes 21 день назад
😂
@samdavepollard
@samdavepollard 25 дней назад
Only half way through but this is gold. I've dabbled a little with real basic shaders in opengl using c++ but all that VAO, VBO stuff gets pretty old very quickly. I've also dabbled in p5.js a fair bit but never used shaders (didn't even know until recently that shaders in p5.js were possible). Pretty excited to see what I can create with p5.js shaders. Many thanks for getting me started, much appreciated.
@BarneyCodes
@BarneyCodes 25 дней назад
Haha yea setting all that up can be a bit of a chore, P5 is great for just messing about and getting something on the screen quickly! Have fun!
@samdavepollard
@samdavepollard 25 дней назад
fascinating stuff really nice done many thanks for sharing your knowledge subbed
@BarneyCodes
@BarneyCodes 25 дней назад
Thanks so much, glad you found it useful!
@Lycanthronaut
@Lycanthronaut 26 дней назад
As a software engineer that uses the standard python and java / C# dabbles, this is like a wizard learning a different school of magic lol, so interesting
@usernameusernameusername12
@usernameusernameusername12 27 дней назад
Wich framework are you using? Great video
@BarneyCodes
@BarneyCodes 26 дней назад
In this video I'm using P5js which is a creative coding library for JavaScript. It uses WebGL, but the concepts in this video should be translatable to whatever framework or shader language you're using!
@pressureswitch
@pressureswitch Месяц назад
As an og space engineers player I love this concept.
@Wkaelx
@Wkaelx Месяц назад
Oh no! I have recivied the power to create an alternate reality in javascript, i shall use this power to conquest the world.
@rrutter81
@rrutter81 Месяц назад
perfect no-nonsense introduction to shaders. The pacing was perfect from start to finish. well done.
@BarneyCodes
@BarneyCodes Месяц назад
Thanks, glad you liked it!
@revenevan11
@revenevan11 Месяц назад
This video is the best one I've found so far. The pro tip around 32:00 makes a ton of sense but I hadn't thought of it yet, glad you caught me writing my if statements lol. For context I've been working on my very first shader today! Coincidentally also in P5js like your examples. I came here because of confusing syntax errors I've been getting and although I'll have to troubleshoot those some more (or maybe explicitly define the webGL version the syntax I've learned is correct for? 😅) I think this is helpful. The project I'm writing a shader for is rendering the mandelbrot set, moving the load to the GPU as an upgrade to my current p5 sketch for it. The current version I already built has scrolling to zoom in and mouse-drag panning support, as well as using arrowkeys to change the canvas resolution on the fly... but especially at higher resolutions it's taking minutes to render, so it's far from responsive lmao. I failed to make the rendering function render asyncronously to a graphics object *and* have p5 move or zoom in on the last rendered frame while the next one loaded though, I guess because it's not waiting for 1 long operation or fetch and only for a bunch of small calculations, so doesn't ever hand control back while awaiting, so p5 just shows the preview change for a split second after the next image finally renders and then immediately slaps the new one it's been waiting for over it lol. So I'm skipping that idea since I don't feel like learning web workers for it and instead going straight to shaders for the real performance gains! Before watching this video I'd already ported over (from JS to GLSL) my functions for complex number multiplication, mandelbrot iteration, checking if points are inside the set (need to change to using step function now 😆😅), and for coloring points based on the number of iterations each complex number takes to escape... I was trying to pass some uniforms into it for things like the number of iterations and user input for zooming, but I haven't gotten it to load once without getting syntax errors 😒. I mean I also haven't finished some of the basic features like properly mapping between the fragcoords to mandelbrot space *while* taking the zoom input into account, but I made a map function for it that I was about to test when I got weird syntax errors while trying to load my shader for the first time. Previously in the non-shader cpu version I was mapping from pixelcoords to the complex plane (within a range depending on the zooming and panning) so it'll be a bit different and I'll need to make sure I don't stretch the image by the aspect ratio again like I initially did in the cpu bound pixel version, but it's a work in progress and the whole point of this project was for fun and learning!!! 😁
@BarneyCodes
@BarneyCodes Месяц назад
Rendering fractals with shaders is a lot of fun and a really great project to get familiar with shaders! If you get stuck, I've got a video on my channel about making a mandelbrot shader ;)
@animaze86
@animaze86 Месяц назад
i still have the opengl programming guide like 8th edition?? opengl 4.3* i think - GLSL shader programming is really fun - and very rewarding.
@Cranky-12
@Cranky-12 Месяц назад
Really cool, I have never seen this done with a SDF. Usually this is done with a regular normal map where you use the normal vectors as offsets. That has the added benefit of not only being able to change the shape of the shockwave, but also give it a texture/roughness. You can generate the normal map from a shockwave mesh in blender for instance. You can then also rotate it etc. It can be really versatile, and be used for instance for heat distortion from a flame. But the SDF approach has the benefit of not becoming blocky/revealing the resolution of the texture if scaled up a lot.
@BarneyCodes
@BarneyCodes Месяц назад
It's certainly a more resource intensive than using a texture, but you can calculate the normal from the SDF. The thing I quite like about this approach is being able to change the shapes, it might not be very practical in a game but I think it's pretty cool hahaha Thanks for the comment!
@CSMHD
@CSMHD Месяц назад
you can do this waaaay faster i mean like 1000x
@CSMHD
@CSMHD Месяц назад
you wanna know how ? think parallel ... draw all distortion on canvas with rgb then distort hole screen at once :D
@BarneyCodes
@BarneyCodes Месяц назад
This method is distorting the whole screen at once using the parallel power of the GPU!
@CSMHD
@CSMHD Месяц назад
I guess i misunderstood the first sentence of the video. You said its in many games. Not like infinite many shokwaves at the same time. I used a similar shader in my game. The limit was 10 fullscreen shockwaves at the same time. B.c. if you want to add a second wave you need to rerun the hole shader on the already distorted image from the 1st shokwave-image. Right? Thats not parallel at all. With my idea you can run 10000 shockwaves as big or as little at the same time all at once.
@CSMHD
@CSMHD Месяц назад
Nevertheless. Damn good tutorial !!
@BarneyCodes
@BarneyCodes Месяц назад
Oh I see! I was wondering about this, and I think with this method you'd be able to do them all in a single pass and accumulate the offsets for each wave before sampling the background image. Interested to hear your idea though for sure!
@alexandrewatrin8293
@alexandrewatrin8293 Месяц назад
Really really well made video thanks
@BarneyCodes
@BarneyCodes Месяц назад
No worries, glad you enjoyed it!
@SombreroMan716
@SombreroMan716 Месяц назад
awesome video!
@critical_always
@critical_always Месяц назад
Thank you, that was extremely useful.
@murrrr8288
@murrrr8288 Месяц назад
w0w!
@4Bakers
@4Bakers Месяц назад
6:34 wouldn't that be a Signed Distance *Function?* I thought Signed Distance Fields used textures instead of mathematical models
@BarneyCodes
@BarneyCodes Месяц назад
I could definitely be wrong on this, but I thought they could be used interchangeably. Your definition makes a lot of sense though!
@deltapi8859
@deltapi8859 Месяц назад
this is an exceptionally well made video. the pace and detail is awesome to reason about the content. Also like the display of "new image" vs "old image". Very well done.
@BarneyCodes
@BarneyCodes Месяц назад
Thank you so much, glad you liked it!
@lachee3055
@lachee3055 Месяц назад
finally, a guide using colour
@motbus3
@motbus3 Месяц назад
Thanks again for one more vid. ❤ In codecrafters as, it is written +new lanGAUges
@BarneyCodes
@BarneyCodes Месяц назад
Whoops! Good pick up hahaha
@motbus3
@motbus3 Месяц назад
@@BarneyCodes my eyes are trained for this specific mistake because someone configured an important variable with this mistake and unfortunately it has been replicated across the boundaries of an API. So everybody is writing lanGAUges because no one wants to update dozen of different repos
@sergodobro2569
@sergodobro2569 Месяц назад
Awesome video! Just what I needed!
@BarneyCodes
@BarneyCodes Месяц назад
Glad you liked it!
@artificiyal
@artificiyal Месяц назад
this is a gem for shader noobs like me
@IceForgeOfficial
@IceForgeOfficial Месяц назад
THANK YOU SO MUCH FOR THIS VIDEO! I always wanted to get started in shaders and this really inspires me.
@BarneyCodes
@BarneyCodes Месяц назад
No worries at all! Let me know if you've got any questions, always happy to help out :)
@dylancope
@dylancope Месяц назад
That was such a high quality video. I really appreciate the time you took to make and animate the diagrams.
@BarneyCodes
@BarneyCodes Месяц назад
Thanks so much!
@ShiftyTheDev
@ShiftyTheDev Месяц назад
Excellent video! Your explanations combined with the animations made it really easy to follow along. Usually shaders can get pretty messy, but you did a great job
@BarneyCodes
@BarneyCodes Месяц назад
Thanks so much! I'm doing my best to make shaders more approachable, so thanks for the encouragement!
@learwin4852
@learwin4852 Месяц назад
Great video ! Been wanting to learn shaders and your videos are of great help.
@BarneyCodes
@BarneyCodes Месяц назад
Thanks so much, that's very encouraging to hear! I noticed when I was learning shaders that there wasn't much beginner-intermediate stuff out there, so very glad that my videos are helping to fill that gap!
@ZiplawDev
@ZiplawDev Месяц назад
really nice video man
@BarneyCodes
@BarneyCodes Месяц назад
Appreciate it!
@SpacEagle17
@SpacEagle17 Месяц назад
As a shader dev, this video is an awesome video explaining complex topics in a very simple and structured way, great job!
@BarneyCodes
@BarneyCodes Месяц назад
Thanks so much, really appreciate it!
@BarneyCodes
@BarneyCodes Месяц назад
What are you going to use the shockwave effect for? I'd love to know! And don't forget to check out Code Crafters and get 40% off! app.codecrafters.io/join?via=BarneyCodes
@purpleshirtkid2732
@purpleshirtkid2732 Месяц назад
I find it interesting that the particles can flow up and down freely, but they only ever move to the left. The cos function implies that the particles aren't restricted from moving right, but they simply never do. Is this because of the way that the noise is generated? I know nothing about perlin noise, so maybe there's a property about them that naturally excludes values in certain ranges.
@BarneyCodes
@BarneyCodes Месяц назад
You're spot on, it's because the noise values aren't very uniform (you can see that in this sketch: editor.p5js.org/BarneyCodes/sketches/xfnID7zDQ ), you can see it's clumped around 0.5, which maps to left with this code. So theoretically they CAN flow to the right, but the noise makes it WAY more likely that they'll go to the left! Not exactly sure what the best way to deal with that is, maybe there's some way to map the values to a more uniform distribution?
@mathvisuallyexplained6839
@mathvisuallyexplained6839 Месяц назад
This is awesome
@Malkovith2
@Malkovith2 Месяц назад
you lost me in the beginning, the information density renders this video useless
@DNAmaster10
@DNAmaster10 Месяц назад
Someone else already mentioned this somewhere else, and you also replied, so I guess I'll just add to the pot: The line between "from-scratch" and "full engine" is often quite blurred. I agree with you that, in a lot of cases, doing things from scratch is often significantly more time-consuming, difficult, and annoying in the long-run. However, I think the subjectivity of the matter comes a lot more from where exactly you start. When you're developing your games, at least as far as I'm aware, you're not using assembly at all. Arguably, you could be going a lot more "from-scratch" if you wanted to, be it machine code, building a computer from the logic-circuit up, or even mining and refining the materials for the computer yourself. I quite liked the sheep and knitting analogy you used, but I wouldn't really say it's fully accurate. I might be able to shear the wool off the sheep myself, but at the same time, I could also buy the wool directly from a farm, while still spinning the wool into yarn myself. I think this can be applied to game dev in many ways, too. Sure, I could write my entire game using a custom physics engine, but at the same time, I could also use a physics library. Maybe I could opt to use a higher-level language such as Python, so that all the memory management is handled for me, unlike with languages such as C. I suppose what I'm trying to say is that it's not a binary between from-scratch and game engine, it's a spectrum between the two. I can go full game engine if I want to, but I could also opt to use a library, such as LWJGL or Raylib, which removes many of the difficulties which come associated with writing a full game engine from scratch. Aside from that, though, I'm loving your channel! It's hard to find non-clickbaity videos where there isn't some guy screaming into the microphone.
@BarneyCodes
@BarneyCodes Месяц назад
Great comment, and I have to agree! I left out frameworks/libraries entirely from my video which may have been a bit of an oversight, they definitely offer a very nice middle ground where you can still get your hands dirty, but you don't need to start from 0. My main aim with this video was just to get people to think about what they are actually trying to achieve and I think in most cases, going from scratch is not the answer! Thanks again for the comment and the kind words!
@lukei9772
@lukei9772 2 месяца назад
THIS WAS SO GOOD PLS DO ANOTHER VIDEO ON 3D STUFF
@BarneyCodes
@BarneyCodes Месяц назад
I haven't really explored the 3D side of things too much yet, but it's definitely something I plan on getting into! I'll be sure to make a video showing what I've learnt when I do! Thanks for the comment :)
@SHAO_L1N
@SHAO_L1N 2 месяца назад
I feel like something like Bevy, sits really nicely in between a game engine and a framework. Its what ive been exploring recently.
@BarneyCodes
@BarneyCodes Месяц назад
I've been meaning to check bevy out for a while now, it seems really interesting! I think a framework (or similar) might be a really great way for me to still feel hands on and code-oriented, without having to do everything from scratch!
@SHAO_L1N
@SHAO_L1N Месяц назад
@BarneyCodes Being code orientated while not having to so absolutely everything is what I really like about Bevy. Also, Bevy docs are simply amazing. Ps. Great video by the way 👏🏿
@PaleyDaley
@PaleyDaley 2 месяца назад
You shouldn't simply add the components together,. You should do height = r*8+g*4+b*2+a which will give you a range from 0 to 15
@BarneyCodes
@BarneyCodes Месяц назад
Haha yea that was a bit of a fumble on my part, turns out you can pack a full float into the colour channels for lossless data. I knew it was possible in theory but wasn't sure how to implement it!
@aaro1268
@aaro1268 2 месяца назад
Godot's got a few bugs but it's pretty easy to get going on! Pronunciation's based on the play "Waiting for Godot", so it's close to Guhdough -- not Go-dot.
@BarneyCodes
@BarneyCodes 2 месяца назад
Thanks for clearing that up! Keen to get started with it!
@kiosmallwood576
@kiosmallwood576 2 месяца назад
Yes. Now I'll watch the video. Edit. Loads of good points. I'm definitely in the camp of build an engine around a crazy concept and see if a viable game can be made, rather than make a game people want to play.
@BarneyCodes
@BarneyCodes 2 месяца назад
That's definitely how I got started in game dev too, always just trying something technically interesting that I wanted to code, then try and turn that into a game. I carried that mentality forward though when I was setting out with the goal of making a game which was a bit silly of me haha!
@luigiistratescu2756
@luigiistratescu2756 2 месяца назад
I loved your video. I totally get you, and I somewhat agree and disagree. Building things from scratch (provided you have experience) is a bit more straight forward because you're familiar with the process. Especially when it comes to 2D games, you can easily make a game without really an engine. I've done it in the past. But using a commercial engine like UE5 or Unity can be sooooo much better ONLY if you already know how to use them. Like you mentioned, lighting, bloom, etc. no need to configure a framebuffer yourself and code it yourself or even tweak shaders, you can just enable Bloom from the game engine option or click and drag a light actor into the scene. But... the downside of an engine is that, very much like programming things from scratch, it takes A LONG TIME TO LEARN THE ENGINE... and get used to it. So, in other words, you're back at square 1. Not to mention some engines require languages you might have never programmed in... such as GDScript or C#... I've only ever done C++. Either way, I don't regret not using an engine because it made me a better programmer. Now I've just installed UE5 and I'm learning Paper2D... Hopefully I can fully transition to it simply because... sound effects and music for free, and letter formatting for free that comes with an engine... as well as other visual effects, ohh that's just so convenient...!!! Less technical work for me to do and more focusing on the actual game! I just subbed, awesome video the way you phrased everything is to the point and very well explained!
@BarneyCodes
@BarneyCodes 2 месяца назад
Thanks for the great comment! Totally agree that there's a BIG investment in learning everything required to use an engine. Hopefully, having done things from scratch in the past, we'll have a good starting point and the transition shouldn't be too painful! There's always a bit of bumbling around when learning something new (like a new language), but I think the more you do it, the easier it is, because the concepts are transferable, it's the HOW that changes! Good luck for your UE5 journey!
@jackfrost884
@jackfrost884 2 месяца назад
interesting perspective
@alfredogodoy6854
@alfredogodoy6854 2 месяца назад
would be awesome if you make some tutorials about gdextension
@BarneyCodes
@BarneyCodes 2 месяца назад
I'll have to learn about it myself first, but if I come across anything cool I'll definitely share it!
@moodragonx2
@moodragonx2 2 месяца назад
Very very cool video. I really appreciate the detailed explanations.
@BarneyCodes
@BarneyCodes 2 месяца назад
Glad it was helpful!
@Jintenzo
@Jintenzo 2 месяца назад
Please take one step back from the camera lol
@BarneyCodes
@BarneyCodes 2 месяца назад
Lol yeah I need to get a wider-angle lens, the one I've got is too zoomed in and I can't go back any further hahaha
@ThePouetman
@ThePouetman 2 месяца назад
You should put visuals of your game in the first seconds of the video, I didn't notice I was looking at one of your videos before I saw the game
@BarneyCodes
@BarneyCodes 2 месяца назад
Oh that's a good idea, thanks for the tip!
@viikoreaux
@viikoreaux 2 месяца назад
Trap that's been luring me in: "Games with bespoke engines are easier to release updates for because the engine can be modified at any time. i.e. EVE Online"