In game development, vendor dependencies (bundling third-party libraries like SDL2 directly into the project) ensures consistent builds across different systems but requires careful management of dependencies, build systems (like CMake), and platform-specific configurations. The decision to vendor dependencies involves trade-offs between build consistency, system compatibility, and project complexity.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
Harsh Reality of GameDev YouTuber
Added:And let's go into the software rendered G game. I think it's somewhere in here.
And maybe I need to fetch the latest shy sim. Unfortunately, I don't really have much time to develop this game because I spend a lot of time making engaging content, right? So, there's a reason why the so-called game development uh game development YouTubers don't really actually release any games because just being a YouTuber is basically a full-time job on its own. So, you don't really have much time to develop your your game, right? So, because of that, the game development of my game goes very very slowly because it's going kind of in the background.
So, uh yeah, because my main activity is uh pumping out engagement slope, right?
Unfortunately, and here sort of like it's it's a pet project to work after uh after your main job, you know, you you have like a main job in a slope factory.
You go into the slope factory uh 9 to5 pumping out slop and at the end of the day after working in a slope factory, you go home, you don't have uh any energy, right? So that you kind of like slowly working on your pet project, but you can't really work on your pet project in a full speed because all of your energy was spent on bumping up slope. And this is basically my situation. So that's why the development goes very very slowly. But it's not like I have any deadline anyway. And it's not it's not like anybody gives a [ __ ] about this game. So it's totally fine. You see what I'm talking about? You see what I'm talking about? Um Interesting opinion. Interesting opinion. Thank you for sharing your opinion. I really appreciate it. It's a very interesting opinion. Thank you so much.
So, yeah, let's actually see what we can do with the game. So, I'm not really sure if it's still compilable. Maybe it is compileable still. Let's actually see. Uh, yeah, it is not even compilable anymore. Look at that. SDL. Oh wow. I actually been using the system SDL the entire time and I recently deleted my system SDL because I wanted to free up some space because I needed to upgrade my system and that revealed a dependency on uh on this kind of thing. So I'm thinking about would it be a good idea to actually bake that dependency right into the game sort of like a JI style. You guys know what I'm talking about? You guys know what I'm talking about? Like because in a J project there's this pattern where you vendor all of the dependency into the into the project and you know commit them and stuff like that, right? And including the binaries and stuff like that, but I never really seen that uh in C projects because I'm not a game developer. I'm pretty sure game developers do that all the time, but not a game developer. So I didn't see that.
Okay. So um yeah, copya file from jol.
Yeah, exactly. This is something. Is that a good idea? We can give it a try, right? So yeah, I think I want I want to try that. Maybe that's going to be the topic of today's stream. Maybe that's going to be the topic. But I'm using specifically SDL2 electric bugaloo, not SDL3.
Uh right. So because of that, we need to find SDL2. Maybe I can do the following thing. I'm going to query lib SDL2.
Um, this is not how you do that. I think this is How the [ __ ] do you do that, Brsky? Uh, so SD uh, how do you It's Oh, it's S. So, and then it's probably SDL2.
Okay. And I want to actually take a look at a very specific thing. I don't remember which one. Yeah. So, this is what I wanted to see. I wanted to see the full description. and it just points at libsdl.org.
Thank you very much. Uh, orphant, thank you. Thank you. Thank you. That's very cool. That's veryformational because if you go into libsdl and in the downloads, you probably won't be able to find uh the SDL2. Yeah. So, the current stable is SDL version 3.4 blah blah blah blah blah blah blah blah blah blah. So, let's try to find uh yeah, fascinating. So I suppose is SDL2 deprecated by the way chat orphant I suppose it's a nickname of the of the maintainer of void it's kind of interesting so there's a wait a second there is a Linux distra called void and main maintainer is orphaned what the [ __ ] is this kajjima writing can anybody tell what um okay so two releases are on the same GitHub Okay. So, let's let's actually see what we can do in here. So, releases. What is this? Pig fiction.
Exactly. Exactly. Um, so yeah.
[ __ ] stop putting LLMs everywhere.
Stop [ __ ] like I swear to I remember I [ __ ] remember somebody who I follow on Twitter but I don't remember the nickname. I really apologize for that.
Somebody like summarized the LLMs so [ __ ] perfectly. Uh they said that LLMs are the asbestous of our time.
They're literally an asbestous. For some reason these [ __ ] think that it's a good idea to shove it everywhere.
Like could you [ __ ] stop? It's literally theformational asbesus.
Um yeah, good metaphor. It's actually perfect metaphor for LLM because they are useful. Asbestas is useful, but you know if you start shoving it everywhere, you're going to get cancer.
It's just like asbestous has like [ __ ] ton of useful properties, but you you have to be [ __ ] careful with it.
um kind of kind of similar with mercury.
I think mercury is also kind of similar in that regard. It also has a lot of useful properties, but you have to be really careful with it. Um especially like from what I heard like mercury was used actively in different electrolysis processes, right? Because it conducts electricity and it's also liquid. Uh so it's it's a very good cathode or anode.
I'm not really sure which one of that, but yeah. So and yeah it's pretty cool.
Um so yeah so this is basically I suppose the two so they they keep releasing them in parallel if I understand correctly right so they keep releasing them in parallel and so at any point like a new two SDL2 release may come in for whatever reason right so maybe bug fixes or whatever all right so let's actually grab this entire thing and what are we going to have in here so oh there's already pre-built things oh that's actually kind of cool maybe because of that I don't I have to build shy myself, right? So, what we're going to do in here, I already have third party. Yeah, boy. Yeah, boy. Yeah, boy.
Yeah, let's go. Oh, it's it's doing things. Okay. Oh, yeah.
So, we've got some Okay, so this is great. This is great. Can I now unpack?
So, this doesn't look like binaries.
This definitely doesn't look Yeah, it is not binaries. And they do not really release binaries. I suppose that's kind of weird.
Uh oh, I remember that chat. I remember that. I remember on one of the SDL streams I sort of like a criticizes that if you download if you download Linux it gives you Yeah, it gives you source code but the binary is only for the Windows, right? Is it still the case in here? Is it still the case? I actually I'm really actually curious. Let's actually see.
It's so [ __ ] weird. But I mean, it's still the case. Apparently, it is still the case. Okay, that's very cool.
Um, okay. So, this is uh Windows.
Yeah, [ __ ] [ __ ] Linux nerds. [ __ ] Linux nerds. And did it even unpack [ __ ] Not quite sure. Oh, it even it even pooped all over the place. For [ __ ] sake, Brovski. Right. So, didn't even freaking Why are you like that? Why are you like that all the time? Okay.
So, what we're going to be using for building sh what we're going to be using for building sh. So, maybe it's we have two options, CMake and auto tools. Um, it's it's so funny to me like, man, uh, wasn't CMake created so you don't have auto tools? But now I see open source projects being shipped with both auto tools and cmake.
[ __ ] roll out SKCD for 14 standard situation like we have lost.
Uh yeah, pick your poison. Okay, so let's actually see uh what we can do in here. Um and by the way, maybe what I have to do is more more of like this, right? So we have to move this stuff in here. Uh right. So maybe I have to put that into src. Uh like that. And maybe just maybe similar to how we do that with J we need to have something like generate C which is going to include knob right and knob located. Okay. So this is the current folder. We go up and knob is somewhere here. So you have to include knob.h in here. So I'm going to do knob implementation.
That's a very interesting. So we're basically adapting J patterns into C and knob. That is fascinating, isn't it? Isn't it? I think this is rather fascinating. So we're going to do knob uh go rebuild yourself or CR or V.
And here we're going to have CMD. CMD what? Chat. cmd what?
Okay. And now uh what we need to do in here is cmd append uh then uh cmd and so yeah we probably need to create a folder first right so make deer if not exist make deer if not exist and it's going to be something like src that and uh something where is src something like that I didn't fully copy [ __ ] okay there we go this is build Right. And if it doesn't uh you know if it throws an error, we're going to do something like that. Right. I'm going to go go and just try to do something like this. I'm going to say generate. Generate. C. Does it compile? It does in fact compile. Let's do generate. It created the folder, right? It created the folder in here.
And does it exist? It does in fact exist. It's an empty folder. What we want to do now uh we want to run cmake.
We want to run CMake uh in that specific folder. But I remember on one of the previous stream Kamikadza was running around and screaming in the chat, use the big B flag. Zoen, Zoisen, use the big B flag.
Maybe the time he Let's give it a try. I never heard about this flag. I never heard about this flag, but let's give it a try. May maybe this will simplify everything. Uh, so where is CMake? So, let me take a look at the B flag path to build. Oh, it's literally just a path to build. That's that's great. And what else do I do here? Not even quite sure. All right, let's let's just give it a try. So, essentially, we're going to do cmd append. And in here cmd C make then B.
So then we're going to do cmd run uh cmd and if it doesn't succeed I'm going to return one. Let's actually see what is going to happen. So uh does not appear to contain is that because of the so src and then you're telling me that third party and this is uh now needs s okay so that that means not enough flags path to source Okay, sure.
Why is everything so complicated, chat?
Why can't I just build the [ __ ] Why are you checking each individual function of math? Are you okay?
Okay.
Sack seed. Sack seed. Okay. So, we've got some shy here. Miner. Get some shy.
And uh yeah, I suppose the next thing we need to do is to [ __ ] build this shy.
What's the now command to build?
Right. So, how can I say? Okay, now go [ __ ] build. So, build build parallel.
Okay, that's pretty cool. Thank you so much, Comic Cuts. I think I really appreciate you. So, uh let's actually take a look at these flags. Let's take a look at the flags. So, today we are learning CMake. That's what we're doing today. Um right, so let's take a look at the build. Right. So, build project binary directory to build. This is required unless a preset is specified.
Have no idea what the [ __ ] is preset?
Don't give a [ __ ] So, uh, parallel.
What is a parallel? Let's take a look.
So, the, uh, maximum number of concurrent processes to use when building if jobs is emitted. The native build tool default number is used. Okay.
So, I suppose it just tries to determine by uh, you know, the amount of cores, the amount of CPUs and stuff like that.
Okay. Okay. So the CMake build parallel level environment variable if set specifies the default. So native build views single we we'll see. Okay. Okay.
Fine.
Okay. So let's cmd append cmd append cm make uh right. So this is going to be build and I suppose we have to specify this thing. Uh and which means that we starting to dup duplicate some stuff right? So, we're starting to duplicate some stuff, which means we need to factor it out. So, let's call it uh build folder. Uh, let's call it build folder and grab this string literal.
This is a build folder. This is the build folder. I'm going to put the build folder in here. I like to put um leading uh slashes at the end of the folders in here. I think it's kind of nice. Uh, and now I also have to do a cmd append parallel. That's what people tell me.
But is it going to utilize all of my cores? Does anybody know? So, is that something that is going to utilize all of my cores or do I have to explicitly say how many cores it needs to utilize?
Does it automatically pick up? Um, good. Good. Good, my comrade. Uh, yes.
All of them. Okay, that's great.
Uh, so now uh, uh, let's go ahead and just try to see.
Oh, it's building. Holy [ __ ] sh my new friend.
Yeah, it is building. It's pretty cool.
It's pretty cool. Thank you so much for all of the subs, Nitrix Dev, and all of the other people who was giving my money, but I'm not going to get them. So the new Lenel in Louis see they even said um so something two years go and I don't know see today I turned 18 uh years old and now the [ __ ] I'm watching you for two years you are still the best programming streamer.
Thank you for thinking so. Uh I'm very glad that people think that I'm uh I'm a good programming streamer. I suppose it's kind of cool. Um, anyways, so we've got these things, right? So, lib SDL2 and there's also so a Mr. Chunk James, thank you so much. Hello from my channel. Hello. Hello. So, you're using some sort of art. Why there's so many subs today? What happened month ago, guys? What happened month ago? Dot 92.
Thank you so much. Hola from Italy.
Hello. Hello. Thank you so much. Okay, so we got the um things. I suppose we've got the things and those things are what things are what. So this is the build and inside of the build we have the so stuff and the static library. The static library is rather interesting. So, which raises the question which one I want to keep?
To be fair, to be fair, chat, I don't really think I need a dynamic library in here because I'm not programming in J.
You know what I'm saying? I'm not programming in J. And uh because of that, I don't need to run this entire thing at compile time. So, I might as well just actually link this entire stuff uh statically, right? So but before I can link a statically I suppose one of the things this script must do it must copy the file um that was generated right so and if I remember correctly in knob.h H we do have a copy file. Look at that. So there's literally a function copy file. So what's going to be the source? Uh we probably have to do build folder. And within the build folder, we're going to have lib SDL2A. I think that's what it was. I think I'm pretty sure that's what it was. Lib SDL. Uh lib SDL2.A.
Okay. This is really great. And we're copying it in here. uh lib sdl2.a a little bit of a duplication in here yet again. Maybe we should factor it out into some sort of like a macro or something like that. Don't feel like doing it right now though. All right.
So, and it, as you can see, it copied it in here. And there we go. Here is the thing, though. We don't have the includes anymore. Maybe we need to have them somewhere. Uh, right. So, here's includes to be fair. Okay. So, I feel like instead of doing all of that [ __ ] it would have been probably better to set up installation prefix and let it install somewhere here. Right. So, like right here. What do you guys think? Just set up the installation prefix and whatn not. And what's the installation prefix?
What's the installation prefix? It's somewhere in the in the cache probably.
So, prefix. Yeah. So here is the install prefix and as you can see in here it's just like you know user local which is not usually what what you want in here.
Okay. So cmd append cmd. So we're going to set this thing to I don't even freaking know right. So I want to kind of pick the full path right the entirety like the full path the full current path. And as far as I know in the knob I do have that right. So current working current. Yeah. Yeah. So there you go. So there is this function that takes the current working directory. We can even try to run it. Let's actually return zero in here so it doesn't continue doing this kind of stuff. And we're going to log this entire thing. No log info. I'm going to put this stuff in here. And we're calling this function.
And let's see what is happening. And this is the full path, right? Can can you see shy? There you go. You can now see. So this is the full path. And uh so we can basically say okay install that [ __ ] into somewhere uh it's going to be something like that.
So this is going to be s and just do sdl2 to dist right. So this is maybe even something just dist right and so we can use tmps print f right and then put this stuff in here and hopefully it is going to do thing. So, I want to actually test something, chat. I want to just test something. I'm going to actually put a return zero in here. Just configure it. And let's take a look.
Yeah, there we go. So, this one looks like it is a correct thing. So, it was saying something weird, but nobody gives a [ __ ] Okay, so we're not copying stuff anymore, but after we manage to build it, we also have to install it. And I suspect by analogy, there is some sort of an install flag. Am I correct? Okay, I already look at the chat and I see that. Okay, people.
You You guys really enjoy this kind of streams where you can box back seat in a in a in a back chair. All right. So, uh let me take a look at this kind of stuff in here. So, Chad is currently sitting in in that in that chair. So, this is going to be install. Yeah, there we go.
So, cm make install. Might as well. Um, I suppose I also have to specify the the build folder. Oh, install is just Yeah.
So, you just do install in here.
Install. Okay. Let's [ __ ] go. So, three commands and everything seems to be okay. All right.
Okay. So, it's kind of cool that it just Yeah, it probably basically did incremental build. All right. And there we go. It just created that. So, here is the bin. It even created SDL2 config.
Right. So we even have SDL2 config. Uh I can even specify different like flags what kind of C flags I have to put in here. And since we have an installation prefix it uses installation prefix correctly. But I feel like I don't really need that. All right. So in terms of libs we're also linking. Yeah. Look at that. So these kind of flags only make sense if you're going to be linking dynamically. So it tries to set our path and stuff like that. But what if I want to build statically? Is there any even way to say okay static libs? Okay, I can see that static libs. Static libs. And in terms of static libs, okay, so that's just just a usual thing, right? Just a usual thing plus uh P threads plus uh math and so on and so forth. But apart from that, I think I don't need this SDL2 config because I kind of know where all of these things are located. Here is the includes and stuff like that. That's very cool. Here is the libraries that we want to link with and everything. Uh, and u yeah, so this is additional like licenses. Uh, this is localization of some sort. I don't quite know what the [ __ ] is that. We don't really need that anyway. Anyways, so and the size of this entire folder is actually 13 megabytes.
Not that much, honestly. Not that much.
I think we can live with that. Maybe in the future we're going to even have like a several of these binaries built for different operating systems. But ideally for the game, by the way, I wanted to use the minimal amount of dependency.
Basically on Linux, it would depend on X11, right? So on Windows or maybe Whand depends on what kind of stuff you use on on Linux, right? So because some people use X11, some people use Wayand. But by the way, uh aren't X11 applications work fine in Wayand? because they have some sort of a mechanism to sort of you know have backward compatibility. So does it even make any sense for me to support whalent apart from making engagement content? Yeah.
So X wayand but it's a bit broken. I see Wayand comes with XY and X1 server for Whand.
Interesting interesting interesting interesting. So maybe I can just like make an X11 application and let the nerds do the rest of this stuff.
Well, it is simpler maybe, but I'm also not doing anything complicated in X11 anyway to be fair. Okay, so in X11 at some point I'll need to use uh shared memory extension and shared memory extension in X11 is a pain in the ass. I already tried to use it and it was crashing all over the place. If it is simpler to do in Wayand, I would be actually happy. So, so anyways, let's continue.
Uh so uh yeah so there's this readme uh that is left from here. So here's the distribution, the binary and stuff like that. And so let's go back to the main application, right? So here's the main application and it's not buildable as you can see. And I don't even have Oh, yeah. So there is no pulse audio to link with. [ __ ] All right. So this one is going to be kind of kind of pain in the butt. But maybe for now I'm going to actually disable it. So where are we building the platforms? We're building the platforms somewhere here. And this is the X11 pulse platform. So, let me for now disable this entire thing. Let's not build it for now. I'm going to focus on that a little bit later. All right.
So, X11 uh pulse build is broken for now.
Something like that. Okay. So, let's focus on X11 in terms of X11. Uh right.
So as of right now, we're just linking with SDL2. But what I feel we have to do, we have to explicitly say that we're linking with this thing. Uh furthermore, maybe we should start with actually providing the um include paths to to where all of that is located. Uh as far as I know, I think there were paths and here is the third party folder. All right. So this is the third party folder. within third party folder we have SDL2 this is the distribution and there should be some sort of include in there so hopefully now it's going to fail with linking error okay this is fascinating because linking takes a little bit more time now but maybe that's not what I think it is okay third party uh SDL2 distribution in uh yeah yeah so that that's that's actually correct okay so I had a little bit of a brain for so what we need to do in here we have to put L uh and then lib 64 that's how it works I suppose right so this is going to be distribution uh lib 64 and it doesn't even it doesn't even seem link to lib these days right doesn't even seem link all right so is it going to link yeah it's taking some time to link but apart from that I think it successfully did that so game SDL2 two it's actually 4 megabytes as you can see but in terms of dependencies it doesn't depend on things that much right so it doesn't depend on things that much so uh do we have any flags okay so yeah there is a run flag and let's try to run it and see if it's going to work now how well is it going to work okay so it failed to initialize some [ __ ] so this is a platform uh some stuff in here and what it did it do okay it couldn't initialize something, right?
Which is rather interesting and I wonder what exactly it couldn't initialize. So, one thing we can try to do, one thing we could try to do, we could try to uh uh basically initialize only video and see if it's going to actually fix that.
All right.
So yeah, could not initialize. Audio system is not initialized. Mhm. So it actually went through, right? It actually went through and I'm thinking, yeah, how do I play this sound in my game? I remember there was some audio.
Okay. Oh, okay. I see that. So there is a Yeah, there is two buffers in here.
the game display buffer which contains the pixels right in RGB32 and stuff like that and there's a audio buffer which contains samples. So basically when the platform pulls the frames out of the game it also pulls the audio samples right so the game itself doesn't really care what kind of like audio system you are using in here uh and so now um yeah we can try to maybe temporarily disable audio system. So this is escapture. So maybe I'm going to do something like that.
So yeah, this is basically audio stuff.
Do we have any other? So why doesn't uh Emacs?
Oh, you can't have nested freaking C.
So in C, you can't have nested multi-line comments, don't you? Can like can you I don't quite remember. I think you can't have that. I think they never really fixed that or did they fix that because it's such a simple easy thing to to do. Uh right. So I don't quite remember. So it's going to be a basically hello like that. And then if I try to do something like this, it is not going to compile.
Stinky boomer language for [ __ ] sake.
And it's not even that hard to do. You just have a counter in your compiler.
You have a counter. You encounter this [ __ ] right? So this specific prefix, you increment the counter. You encounter it again. Encounter it again, you increment the counter. You encounter this thing, you decrement the counter.
You encounter this thing, you decrement the counter again. That's how you know what to cut out. Such a simple [ __ ] computer science problem like a first year CS problem. Balancing parentheses.
Ken Thompson, Dennis Richie. What the [ __ ] Do you know CS computer science? First year so [ __ ] easy. But I suppose it's it's not them to blame, right? Standardization committee hookah. Just add a [ __ ] counter in a [ __ ] compiler.
So [ __ ] easy.
Sorry.
I need to calm down.
Right. So we're going to be using something something else in here. So we're going to say if zero, right?
And if and if All right. So, where is the next audio shy? This is another audio shy my friend. Do we need to do anything else in here? I suppose not. All right. So, zero uh zero maybe. And if and there we go. Right. So, I'm compiling the wrong thing. So, is it going to compile now?
Are you going to compile now, [ __ ] It is compiled.
It doesn't produce any sound but it is working. It is to working and it is using the internal SDL right. So our own not the one from the system but yeah so that's the thing. So, uh, you can't really die at all, which is kind of sad, which is kind of sad. You you you will go down forever, right? You will go down forever. And unless you reload the whole or restart, I think just slow. Oh, yeah. Just load.
I just remembered it. I just remembered it. And I wonder what the [ __ ] is wrong with this entire [ __ ] Why audio didn't work? What do you guys think? Why audio didn't work? Maybe it just didn't properly uh it was not properly configured or something like that. Maybe that's what happened. Uh maybe that's exactly what happened.
Why don't you have Alsa in your system in the first place? Don't I have Alsa? I don't [ __ ] know. Like I do. I look like somebody who knows anything about Linux. Um I have no idea. So, like we're going to go ahead and figure out what the [ __ ] is going on in here. So, uh let me see. Let me see. Uh now, uh what we need to do in here.
SDL mixer. You don't need SDL mixer just to play sound, my friend.
Did you know that? Did you [ __ ] know that?
SDL couldn't find it. Well, I don't know. I didn't pay attention to the configuration. We're going to in in we're going to investigate that. Chill out. Chill out, my friend. Let me take a look at the configuration log. All right. Um, so maybe I'm going to even do something something different than here. So, we're going to maybe not build it, but just configure it. Just configure it. Uh, all right. So, this is going to be built. So let's remove that one more time.
Time.
All right. So let me see. Like why does it check all of that stuff? I suppose maybe it's used in so many different operating systems that there are some environments where like literally there's no log function or whatever.
Okay. So what does it say? What does it say?
Uh there's a lot of things in here. Um, so Elsa couldn't find Elsa. Fascinating.
It couldn't find Elsa. Does it have anything about pulse audio? So pulse audio is wanted on but disabled. Can I just do pulse audio? Oh, it was saying something about pulse audio, I think. Yeah. No package lip pulse. H. No package lip pulse. So we probably But do I install it systemwide? So why don't I have it though? That's kind of weird. Query or as lip pulse? Yeah.
Here it is. Or is that because you want um No, it seems to right. So it has to be 9:15.
And this is kind of like a 16.
And there is no deaf package in here either. So which is kind of weird.
Uh so there's a pulse audio devil, right? So featureful general purpose sound server development files. Maybe that's what we have to do. All right. So I suppose maybe it would have been easier to actually install SDL systemwide, but yeah.
uh lip pulls deaf for Ubunt. Thank you for very useful information. Anyways, so let me let me grab this kind of stuff. Uh Xbps install SU and let's install pool. It's kind of like interesting that I'm vendoring SDL but I'm not vendoring pool. Like how do I decide at which level I'm vendoring, how much I'm vendoring and stuff like that. That's a very interesting question actually. How do I even [ __ ] decide that pulse? Oh yeah, it's it is on now. So, uh, Elsa salsa. Okay, so this is Pulse.
There we go. So, we suppose the reason why I didn't find Alsa, it's not that I don't have Elsa. I probably don't have the development files for Salsa, right?
So, it's kind of a different situation.
I probably do have Salsa. Uh, right. So, yeah.
Well, maybe maybe I don't. Right. So, but there is a mixer which is kind of a part of salsa, right? So, this kind of salsa thing and I don't [ __ ] know.
So, anyways, uh let's go ahead and try to maybe uh build this entire thing fully. So, do I have the distribution [ __ ] right? Do I have the distribution [ __ ] So, we're building, by the way. We are building.
Should have used pipe wire. Dude, I don't give a [ __ ] Like these freaking nerds keep invent reinventing the same [ __ ] over and over again. Uh I think I started to use Linux way before even Pulse Audio was a thing when Pulse Audio was conceived.
Like why they keep coming up with all of this [ __ ] Like can you just chill out and just like calm down?
It's like why do we need so much [ __ ] No, it's it's going to be perfect this time. It's going to be perfect. Just just just another service. It's just another service. It's going to be perfect this time. Yeah. Yeah. Uh so released 2004 I think. Yeah. So I think in 2004 I didn't have even a computer.
Uh right. So but I suppose I remember when I started to use Linux like pool audio was not even discussed that actively. Maybe it was not widespread.
All right. So but it's just like it's it's a very old thing. just just can you just settle down on some on a single thing. All right. Can you just settle down on a single thing and start writing actually useful software? Um all right.
So we build this thing. It's it installed that shiser. Okay. That's very uh very good. And now um I suppose I can try to do a very interesting thing by the way in SDL2. Um yeah we can do something like a SDL.
uh let's say platform platform SDL2 audio support right so we're going to define this kind of thing the audio support and um so essentially how we're going to do that it's going to be interesting if defined audio support you just do something like that right so if it's not defined we're going to do something like that right so platform SDL2 audio import uh just going to be video. So then if zero Mhm. if def platform SDL2 audio support okay platform um SDL2 audio support. Okay, that's cool. So I'm going to go now here and let's just try to do this kind of stuff.
Okay, so watch your if death [ __ ] me chat. How could I make such a mistake?
It's Eve defaf bravkis. So, let me let me see. So, it is faf in here as well.
Let's see if it's going to run now.
Is it going to run now? And it is running as you can see. So, let's actually check the sound. I'm sorry for your ears. I didn't expect that it's going to be this loud. Uh, I'm so sorry. Um, so was it too loud?
Uh, [ __ ] you. Well, I mean, I I I really didn't know that, so I'm sorry.
Uh, very badass. Oh, um, it wasn't that bad. I suppose it it depends on on the on your volume, but it actually showed like a red in my in my audio thingy. Uh, so yeah, I'm so sorry. Um, I did just Yeah, picked out. Uh, okay. So, we'll get this thing. And if I take a look at the um at this stuff, yeah, it doesn't depend much on like on things. doesn't depend much but I suppose since I installed lip ples uh like poll development things uh what we can do now we can reenable x11 polls build as well right uh so because I have a version of the game that uses x11 and polls directly without sdl2 right but that's not that one so uh let me take a look so there was a platform form uh yeah so this is a P and I think I can do something like list in this specific case yeah so then I can say run but the platform is X11 pulse right and the FPS on X11 pulse is actually much lower as you may notice and there's some other problems in here especially with the cursor this is X11 by the way directly uh without SDL and also by the way this is a legit no open gel, right? So in SDL platform, we cheat a little bit. We cheat just a tiny bit.
We create an open gel texture, right? We still rendering everything into the uh like on CPU into the memory, but then we take that stuff, put it into the texture and then bleing the structure through OpenGL and stuff like that. It's a little bit cheating, but here this is no cheating. This is how software rendering looks like without like using OpenGL at all. Um, but the problem here is that look how slow it is. Just like bleing it like that is very slow because it's transferring each individual frame over the X11 wire thingy, right? Because X11 is just like a unique socket, right? So the the applications connect to this unique socket and they like literally transfer each and individual frame. The way to speed it up is actually to use X11 shared memory extension. Yeah. Yeah.
So there's no shim in here, right? So essentially the idea is that the um client application and the server they create shared memory, right? And so the client application renders everything into the shared memory and the server now can directly take that frame without sending it over the unique socket and stuff like that and just display it. I tried to set it up but I just the API is very finicky uh and it was kept crashing and I couldn't figure out why. So because of that for sort of like testing I'm using like the SDL version which uses hardware acceleration through OpenGL but we're still not rendering on GPU right we're using GPU to display it but we're not rendering the game on GPU.
Uh yeah, and because of that, it's just still 100 FPS, right? So, it's pretty fast. Pretty cool, actually. It's pretty cool what you can achieve in here with just that with just that. Uh, and here's the thing. So, okay, I just vendored SDL2.
Okay, that's cool. But to build SDL, I still need lib pulse. I still need lib x1. Do I vendor them as well? If you if I want to be this sort of like a game development purist who when vendors everything and just isolates himself from the entire world and so do I vendor X11 elite pulse as well? Do I go as far as doing that? So that's the interesting question. Yeah, vendor the whole Linux and with Linuxes is it's especially kind of difficult uh because different Linuxes are like literally different combination of different things. Like what the [ __ ] do you even do in that specific case, right? Maybe we can vendor Gilip, right? So uh the game bootable CD wasn't who was that was it Casey or somebody else who said that Doom the first Doom was essentially its own operating system, right? So it worked outside of DOSs, right? And it just like shipped with all the necessary code to make the keyboard work, to make the mouse work, to display things. It's just like it's its own operating system.
Maybe we can go that route, right? So the game is literally its own operating system.
So uh isn't Docker vendoring Linux? I guess. But I mean it still need Linux to work. Um do DOS doesn't have much OS uh in it besides FAT driver. Oh yeah, that's true. Actually DOS is not even really real OS.
So essentially what it does it just loads a program into the memory jumps into that program and there you go that program is on its own right and so it may provide some I think routines loaded in the memory that the program the client program can jump to right and it's usually for working with the with the disk and that's why do stands for disk operating system right it just provides stuff for for working with files But apart from for that I think that those applications were on their own and if you needed some sort of multiprocessing I suppose they the processes has to organize themselves they had to jump between themselves right so explicitly and from what I can remember like the first windows applications they were you know yielding themselves manually right and because of that it was very easy for uh for the application to basically take control accidentally over the whole thing and just lock the entire operating system.
So, by the way, doesn't Jai vendor X11? Wait a second.
Doesn't Jai So, there is a X. Yeah, in Jai, right? So, speaking of game devs who vendor everything, there is a X11.
Okay. And so in terms of lib x11, uh I never show lib x1. They're using a system one. Look at that. They're using a system one. How about that? Huh?
So I suppose John stops at that level, right? John stops at that level. So he doesn't vendor li1. He uses the the system one.
Interesting. Interesting. Interesting.
Does it have pulse anywhere in here?
Doesn't really have pulse. Anything about the audio? Nothing about the audio. But if we take a look at the SDL, SDL from what I can tell is vendor.
Right. So here the could have I could have copied the binaries from J as somebody said in the I think somebody said in the chat that I could just copy the b the binaries from uh yeah. So it's kind of weird. It's kind of like a philosophical sort of debate. At which point do you stop? At which point do you stop? It's kind of it's kind of funny. Uh stream for almost one hour. Uh for almost one hour.
I like UX approach. Uh design a small VM code for it and implement VM for target platforms. Yeah. But uh obviously like it has a limitation in terms of complexity of the game that you can develop, right? So yeah. something like Java. Yeah, but but with Java is just like I don't know a sufficiently complex application in Java is not crossplatform.
So have you guys noticed that? So any sufficiently complex application in Java is not crossplatform because they usually end up having some sort of like a native platform specific DLS and whatnot. LW [ __ ] I I swear to God the people who invented this library they were C people like who names things like that I like the rhetoric consoles if I'm going to take that approach since emulators are so ubiquitous yeah that is true actually that is true so I remember who said that the most crossplatform applications are dos application because there's uh dos emulators literally for every platform so if you write targeting doss your application will literally literally work everywhere on Windows, on Linux, on Mac OS, in web, on some obscure devices or anything like that.
It will literally work everywhere if it's doing some useful work. It is insanely crossplatform.
So anyways, so we've got this [ __ ] working without installing SDL2 directory. We probably want to commit this entire stuff, but I'm not quite sure. Let's actually remove this thing because I didn't think it is needed in here. So, there's some unttracked files.
Let me try to recompile one more time.
I kind of losing my voice actually. Kind of losing my voice. So, the level editor is still working, which is kind of cool.
I'm really happy with this level editor actually. It's really cool. like that.
We can can change things can change some things around like that. Maybe make it a little bit brighter and whatnot. Yeah, it's pretty cool. Um, so this doesn't mean anything. It's just like for testing. It was literally just for testing. So, we probably need to commit this entire stuff, right? And I don't know, do I want to basically ship the source code? I'm not really um I'm not really adding any modifications to SDL2. Maybe because of that I don't want to commit the source code. Yeah. At the same time, it's kind of hard to tell. It's kind of hard to tell.
So, what do I want to do about that? Do I want to commit it or do I not want to commit? Anyway, so I'm not going to commit it just yet. Let's work on something. Uh so let's take a look at the amount of tasks that we have in here. Uh we have quite a few tasks uh which are open currently. All right. So which are open currently. Uh 98 of them, right? So we can take a look at what kind of flags tags do we have in here.
So we have some stuff to work on the editor on a renderer. Some sort of bugs.
There's 10 bugs in here to work on. Uh we can take a look at the editor, right?
So, what do we have for the editor? Uh, right. So, what do we have for the editor? Separate entity sets between the editor and the runtime game. This one is interesting, but I'm not really sure if it's it feels like it's a little bit too much work. So, essentially, I can show you. Um, so what's the problem in here?
Separate entity. So, let let's actually run this entire stuff.
So, if I go in here, um, where are the coins?
H, we used to have coins in here. Do you guys remember?
But in any case, uh, so coins went somewhere. Did I remove them?
Essentially, uh, look at that. Um, yeah.
So we have the item. I can't really change its scale right now in the editor. But uh so it is present in the editor and it's present in the game. So there's two states in here. All right.
Editor game editor game editor game. But if the in the game I select this item, right? So I just just grab this item and select it. It disappears in the editor as well because they share the state which is stupid, right? So which is something they haven't fixed yet, right?
Uh so yeah, something something that I didn't fix yet. Uh and uh maybe yeah, we could work on that, but I feel like it's going to a little bit of a like a grind a grind work going to be some sort of a grind work and I'm not really sure if it's going to be interesting to watch. But honestly, going back, where the [ __ ] are the coins? Where did they go? Did they remove them at some point?
Did they [ __ ] remove them, broskis?
Um, I'm not quite sure. I'm actually not quite sure. So, anyways, let me uh maybe commit whatever the [ __ ] we have on here. Uh, let me commit. And this one.
So, I feel like if I remove this thing, I'm going to lose um the information about the version. But we do have information about the version in here.
All right. So, what I'm going to do um I'm going to say something like download the sources from here. Like that. Uhhuh.
So and in here I'm going to remove them like that. So I remember this kind of pattern in J as well right. So they basically have a generate but essentially they say that we don't ship the source code download and like a release update and whatnot. And I suppose this is because uh so the SDL license doesn't affect whatever license of this code or whatever.
add wget to knob. Nah, don't want to do that. Honestly, I don't think I want to do that. So, let's actually remove that. And maybe I'm going to get ignore um g ignore a few things. What I wanted to get ignore, I wanted to specifically get ignore generate and generate old so it doesn't get committed. Okay. So, now let me see.
Let me see. So, how we're going to commit all of that stuff? I'm going to say, okay, um, all right, different vendor, uh, SDL.
Oh my god, SDL2. And what was the version two? Something something um, nope. C. Where is the Yeah, there we go. SDL2 23210.
Let's go. And I'm going to push that right into the rip. I think it's going to take some time. No, it was actually pretty pretty fast. So I committed that to Colgor. Okay. So the question is uh at which point did I delete the coins, right? For example, if I go one month ago, right? So one month ago and I try to run the whole thing.
Oh, I can't even run because one month ago I I was using the system SDL. So I can't even bisect this situation without installing it.
So classic. Yeah.
All right. So, let's I guess let's install SDL dependencies. I I didn't want to install them.
I didn't want to install them, but yeah.
Yep. SDL2.
Uh what am I doing in chat? So, let's take a look. SDL2 and there was a SDL2 devil. Yeah. All right. So, let me see.
Xbps install SL2 Devil. Now, let's see what's going to happen.
Yeah.
Okay.
So, let's actually see.
All right.
There you go.
coins.
Let's bisect this [ __ ] Let's bict it. Let's bisect it. Um, so coins do exist. And let's actually see at which point I keep forgetting like how to bisect, right? Because you do that so rarely that by the point you need to bisect a thing again, you [ __ ] forget how to do that. So it's one of these annoying things, right? So bisect uh yeah start I suppose right so I do start okay waiting for both both good and bad commits okay so we're going to be bisect uh good and I suppose good is the current revision right so uh yeah I'm going to grab this one so this is a this is a good one so waiting for Batman bisect bad. Um, right. And then, oh my god, it's this is the bad one.
Okay, so uh five revision left to test after this roughly. Okay, so let's go and just do knob run.
Mhm.
Okay. Get bissect bad.
Mhm. Next one. Next one, please.
Coins get bisect. Good.
Um, roughly one step I suppose. All right.
Mhm.
Bad.
Um, okay. So, roughly zero steps tweaks.
So, I suppose that means it it finished, right? Tweak the level a little bit.
Okay. So, tweak the level a little bit.
Kind of checks out if you think about it, right? Kind of checks out that I deleted the coins in a commit that is called tweak the level a little bit, right? So, if I do bad. All right. So, yeah. So tweak the level a little bit.
That's the commit. And it Yeah, it changed only the hardcoded level. And I literally just Yeah, I literally just deleted some [ __ ] in here. Uh it will tell you the first bad commit when it Okay. Okay. So here it is, by the way. So yeah, so tweak the level a little bit.
So let me take a look at that.
Uh yeah, so it was somewhere here and it was literally just just that. We can go ahead and maybe revert this commit.
Yeah. So let's just revert that. And if I now try to run the whole thing. So we're linking with the vendor SDL2, right? And the coins are still there. So the reason why I want you to to have coins is to demonstrate that you know you see you collect the coins in the game they disappear in the editor. So I'm just a little bit afraid that it's going to be a little bit too much time and effort to uh implement that. So I think I'm going to postpone that. So al also LS editor usually I have another tag in here which is for streaming right. Okay. Explore using ray casting for selecting objects in the level editor. Mhm.
So, yeah, that would be kind of cool thing to stream, but I feel like if I'm going to be doing that specific topic, it has to be topic for the entirety of the stream so it's easier to market on YouTube if you know what I'm talking about. Because if I'm going to start working it in the middle of the video, nobody's going to [ __ ] watch the video just for that specific topic. It has to be a separate session. So, yeah.
Uh let's actually see something else right so let's actually see something else better snapping for several selected entities that is based on whatever the first one uh then yeah so do you guys remember this problem do you guys remember this problem so essentially uh maybe yeah maybe we can work on that as well right so today I think it's a good thing to work on thank you so much for all the subs thank you so much for everyone who I missed as well. So, hey, how are you? I'm doing fine. Uh, Antonio, the game will be running on potato now. Not really. I haven't optimized it yet. How sader vig Thank you. Thank you. Thank you. I'm sorry if I missed anybody. I'm sorry if I missed anybody.
Okay, so this one is an interesting problem. We can work on that uh for for today's stream, right? So because doing third party dependencies, vendoring third party dependencies is probably not particularly satisfying. It is easy for people to watch, right? So because it's just kind of a very simple thing to grasp, but at the same time, it's not providing any value for the game. So essentially, we have a mechanism of snapping things around, right? I probably already talked about it multiple times. So I can move around an object like that. That's cool. But that's not, you know, aligning it to anything. So when I press control, I can actually snap it to a grid, to a particular grid. Okay. So that's pretty cool. So, but if I select several of them, and I can move several things around, right? I move several things around and I can snap several things around. Uh it works fine if all of these selected objects are basically aligned with the grid. But what if they are not right? For example, I can move this thing around and it's kind of unaligned.
But then I select several of them and I move them around and then I decide okay start snapping these things according to which it is going to snap. It is clear that it's snapping according to this one. But what if I want to snap it according to this one? What if I want to use this one as the pivot? So as of right now, it's using uh only the first that it kind of got from the hash table as a pivot. But I think as a level designer, as a level designer, I want to have a little bit of a control over what is considered pivot in this specific case. You know what I'm talking about?
You guys understand what I'm talking about? I'm sorry for being this annoying, but yeah, that's kind of the problem, right? And I have an issue for that. I have an issue for that. And uh yeah, I think it could be an interesting problem to solve.
Okay. So, let's go ahead and do that.
Let's go ahead and do that.
Uh now um yeah so let me do editor and so I even outlined a couple of like sort of ideas in here. Maybe sniping should be done by the average position. I don't like the average position because again I kind of want to have a little bit of a control, right? So or by the smallest or the biggest position or maybe introduce the notion of snapping anchors exactly what I was talking about a specific entity within selected entities which we snap by. This introduces complexity of managing such anchor. Right? So that's kind of the problem in here, right? That's kind of the problem in here. Man, I love this issue tracker because it's it's kind of cool to dump some, you know, some thoughts in there, then come back and you kind of recover that. Um, you kind of recover that. So I suppose, and it's not something new if you think about it. It is not something new. I think in Inkscape, which I [ __ ] deleted. I deleted so much software on my system because I needed to upgrade it and I just didn't have enough enough space.
Okay.
Um, do we have like a Inkscape uh app image guys? Is that a thing? Is Inkscape app image a thing? Because I don't want to take my root space.
Uh download current stable Linux.
I like up images honestly but from what I heard the developers of the applications absolutely hate making them which is kind of weird.
So I haven't ever created an app image.
People who have created app images, tell me why you hate them. Because from the user perspective, I absolutely love them. It's so [ __ ] amazing. I just download like single XZ and it just works. And but the developers of this thing, they trying to avoid them as as a fire. Uh they don't work on Alpine. Is that the only reason?
Is that the only reason why people avoid them? Because they're so [ __ ] convenient from the usual perspective.
It's just like holy [ __ ] Uh, it's just like Okay.
Mm- I don't know. It's kind of It's kind of weird. It's kind of weird.
Um, the spec is a bit unwieldy, I think.
I guess they use fuse, but I love them.
Uh, yeah, it's hard to package as far as I know. But honestly, like again, if from the user perspective, it is make makes the user's life easier, who the [ __ ] cares? Why are we trading the convenience of the developer for the convenience of the user? Like in which economy this is an acceptable strategy?
I don't quite understand.
It's just like I don't imagine providing a service and imagine saying I want to provide a worse service because I don't feel like it's a bit hard today. It's just like it's kind of hard. I don't want to do that.
because of that the service is going to be degraded and it's just likeh what where is the customer is always right thing where did all that go so [ __ ] the customer I guess it's just like I don't [ __ ] understand anyways uh I'm going to pour some water I probably should chat chat you know what What I should do? You know what I should do? I should try to create an app image on the stream just to get an idea why developers [ __ ] hate them.
I should give it a try myself.
Maybe that will reveal uh you know the reasons I will understand the situation better because maybe right now uh I just like don't see that. Right. So yeah, I'm going to actually put that too to the list of my ideas.
Okay. Can you [ __ ] Broki? Um yeah, there we go. Uh idea.
Okay. Make app image on the stream.
Maybe at some point we'll get back to that. Okay. So yeah. Yeah. So what I wanted to say I already downloaded the app image and if I go into the downloads uh here can you see sh but yeah you can kind of see it. So here it is. I can probably move that inkscape app image to my opt. I'm going to go into opt. Look at that. And I can now uh chode plus x.
I can make it egg executable. And then I just run this entire thing and it runs.
This is exactly what I'm talking about.
Look how [ __ ] convenient it is. I download it in XZ, right? And I just run it and it just [ __ ] works. Why all of the software on all of the operating system can't work like that?
This is the like this is the end. This should be end goal of software.
One single file. You download the file, you run the file, it [ __ ] works.
[ __ ] sake. No, my my DX my developing experience is suffering.
What? Okay, so we're going to do app image at some point and I just want to see for myself how badly the developer experience is degrading. Just want to see for myself. Maybe it is that bad.
Who [ __ ] knows? Uh so anyways, so what I want to say, okay, thank you.
Thank you. New document. Thank you.
Thank you. Thank you. What do I want to say? Uh so if you have a bunch of shy right if you have a bunch of shy you have selected several things. Ah I think in inkscape it's not a really a thing.
I think it's somewhere in the blender.
I think it is somewhere in the blender.
Yeah. Uh so essentially we can start a blender. Why not? I think I have a blender somewhere in uh I wanted to download Inkscape app image anyway. So I I just did that on the stream. So now we have a Inscape app image. Um so I have a blender somewhere here. I suppose here is the blender blend that here is the video editor. So we can add a bunch of strips in here. Uh right. So essentially this is different color strips. Uh right. So you can assign different colors to them and what they do they just like display uh different colors. Right? So instead of particular images or whatever, right? So and essentially I think I can maybe zoom in a little bit on them. So you can actually select several of them but look at them. Uh so one is has an orange frame and another one has a white frame.
And then I can actually switch between them with while keeping all of them selected. Okay. So let's actually create another one. Right? I select all of them. One of them is selected with white. The rest of them are selected with orange. And what's funny is that you can't probably see that stuff, but there are some properties of the strips on this side uh on this side. And when I modify some properties, it modifies the property of the one that is selected white but not all of them. And then later then later you can actually press this thing and then uh press on copy to select it and it will propagate that specific property to all of the selected elements in there. So it's kind of like a similar UX problems that was solved by Blender and we all know how Blender solves UX problems which is probably not a good example but I kind of like how it is solved in here. So you see the strip can be selected and can be not selected when you have selected several of them within the selection there is some sort of a sort of like a pivot right this is what I'm talking about I think something like that could have been solution to the problem that I was talking about you have several things selected but one of these things among all of the selected is an active thing is the pivot and it's a very similar thing in here do you guys understand what I'm talking about Um yeah multiple selection but only one is active right. So Blender developers already had to face a similar problem and they already kind of solved it in this specific way. Selection inside of selection. Yes. Some sort of like a subsection but it's but you don't have multiple subselections within a selection. You have only one thing you can select.
Modify every selected object. No primary selection at all. Go away. You didn't watch from the beginning. You have no idea what the [ __ ] you're talking about.
Okay.
Um, so let's actually go ahead and try to see what uh the [ __ ] we need to do in here.
Uh, now let me try to do that. Um now okay so we have selected selected selected um if I remember correctly um we can uh game C uh and let's do editor. So what do we have in here? What do we have in here? So here is the whole thing.
So here is the hash table selected entities. It maps the entity index and it's a index within entity component system. Okay. To boolean which indicates that this this entity is currently selected. So it's essentially not a hash table but a hash set. Right. So we have a boolean indicated that the selected entities are currently being uh dragged.
And that's totally understandable.
Yeah. This one is interesting. So start position of whatever first dragged entities.
This one is very interesting because that's basically the anchor. That is basically the anchor and the way we compute that anchor. Uh let's actually see how do we set it. Yeah. So we set it from the entity. We take the position from the entity and that entity is taken from whatever first selected entity index, right? Whatever first selected entity index and whatever first selected entity index is that we take the hash set and then we take a key of whatever first selected entities. Yeah. So in a hash table you can literally just take the first whatever element in a hash table because the problem with a hash table is that the order of the elements within a hash table is not defined. It is literally not defined and because of that if you take whatever first it will literally give you whatever without any regard. I suppose it will give you the one with the smallest hash which is not particularly useful information right it is useful for the hash table right it is useful for the hash table but it's not useful for you uh right as the game designer or whatn not so because of that we have to introduce the notion of a anchor right so and I suppose instead of this thing we're going to say start position of Uh yeah of whatever first dragged entity position of anchored uh and of dragged anchor entity right start position of the dragged uh anchor entity. That's the start position. Uh this is a new position of dragged anchored entity.
Mhm.
And the reason why we keep track of them is that we know the delta between them so we can snap things a little bit better. So it's it's really needed for the uh for the computation of snapping and stuff like that. So drag the anchor entity, right? So this is a drag anchor entity. Uh and by the way, here is the task we are working on right now. I even left a sort of like a to-do in here. We can even go ahead and grab the whole thing throughout the Yeah. So there's the only place where we sort of refer to this entire thing. And I think I'm going to just like delete that. So we need to now keep track what is the anchor. So selected um anchor entity. Yeah, something like that. You have a set of selected entities. You have an indication that selected entities are being dragged and you also have uh a selected uh anchor entity which is that specific enter an anchor what we consider the anchor entity in this specific case. The problem of storing the state of the selection like that is that what if this variable points at something that is not in that hash table.
This is very interesting. So essentially uh you can get your entire state of the selector and you can think about this entire thing as a sort of state of the selector within the editor. uh right so it can get soft locked you can get in an inconsistent situation when you have an anchor as something that is not within the selected entities so you have to be aware of that you have to have mechanisms that kind of sort of recover from these situations if these situations ever happen and this is what I meant about additional complexity right so this essentially the complexity of managing such anchor That's that complexity. What if your state goes into inconsistent becomes inconsistent and now you have to recover from that every time you do something, right? But anyways, so I modified the name of this variable, modified the name of this variable that breaks the code in all of the relevant places where we deal with the sort of like the first whatever entity. Now the time of the compiler assisted refactoring going through all of these places and sort of making it use this selected anchor entity and whatnot.
Let's [ __ ] go. Let's [ __ ] see how miserably this entire [ __ ] fails. How many errors we're going to get.
As you can see, we failed. Great. Cool.
Okay, this one is easy. So this is basically initialization of the editor.
So we have a function editor reset. We want to reset the state of the editor.
Very easy. We have to set all of these things to nothing. Right? So, start position of of dragged anchor entity and uh new position of dragged and an anchor entity. But we introduced uh a completely new field in here. We introduced selected anchor entity. And as far as I know, we don't really have new indices or anything like that, do we? I do not quite remember. Do we have null indices? I don't think so. Um, so yeah, for example, if I'm I don't quite remember. I think we don't have a null indices. So that means it can be whatever. I suppose we can assume that selected anchor entity is just invalid if nothing is selected.
Okay, so there's nothing to really reset in here. But we may want to come back to here if I you know remember how to how if if we have any sort of like a null indices or not. Um by the way in the entity component system based on indices do you usually have null indices or invalid indices to indicate some sort of error or anything like that? Is that a thing? Uh I feel like it's not right. So usually it's just indicated maybe in Rust it would have been indicated through some sort of optional or maybe in other languages without optional it would be indicated through some sort of a boolean or whatever right anyways whatever nobody gives a [ __ ] so let's go to the rest of the computition errors usually the zero syntax is handled to something empty uh that doesn't answer any more questions. Okay. Um so yeah this one is interesting. So when I press G, right, when I press G, that means I want to drag it around. I'm kind of like I stole this particular key from from Blender.
So in this specific case, right, so whatever first selected entity, whatever first selected entity instead of whatever first selected entity in here, we have um editor selected anchor entity. Here it is. But the first thing we need to do, the first thing we need to do, we need to check if it exists within the hash table. So I don't quite remember how to use that within the hash table. So it's going to be HT and I think it's something like HT find. Yes. So essentially, right? So essentially what you can do, you can take uh editor selected entities, right?
So editor selected entities, right?
um probably by the pointer and a key is a selected anchor entity, right?
Selected anchor entity and if it does exist, right, if it does exist, we should do something about it, right? So, we should do something about it.
Uh if it doesn't exist, right, so for example, it's equal to null, we should pick a new one, right? This is what I'm talking about. So for whatever reason we just get selected anchor entity that is not in the hash table. So we have to do something about it. And I suppose the way we do that is by yeah uh whatever yeah whatever first selected we can reuse this code actually. We can actually reuse this code. This is fascinating. So I'm going to just keep it like that. So everything below that is probably going to be removed, but I'm going to be referring back to it. Right? So I'm taking whatever first. I'm taking whatever first. And if it succeeded, if it succeeded. So now the anchor now the anchor is the key.
Okay. whatever code I had before for picking whatever first selected entity, it is still useful. But here is the thing. Here is the thing.
Uh otherwise, if I couldn't find whatever first selected entity, that means nothing is selected. That means there's nothing to even drag around.
That's what's funny in here.
there's nothing to drag around. So in this specific case I would like to sort of return but out of this block but there's no such mechanism in uh in C right there's no such mechanism in C because of that we need to check uh that we have any selected entities up front essentially what we probably have to do we have to do if selected entities count is greater than zero only then do all of your shenanigans and stuff like that and just declare this situation basically you couldn't find first whatever selected entity as unreachable.
Uh there is always a selected entity.
There should be there should be always a selected uh entity to pick uh for the anchor. You see what I'm saying? You see what I'm saying? Right. So essentially you press G. We check if there's any selected entities. Uh right. So then we check if the current anchor is with selected entities. If it is not, we pick whatever selected entity and set it as a anchor. And if you can't pick whatever selected entity that means this condition is incorrect. This is literally unreachable state and we need to check for that. You see what I'm saying? This is very like you have to be super careful. You have to be super careful.
All right. So uh what are we doing? What are we doing next? So that means that after this condition after this condition there is always a correct anchor there's always a correct anchor and uh so that means what we need to do in here we need to uh mark that the entities are currently being selected right so then we grab the anchor entities so we take the entity pool and within the entity pool we are picking the anchor entity. We're picking the anchor entity. So this is the anchor entity and we're set we are using its position to set the start position of anchor entity and the new position of anchor entity and so on and so forth. So that's what we're doing in here. Uh right. So we're going to put it in here like that. So start position off. And I suppose what we have to do in here, we have to do something like um dragged anchor entity. And so we finally transformed old code into a new code.
Let me double check. Yeah. Yeah, I think we we transformed everything in here.
There you go. So this is what we've got in here. That's pretty cool. So you have something to select. we do this sort of like a fall back that I was talking about, right? So, and I feel like we'll have to copy paste this code multiple times in multiple places. Every time you want to try to access an anchor, right?
Every time you want to access an anchor, we'll have to copy paste this code multiple times. Maybe we'll have to factor it out into a separate function uh to sort of call before even try to do anything with an anchor. So that's like ensure anchor is correct. Ensure anchor is consistent. See what I'm saying? But anyways, so this is a very important like piece of code. Next error. Next error.
Kind of a similar situation, isn't it?
So this is when I'm copying uh a bunch of selected entities, right? So before we were working with dragging the selected entities. So I can even take a look at them. game SDL2. Uh, right. So, you can have a bunch of selected entities like that. Right? So, I press G and I'm dragging it around and then when I press C as it is in this code when the C is pressed, it copies them, but it kind of acts like dragging them around because it basically duplicates all of the existing entities and it uh effectively, you know, drags them, right? So drags a new uh set of entities in here like that. So that's basically what's going on in here. Uh okay. And here we up front already checking that there is something selected. Okay. So there's a to-do in here. Probably move this new selected entities array to editor structure. Don't want to have too many local static variables. Better keep them all explicit especially in multi-threaded program. Wise old Zozen wise Zoin from the past actually wrote this comment. Thank you so much Zozen.
That is true. So this is a new selected entities and so essentially we just iterate all the selected entities. We duplicate them right and we create a new sort of thing in here. So selected entities.
So we clone the entity and we append that thing to a new selected entity.
That is totally understandable. So then we ht reset selected entities, right?
And we put new selected entities back.
And we're doing this sort of thing in here. Okay.
Uh so what we need to do in here chat, what we need to do in here chat is that we also well we need to ensure that the anchor is correct, right?
We still need to ensure that the anchor is correct. And I feel like Oh, bisecting is still in place.
Okay.
Still bisecting.
Um, let's try to disable bisecting without, you know, killing the whole thing.
Uh, bisect help. All right. So, I suppose yeah, there is a reset. Uh, you know, reset. I hope it's not going to kill all of my modifications.
Oh, it was trying to do that.
Okay, so they're still there. I'm going to try to stash them. I'm going to try to do get bisect reset. Okay, seems to be fine. I'm in a wrong place.
Let me go back to main.
All right.
I hope that now when I pop the stash, it is not going to cause uh merge conflicts.
Thank you, Lunos.
[ __ ] sake. With Git, you never [ __ ] know. You you you never [ __ ] know. It might have caused Yeah. saved.
Could have been a total disaster. Could have been a total disaster. So, uh yeah.
Yes.
Freaking this one. Um, yeah. So, what I want to do, let's go back.
I want to factor this [ __ ] out to a separate function because it's it's very useful.
I just want to be able to call that and don't worry about it at all. I want to be worrying about that at all. So where should we put that and how should we call that? Uh game editor um ensure selected anchor is correct is valid something like that.
All right.
And so what we're doing here uh so we just check that selected anchor is um so essentially if it returns something right so that means it is correct uh we might as well even do something like this just get rid of this entire [ __ ] and return out of it right right away. Then um if it is um you know not within selected we pick whatever selected entity right and if it is pickable uh we just do something like that. So this a very simple function game editor ensure selected anchor is valid and yeah that's basically that that is literally that and that's pretty good.
Okay. So now instead of doing this kind of stuff, let's go game editor ensure selected anchor is valid.
There we go.
Okay, cool. That is pretty cool.
So we have that. Uh now I'm going to try to compile it one more time.
So in here, right, we probably want to do this kind of stuff right away. Game editor ensure selected anchor is valid.
So I I still want to put some comment in here. Uh just explaining what's the point of the function. So in case of the situations when selected anchor entity is not within um within the set, right? So selected anchor entity is not within the selected entity set.
um we want to automatically pick uh the next appropriate thing. So for example, when you unselected something, right? You unselected something and it needs to pick the next uh the next anchor.
Because of that, by the way, chat, this is epic. Why not make this function return the [ __ ] anchor?
So basically game editor selected anchor and this is a entity index and essentially right so if yeah it just returns you the selected entity. So basically it's sort of like this guard which also automatically falls back This is kind of cool. And by the way, you can have a situation when the selected entities are empty. So, and this is where you want to do an unreachable situation. No entities entities are selected. So, you do not reach for this thing uh you do not reach for this thing uh manually. You just call this function. And by the way, in here, right? By the way, in here, you probably want to return this thing because of that. I guess it makes sense to just do something like return null or write equal to null. You do that and you have only one unreachable situation.
Yeah.
But uh count equals your check is not left outside. This is count left check because if your count is equal to zero, this thing will return null.
that is equivalent to count greater than zero. So and this is basically where unreachable comes in. We could have returned an empty entity index but as I said I don't have such index. Yeah. Uh so yeah and because of that we don't really need this comment anymore but we need a different comment. Um so selected selected anchor entity uh do not use selected anchor entity directly uh directly uh call this thing.
It ensures that the anchor is always within the set of selected entities.
Yeah, because of that I'm going to now rename this variable. So it now fails within all the places that I use this variable in. So I just call to that function. Okay. So this is how you design API, right? So slowly, methodically, logically trying to you know get to a better design so to speak.
Okay. So uh yeah here it is fine to use this thing and here it is fine to use this thing as well.
Uh okay. So and obviously in in this place too.
Okay. What else do we have in here? So we don't have this function anymore. Uh, and what I need to do, so I use this thing only kind of once.
I would like to maybe call it an anchor entity. Uh, so game um, editor. What was that? Selected anchor. Yeah. So, we do selected anchor.
Uh, then if it's nothing is selected, it will obviously crash. That's totally fine. we uh get the pointer within the entity pool. Uh then we do all of these things. Uh right. So this one has to be like a anchor entity and this one is a anchor entity. Ah it's just an editor.
I'm being a little bit silly but that's fine. Being a little bit silly but that is fine. Okay. So that's another place.
And in this specific place none of that really matters. None of that really matters.
Uh but this one is still a little bit difficult because we need to clone the set of selected entities and the anchor.
Because of that, I have a feeling that we also need to do something like new selected uh anchor. How did I call that function?
Oh boy. Oh boy. Oh boy. Oh boy. So selected anchor entity, right? So selected anchor entity and it is an entity index.
Yeah. So it is not initialized but we can basically just put a zero in here whatever.
Okay. Okay. Okay. Okay. So as we are iterating the select well it's not zero right? I mean yeah it is it is zero whatever. Um I'm just afraid that I'm iterating the table but I'm not modifying the table.
So that's fine. So I'm iterating selected entities then I get the index.
I clone the entity and adding it in here. And another interesting thing, if index is equal to game editor selected anchor, new selected anchor, new selected anchor should become the new index, which also means that I have to do it somewhere here.
Look at that.
Look at that. Look at that. Look at that. And I feel like you can't compare entity indices through equals equals. I think this is not going to work.
Yes. Well, I mean I also forgot to program TJI too much. I'm sorry. Program tier too much. Yeah, you can't compare them like that. So in entity.h, do we have equals equals?
We don't. So there's literally no way for us to compare the indices.
Uh so but it's not that difficult, right? So here is the boolean entity equal right so it going to be entity index a uh entity index b right so we have something like that entity c right so let's put that stuff in here and just return a so a single entity index consists of value and generation so this is a value and a generation V generation like that.
Okay, that is very cool. So because of that here we need to do entity equal something like that. Entity equals something like that. What else? Okay, another one. Another one. Uh and also we are resetting selected entities. We're resetting selected entities and we're copying new selected entities back which also means that you need to do editor um what was this selected uh anchor entity is equal to the new selected anchor entity like that. Right?
So we're doing this a little bit of a round trip.
a little bit of a round trip, but we don't need to do any of that stuff anymore. So, essentially, this goes away.
Selected entities are being dragged.
Then, game editor selected anchor and this is an anchor entity. Start position of um dragged anchor entity. This is the anchor entity position. There we go. So, we integrated this kind of stuff.
Furthermore, as we are rendering the selected entities, we'll have to indicate the anchor somehow. It would be rather interesting to do that. But yeah, we'll see. We'll see. Okay, the next compilation error. All right, the next.
Okay, so uh what's that? So this is a pretty big ass.
We're getting to the real meeting here.
This is rendering of the editor. So you have a huge ass if condition. If selected entities are being dragged, we're doing one thing. If they're not being dragged, we're doing another thing. And it's a two huge conditions in here. Look at that. This is fun. This is going to be fun. Right. again. So if the selected entities are being dragged, we have 77 lines of logic, right? In C, if the entities are being dragged, we have another 53 lines of logic, right? So, and this is entirely imperative code. No OP, no FP or anything like that. But at the same time, it's so freaking straightforward, right? You literally have two branches.
Are you being dragged? You're not being dragged. Here's two huge blobs of logic what on what to do and it's pretty straightforward serious software. It is rather kind of serious like it feels like blender in some aspects. All right.
So this is how it feels like like how much code do you need to describe logic of this particular editor that can do [ __ ] like that. It can snap around, right? Like it can actually move up and down. You can clone it. You can do [ __ ] like that. How much logic do you need to describe this kind of stuff? Um, it's honestly 70 plus 50 lines of code is not that much logic to describe that. In my opinion, to be fair, if you ask me, it's not that much. Like, come on. Right.
Boom.
So, then we can go here. And here are the benches.
Here.
So, that's pretty cool. It's pretty cool. Um, yes. Yes. Yes. It would be kind of cool to be able to just like, you know, select sort of like that. But I haven't implemented that. That will require another 70 lines of code.
I ran out of I think I ran out of liquid.
But anyways, chat. Anyways, all right. Let's go to the rest of the compilation arose streaming for almost two hours. Okay, that's totally fine. Uh so one more time, what is this logic? When we are being dragged, when we are being dragged, so whatever first selected entity. Okay, so there's a pretty huge logic in here. H fascinating.
So if uh for whatever reason yeah something is being dragged and we end up with a situation when there is nothing in the selected entities we automatically set this thing to not being dragged which means that this condition probably goes like this. So this goes away right this goes away and here we simply check okay is count greater than zero right so for example we ended up in a state that selected entities are being dragged all right do we have anything selected though if we don't have anything selected selected entities are not being dragged very simple logic right and an ability to jump to sort of like corresponding curly braces is very important right to sort of navigate that logic. I think it's very important.
Okay. So, we know that we do have something selected. So, in here what we're trying to get, we're trying to get the anchor entity. So, that means that in here what we have to do, we have to do game uh editor selected anchor, right? And this is an anchor entity.
Very cool. That's very cool. So, we got an anchor entity. So what we do with the anchor entity, we get anchor entity position and then uh the current anchor entity position and then we subtract the start position of that anchor entity.
Mhm.
So this kind of creates a very interesting situation.
It's going to create an in very interesting situation.
What if during execution of this function when we are kind of yeah we were trying to get the current anchor entity we didn't find it so we pick a new one.
So do we need to update the start position of whatever first drag the entity and not start position this is a very interesting question right so yeah know what I feel like we should not do this kind of [ __ ] we should not do this kind of [ __ ] What we should do instead, we should simply just check uh assert this specific condition and that's it.
Right?
Because I feel like this behavior trying to fall back will first of all hide some of the bugs and introduce a new one. So, I feel like if this kind of situation occurs in this specific place, that just means it's a bug and you need to fix it and it's better to just crash when something like that happens.
Yeah. So, okay. So, but it it's you still need to do that through a function because you you need to check that every single time you try to access that anchor. Assert the front avoids that possible bug. Yeah. Yeah. So yeah. So the the logic kind of evolves over time.
Okay. So essentially what we can do um we can do unreachable uh invalid anchor.
Invalid anchor. So you take selected entities selected anchor is it correct?
Okay we return that. So it's very important to check that. Very important to check that kind of interesting. It's kind of interesting how this function evolves over time and and it evolves along with my understanding of the problem. I really like that actually.
Kind of cool. But anyways, so uh okay.
So this is a start position of whatever uh of dragged anchor entity. So this is anchor entity and this is its start position and this is difference. Okay, this is very cool. After that I'm iterating selected entities and for each selected entity right I basically sets its position as the as that difference between the start position of the anchor and the current position of the anchor.
That's basically what we're doing here.
Okay, that makes sense. I suppose that makes sense. Okay. So, so we have vertical dragging new position of whatever first of Uh-huh. dragged anchor entity. That's understandable. Next one. Uh so, new position of uh dragged anchor entity.
Uhhuh. And this one dragged anchor entity.
What's next one? Uh, might as well in this specific situation, uh, just maybe do a little bit of Emacs magic, but I kind of want to manually go through all of these errors, uh, because it just makes me feel a little bit more confident with what I'm doing. Uh, drag anchor entity.
Okay, new position over drag anchor entity.
Mhm.
So far so good.
And we did it.
So essentially I feel like nothing changed.
It's not budgeting yet. It's not budgeting. Um we don't have a visual indication of the anchors. First of all, we don't have a mechanism to set a new anchor. And do we even have okay when I'm adding a new selection, who should become an anchor? That's a very interesting question. So, if I try to run it, I bet it is going to crash on that unreachable assert that we edit when I try to sect anything. That's my bet right now of what's going to happen.
Let's give it a try.
Um, so we kind of outlined the feature. We kind of outlined the feature, but I don't think it is currently working. So if I try to select Okay.
Well, that's interesting.
Okay.
Aha. This is very cool. It crashed when I tried to drag it. Look at that. So this is great.
This is means that every time we add something to the selected entities, we need to maybe set the anchor somehow.
Yeah. Uh so selected entities.
All right. So selected entities and ht add or put. Yeah, that's what I'm talking about. Okay. So this one is interesting. This one is interesting. So if you have selected entities, if selected entities are not being dragged, right, selected entities are not being dragged, we're iterating through all of the entities, right?
Uh we're iterating through all of the entities and we have a basically click on the gizmo of the entity and gizmo of the entity is that square thingy, right?
So for those who doesn't know, for those who are new, that thing, this square, we call it gizmo for now, which is kind of stupid, but I mean that's that's what it's called in here, right? So this is a click on a gizmo. So you got clicked on a gizmo. So depending on whether you're holding shift or not holding shift, different things are going to happen. If you're not holding thing and you clicked on the gizmo, we unselect literally everything and we selecting that thing that you just clicked on. Honestly, in my opinion, after you selected a new thing, uh you probably need to also set the same entity to the anchor, right?
So, you selected the first ever thing.
That thing becomes an anchor as well.
Makes sense to me. Anyways, so then you have shift. you holding a shift and if you clicked on the entity and you're holding a shift and that entity was already selected, that entity isn't selected.
If it was um not selected, uh we selected something like that.
It's kind of interesting.
Okay. So, and this is how multiple selection is implemented. So, you're holding shift and you basically select several of them. So I feel like when you select a new entity when you select a new entity what you have to do you have to set that newly selected entity as an angle something like that. So then we have a situation with unselecting an entity.
So we probably need to check if the uh unselected entity and the entity that you need to unselect is equal to the anchor and if it is equal to the anchor you must pick the next anchor. So that's basically where you have to do this sort of like conditional right. So you unselect it in anchor. Uh and you now need to pick the next one and you need to do that uh fall back mechanism that I just removed.
Um so many ifs. Quit tech. You're not going to make it.
Sorry. Sorry to tell you that.
I'm going to pour some water.
All right. So, the easiest thing here would be to copy paste that code though.
What if you unselected the last one? Um, what would you do in that specific case?
Okay. So let's try to find that code of yeah. So we need to do whatever first selected entity then the next one. So this is the three lines that we have to do in here and I forgot the last line something like that. All right. So if they are equal right and you need to find the whatever first selected entity. All right. And then what you're doing, you effectively set the anchor to whatever first selected entity. Something like that.
So it will just set it to whatever. But it would be kind of cool if it was setting them in opposite order as you selected them.
Would it be not quite sure though?
But what if you maybe have a well yeah you always need a uh need a anchor.
Okay, so it always speaks an anchor in sort of like a hash order which is kind of annoying but maybe like I don't see a better solution to be fair. I didn't see a better solution. So there's a little bit of duplication in this sort of situation. Right. So and I'm not sure what to do about that. Really not sure about what to do about that.
Apart from that, that's basically the logic that we have to maintain in here.
If we [ __ ] up anything in this specific logic, that unreachable thing should fail as soon as possible hopefully.
Right.
Okay. What else do we have in here? So, selected entities. Um, what you didn't like? Oh, it's because it's um it's a boolean.
Yeah, that selected entity is actually entity index.
Yeah. So, probably have to do something like that.
All right. What else do we have in here?
Okay. We're almost buding, boys and girls. So, essentially, I think we are basically back at functionality. I can drag around. I can snap. I can copy.
Doesn't crash.
Visually nothing changed in the behavior but internally now we have an anchor.
Now we have a notion of an anchor and it will be kind of nice to display that anchor. Now would be nice to display that anchor.
Now how do we display the anchors? Yeah.
So we have this function editor gizmo that checks whether the gizmo of a particular entity was clicked and on top of that it renders it with different I suppose color and what not right so for example selected you have a boolean which tells you whether edit thing is selected or not maybe we need to introduce several kinds of gizmos so essentially it's going to be in enumeration gizma state. Um, let's put something like that. Gizmo unselected by default, right? So, selected anchor.
So, what am I doing here? Uh, and here we're going to have gizma state and this is a state. And depending on the state, it's going to probably render it with a different color. And I want the anchors to be not only different color, I want them to be different size.
Gizmos and gadgets. Yeah. So, we kind of picked whatever name for this thing. Uh, yeah. So, hovered and selected are kind of the same color, which is kind of funny, but okay. So, on top of that, we have effective size. Um, and effective size.
Yeah, this one is interesting.
So, this is 20. Uh I'm going to put it like that. Where is my thing in here?
I'm going to do uh switch upon the state. Right. So we have a switch upon the state and there's a a gizma uh anchor. Right? So an anchor I suppose max state has to be 30. Right? So essentially it's a because depending on the distance of the gizmo we also scale it differently. So the gizmos that are too far away they're like tiny, right?
So the one the closer they are bigger.
Because of that we have to set like a different color in here. So gizma um different size gizmo selected and unselected right selected unselected are the same size which is 20. Uh right so the max size equal 20 break and by default this entire thing obviously is unreachable.
So this is unable gizmo state gizmo state like that.
So this one is uninitialized. I can initialize it with zero. All right. So this is that and the color it all very much depends right. So for thing being not hovered uh we are kind of picking the same color.
But what if it's um yeah, let me try to think about that.
So this is unselected color, right?
Unselected. We can do a similar thing in here. Switch state.
All right. And let's just go back in here. Copy paste this entire logic.
Copy paste this entire logic. So essentially when something is unselected the color is blue. Color blue. If something is selected Mhm.
or Howard, it is going to be red. So I'm going to put this thing in here.
Oh, this one is interesting. So essentially if um hovered while unselected and hovered it is red.
Okay. So that's basically the logic I was trying to come up with in here.
Okay. And now anchor. Let's use green as an anchor. Like I'm basically pulling these colors out of my ass. So I'm not really sure what's going to be the best.
But it's it's all developers things right. So they have no artistic value.
Uh so just like whatever.
Um okay let's go to the calculation. And now yeah selected entity passing boolean. Yeah. So this is very interesting.
So selected um you have to pass a gizmo state in here. Right. So this is a gizma state.
Uhhuh. Gizmo state. Gizmo state uh which is an interesting question. Okay. Is something selected? Right. If the thing is selected, right? If the thing is not selected, gizmo state is unselected.
Gizmo unselected.
If it is selected, if it is selected, uh we need to be careful. Is it equal to the anchor? All right. If this thing is equal to the anchor, the gizmo is anchor. Otherwise, it is just selected.
So that's basically the whole logic. A little bit involved, a little bit kind of weird, but uh that's what it is. All right. So that's basically what we have.
Okay. Um, you still need to Oh, [ __ ] Okay, so you need to be aware of this stuff.
Mhm.
Selected entity. Okay, that's fair.
Selected entity.
Yeah, it's kind of Yeah, I feel like it could be compressed somewhat, but I'm not sure.
All right.
And now, well, that's Oh, it is not being displayed um when we're dragging around unfortunately.
But as you can see, yeah, there is an anchor in here.
There's an anchor.
Okay. So, let me think. Uh, when I'm dragging things. Yeah. So, here is the thing. Thing is not being dragged. When the thing is being dragged, when the thing is being dragged, uh, what? How do we even display [ __ ] So, the where? Okay, here is the editor gizmo, man. So, we probably need to now. Yeah.
freaking C boolean that I hate it. I hate C honestly because I changed the signature but because C is a boomer stinky language. It didn't tell me that a boolean type. Yeah, exactly. So, let's go through all of these things. So, this is a gizma state. Uh, and we probably will have to copy paste this thing a couple of times now though. Yeah, it all depends. Maybe, maybe not. Okay. So, let's go through that. I'm pretty sure there's only two places. Yeah, we know that everything is selected but um depending on uh different things whether the current thing is an anchor or not.
So this is a index and if entity equal index editor selected um well anchor entity right in that case we draw gizmo gizmo anchor gizmo anchor otherwise otherwise gizmo selected so that's basically what needs to be done here.
All right. And it seems to be working.
So that fixes that bug with dragging. So which is fine.
So as you can see it is fine.
You can then select and it picks whatever different. Now here is an interesting thing. Uh I want to now change the anchor. And I want to change the anchor. How we're going to be doing that?
This one is going to be interesting. So that will add more conditions in here.
So yeah, you can we probably want to do something if shift is pressed, we do one thing.
Otherwise, if for example control is pressed because I want to use shift to unselect, which means that I want to have something like control to switch the anchor.
Okay. So, here is the control. So, if both of them are pressed, that's an interesting situation, honestly. Um, yeah, actually, let's make it so both of them are pressed. Yeah. So if control uhhuh if is key down key control we're going to do one thing otherwise we do the usual thing.
All right.
Uh so and yeah and you have also two situations is it selected entity or is it not selected entity. If you hold in control, right? If you hold in control uh and it is not a selected entity, it is not a selected entity.
I suppose we select it and set an anchor to that.
And if it's selected, we just set an anchor to that, which means this condition has uh duplicating parts which can be factored out.
which also means that this thing can be simplified.
Okay, so that's that's pretty cool.
Mhm. So, and people say that there's a lot of ifs, but this is because the UI logic is as complex as this code.
If you sit down and try to describe the logic of the UI of how UI should behave, this is the most direct description of how it should behave. You cannot make it shorter, concise, more beautiful. This is literally the direct description of how UI should behave. The gizmos was clicked. Was the shift key down? If it was not, we unselect everything.
Whatever was clicked becomes new selected. Was the shift down? Okay. Is the control down? Control is not down.
Was the entity that you click just selected? Okay. You unselected. But did you unselect the anchor? If you unselect the anchor, you have to pick an X anchor. If you clicked on not selected entity, that is selected. Now, this is the most direct description of how UI should work. And if you think it is too complex, again, quit check. I'm really sorry. I'm really sorry to be the person to tell you the bad news.
So, it's just like Yeah.
Nothing much to say. Honestly, nothing much to say.
Okay. So, what do we have?
So yeah, I selected a bunch of things and now I hold control and I change this thing. Okay. So if I hold control, if I hold control, it selects the new thing.
So now the interesting part. Um, now the interesting part, the trick I was talking about. So, I move this thing around and I move this thing around. But now I'm going to kind of clump them all together and I select select both of them. Right now I'm moving the stick around and as you can see it is snapping according to the anchor. Now I change the anchor. I'm moving it around and it's snapping according to the new anchor.
There you go. I can now select to what like what's going to be the anchor of of snapping for a very specific group of objects.
Thank you. Thank you so much. Thank you.
Yeah. Again, it is complex. Like I do agree with that. But I mean, if you really sit down and try to describe what the UI should do in a natural language, even even in a natural language, you going to end up with a pretty complex description. Like there's not there's no way around it. I'm sorry.
There's no way around it. People are looking for uh a simplest solution, right? so magical pill that just solves the problem, but somebody at the end of the day has to sit down and describe the freaking logic of this entire thing. Um, so yeah, there you go. We can yeah, I can select a bunch of these things. So, as you can see, now it is snapping according to the red one, but I don't like it. So, I just change it to that, and it's snapping according to that new one. So now we have a notion of an anchor. So and I spent two and a half of an hour of working on this entire thing.
People uh were asking me to do another leg game development. There you go. I did a little bit of a le game development. It was fun. So what do you guys think?
So absolute bading.
Absolute buding. So yeah, not sure if I'm going to be uploading that to YouTube. Uh whether YouTube people care or not care. Uh people only care about the things that the YouTube algorithm will bait them into watching, right? So I feel like YouTube audience is kind of kind of lacking an agency in a sense, right? So it's just like Yeah. So the way I think YouTube audience audience work is that they have a complete lack of any agency and it's sort of like they watch whatever algorithm uh forces them to watch. All right. Uh maybe this is because the YouTube is organized this way, right?
Maybe. Yeah, maybe it's just because the YouTube is organized this way where the feed is right into your face. the search doesn't work. The subscription feed is completely [ __ ] hidden. So, it's literally the the audience is the algorithm, right? So, you're not really making videos for audience, for humans.
You're making videos for the algorithm for a [ __ ] neural network. And it's so [ __ ] frustrating, right? So, especially if you're trying to connect with people. Um, Twitch is way better in in that sense in my opinion. on Twitch there is no algorithm to appease. Uh there is some sort of algorithmic recommendation thingy, but it's very nerfed in a sense, right? So it's very [ __ ] nerfed and it's just like I don't know. So it's like it's all rely on like people actually knowing about you, people actually actively going to your Twitch channel and watching you.
Uh I came from YouTube after seeing the device. Yeah. So, it's it's kind of complicated, right? So, it's kind of complicated. It's just like what I'm saying is that playing the YouTube algorithm game is insanely difficult and frustrating.
So, and it's just like sometimes I'm not even sure who am I making the content for. Like, that's what I'm trying to say. So, I'm not trying to maybe offend anybody. I'm sorry if my words offended anybody, but so it's just like like I'm not even sure who I'm making content for. Is the algorithm is is there any real people in there? It's very difficult for me to see because the only thing I see is numbers and it's just like I don't [ __ ] know.
Um game development does well on YouTube.
Okay, I guess that's it for today.
Thanks everyone who's watching me right now. I really appreciate it. Have a good one and I see you on next recession session with a who I missed. I love you.
Related Videos
Custom Shader FX Nodes - No Boilerplate
git-amend
281 views•2026-06-21
React Hooks Are Just a Linked List
lucas-barake
220 views•2026-06-22
Course : UVM in Systemverilog 1: L4.1 : Generic UVM Testbench Structure
SystemverilogAcademy
365 views•2026-06-20
microJAM: MAKING A MICRO GAME FOR A GAME JAM IN CLOJURESCRIPT AND TOTALLY NOT C
janetacarr
156 views•2026-06-18
Design Claude Code Like a Senior Engineer
hayk.simonyan
344 views•2026-06-19
Specialist Tries 2600 Rated problems
TejaDronadula
1K views•2026-06-24
Linus Torvalds: AI Won’t Replace Understanding Code
SavvyNik
140 views•2026-06-19
Course : Systemverilog Verification 5 : L9.4 : Count only cross coverage
SystemverilogAcademy
181 views•2026-06-20











