Trading rigid inheritance for a component-based architecture is a mature move that prioritizes modular flexibility over structural fragility. It demonstrates a clear understanding that decoupled systems are essential for building truly scalable and creative game logic.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
I Rebuilt My Entire NPC AI System in Godot 4 | The Weekly Worm
Added:Hello internet. Welcome to Gay Theory.
I'm your host, Killer Bean Star, and you're watching the Weekly Worm. All right, let's get into the news. This is a a show where I tell you what I've done over the past week with the progress we've made, cuz I've actually realized that I never actually gave you progress reports about what I was doing. I was like talking about it and was like showing some things, but mostly in the realm of like, hey, I found an interesting thing while I was doing the game development. Look at interesting concept. Anyway, what's new? What's new with you, buddy? Show me your So, I mentioned it briefly in the last video, but that recording was pretty scuffed, so I'm going to mention it again. Thanks to a comment, a very lovely comment by this man. He knows who he is. Cool dude.
He was like, "Hey, you know, inheritance, cool, right? But, uh, having experience with this kind of stuff, you should probably use a component system for these and instantiate an NPC or interlocutor or citizen as a component to have access to the bits and pieces that you want instead of having it be a hierarchical system. And I saw that and was like, oh yeah. And then I, you know, I spent like 6 hours doing that and making that happen. in. So, you know, now if I want something to have a state machine and have access to messages, I just need to slap a an NPC component on what what's this? This just in the NPCs are no more.
They've been replaced by a courier class. What the [ __ ] is a courier? So, a courier basically in essence is a dude who delivers packages.
Now, [music] in the context of what I'm doing, the NPC is now the courier because all that the NPC did was essentially instantiate a state machine and subscribe itself to be on the list of people able to receive and send messages. That being the case, I thought it fair enough to call it a courier. I didn't know what else to call it. It's a thing that basically just delivers messages and then also there's a state machine attached to it because anything with a state machine is going to want to have access to messages. It's literally designed to work with a state machine and I can send messages without a state machine. I just have to provide a fake ID. It's literally a number. I just say here's a number. Any number works two is the one I just keep using for no specific reason. You know, fake ID give it a two. Believe it or not, the ID checking on the message router not so strong. Give it any number. And it's like cool, I'll do that. I'll send that message. Not the biggest deal in the world. Pretty simple [ __ ] Okay, so that's that's news. No longer inheritance, now components NPC is now renamed the courier. Everything else about that pretty much the same. So you're going to see if you if you come and watch on the live streams, you're going to see courier [music] courier a lot. You're going to see a lot of courier courier. And you should watch the live streams. I stream every day at the moment. Who knows how long that's going to last. I'm looking for a job, but for now we stream every day, so you should stop by. So anyway, having NPCs and civilians and interlocutors be components means that I can put a courier node on anything I want. Having the ability to just throw a state machine and messages onto anything has allowed me to make interactables really easily. Anything that I need to be interactable, I just put a put a thing on it. So now I could just throw an interactable component on anything that I need to be interactable, which includes NPCs. You may you may hear that and go, "So the NPC would have its state machine and then the interactable will have you have two couriers in one thing." Yes, I do. I have two couriers on that thing. You have the courier on the NPC and then you have the courier on the interactable component. And that's okay. Linking the two is really really easy. Believe it or not, I can actually get the ID of courier of the owner of the interactable and then pass messages between the two. So if I want to link them, I can. It's not a big deal. You can you can totally do that which allows me to do the thing that you would want to do which is you know start up a conversation with an NPC and then it locks that NPC in place doesn't move doesn't continue and then when the conversation ends it reverts back to its previous state and then you're good.
You're done. It worked. It's fine.
Having a state machine control and look for interactions and having a state machine control the NPC behavior.
Totally fine. Perfectly primo. Breaking news. You can drag corpses again. That's right. You you yourself you can in fact drag corpses again if you're on the Patreon. That's right. A fundamental part of the game is now back in full force. Nice. I love fundamental parts of the game. That's sick. Now the corpse related news. The plans for having corpses ragd doll has changed. I've made the executive decision to not have ragd doll corpses anymore. Instead, I'm going for meat chunks. Meat. Meat grows meat chunk. Everyone gets to become gross meat jelly pile. You like blob of jelly gross meat with bone sticking out and hand optional hand. Maybe hand sticking out gross meat pile. You like good cuz that's that's what we're doing. I think it fits the aesthetic. I like it. Um it's my game. Do what I want. If I want the gross icky meat pile that glistens in the moonlight, I'm going to [ __ ] put the [ __ ] gross meat pile in the game. [ __ ] you, Jared. be one guy named Jared in the in the crowd that's going to be like, "What? What did I do?" But I'm Jared, but that's me.
No, Gary, too. [ __ ] you. Just kidding. I love you, Gary. Not you, Jared. You sit down. Welcome to [ __ ] still broken. The segment where I talk about [ __ ] that is broken. Okay, so after switching to C#, believe it or not, [ __ ] broke. And I've been essentially working on making [ __ ] not broken while also adding new stuff the whole time, more or less. You know, we we add new stuff, it touches on old [ __ ] That old [ __ ] needs to get rewritten. I rewrite it. Other [ __ ] breaks, it touches other old [ __ ] that breaks. I got to just It's this horrible The blast radius of this is the whole game pretty much. And [music] had I known that, how incompatible GDScript and C were, I wouldn't have done it.
Plain and simple, we'd be farther along by now. That's pretty cool. On the bright side, the function that was taking, you know, 173 milliseconds to work, the mini map now 40. So, you win some, you lose some. It is what it is.
But yeah, [ __ ] broken. So, what is still broken? Um, NPCs do not care about dead bodies at all. They could not be asked to give less of a [ __ ] You cannot become bloody. I haven't re-implemented that. Same with the bodies. They're literally They don't have any way to care. Body detection. They can't do it.
Guards are not real. They don't exist.
They're like the tooth fairy or Santa Fins of your imagination. They were never real like spoons. In other news, the player HUD, the thing at the top, that's pretty much good. We did that.
Things that aren't good. We We're not generating a rival right now. Kind of important. It's not happening though.
We'll fix it. Trust. But you know, we got like time time is back. Time moves.
The message gets sent. Um, get this messages broadcasts with the message with the state machine with the components and the finite state machine that we talked about in a video that if you haven't seen, you should watch it.
Good. That thing the me the broadcast that works. So, um, they all know when the time switches over from 7 to 8.
That's pretty good. We love that. They get a signal to move. That'll change eventually. They'll all get random two-dimensional array. They'll get a a time, a tick, an integer, the location, and the tick in the integer will be randomly generated. You know, we'll randomly generate a list of time and place. They just have a a list of them, and then they'll they'll they'll check when the tick happens. They'll check when the a tick occurs, and they'll be like, "Whoa, that tick, that number, that integer. I got to go. I got to go.
I I got to I got to go.
>> I got to go home." But for now, they just react to a Oh, the hour changed.
Dingdong, got to go. We're literally just getting back to where we were and then adding new features at the same time. [music] Yeah. No, my advice if if you're going to start a GDO project and you're not sure whether or not you should pick GDScript or C#, pick one.
Any one. Just pick one and then stick with it. Don't switch. This [ __ ] sucks.
I hate doing this. This isn't fun.
There's nothing fun about rewriting your own code that used to work but now doesn't. Not fun. Not cool. don't like it. It sucks.
So, what am I going to do next? I'm going to flip-flop between working on mini games and then also working on fixing [ __ ] that needs to be fixed. On the bright side, we're pretty much done fixing [ __ ] that needs to be fixed. I promised you map news. Ready for map news? I figured out a quirk of how the map works. We've been continuously dealing with a intermittent problem [music] where the map would randomly have weird spaces in between the tiles and I wasn't actually sure what the [ __ ] was causing it and also the scaling would change [music] and recently the map was inversed. The x-axis only was inversed. It was opposite of what it would should should be. So, uh the whole map was backwards which was really odd. So, the mini map has been giving me trouble the whole time since I've made it. It's never not been giving me trouble. It's been a pain in my ass since the start. But on the bright side, I understand it now. A quick recap of how the map works. I have a grid map, okay? Grid of tiles, okay, I get their locations, I normalize them, I do some math, and bada bing, bada boom, we get a a mini map where all the 3D tiles have been placed, right? And the thing about that is that you need to have it in the bottom right hand corner to prevent negative numbers so that when you normalize it, it doesn't go, which is what happened. That's why we got inversed. But also a quirk about where you displace the map, the the the 3D map that generates the mini map is that if you move it farther on either the X or Zaxis, you'll introduce those weird spaces. That's what was causing it is that I the 3D level was moved more on either the X or the Zaxis depending. So you got to you got to move it down and right the same amount. It's got to be the same number. And since my tiles are 16 by [music] 16, it's easiest if I just move it by a a multiple of two. So right now I have it moved down 256 x 256 and that way bump bump down. Okay. And the second thing is to get the spacing of the tile correctly cuz that doesn't deal with the scaling of the map. If you the farther down and right you move it, the map gets teeny tiny, right? You guys are very small. Very small. Been dummy. Like an animal's yo G-old commercial.
Some of you had a memory unlocked just now. I see you, man. Commercials used to be way better. Um, but I don't watch TV anymore, so maybe they are still good.
Who [ __ ] knows? Y'all y'all remember those [ __ ] uh Skittles commercials that were like actually just like nightmare fuel? Y'all remember that [ __ ] I hated those as a kid. They freaked me out. I don't like them. You remember that one with with a kid with the Skittles tree? That [ __ ] was weird.
It did not make me want to eat Skittles.
It was the kids ones, too. It was always the ones for like kind of like targeting like tween or whatever the [ __ ] Those guys. Yeah, they they got the weird commercials. They got the [ __ ] ones.
Cuz the adult ones were just kind of like here's the product. You too can clean better. If you just had Magic Dave's butt plug shoved up your ass, you'll clean twice as fast. Guaranteed.
a commercial selling candy is like here's King Midas but with Skittles the fruit rollup ones with the kids and then he no more bones bones be gone the DNA got time he killed his friend now his fingers are fruit by the foot what a weird time to be alive but yeah anyway so um you have to multiply by the uh right bottommost tile position uh and then it just works and yeah so on my last video I talked about mini games and what my ideas for mini games were, what their purpose was. And under that video, of course, I got positive comments and I got negative comments, but but I got a comment that I haven't seen in a while, which is a multi-paragraph comment about how I'm doomed to fail and why they think so, which essentially boils down to I don't think you can, which is always fun to see, but well, the thing they were complaining about how I was going to over complicate my game, you know, the mini games. And at the very end, they were like, "Holy hell, the stats. Watch scope creep. No, the stats aren't scope creep. They're numbers. Um, here's miniame stats working.
Here it is. You get a score.
All right. Here's the Jason defining all their multiplier values.
You load that in. You You play the game.
You get a score.
You lose the game. And then it modifies all your stat. Look, it's even colorcoded. You got green for positive, red for negative. You want to know how long this took? One day took one day to get this to work in the way that it should. And guess what? Look here. Here's the thing. You can even pick the category before you for the game before you play.
Just pick it from the list. You even hover over the list and then it will modify your stats differently. It's uh it's done. That part did it.
Um, yeah. The only way you make that statement is if you haven't watched the previous videos about what the stats are for. They're just determining whether or not your love interest likes you. It's literally, do you have the correct number? And that's it. They don't modify anything. They don't do anything. It's a number. You modify the number. And then at the end of the game, the very end, your love interest looks at you and goes, "Your numbers are right or your numbers are wrong."
And part of the game, okay, part of the game is figuring out what numbers they want. The numbers don't modify [ __ ] You just you figure out what they want and then you make it happen. Like, what scope creep is that? Ah, you modified numbers. What? Scope. You You You You have numbers listed and labeled and you modify them, you scope creepy schmuck. I don't know. If you're going to complain, at least at least complain about [ __ ] that makes sense. I thought it was funny.
[laughter] Yeah, this has been a bit of a rambly [ __ ] video. We'll see. We'll see if I keep any of this in. Who knows? Who [ __ ] knows, dude?
>> No, that's pretty much it. Um, I'd like to give a huge shout out to all the people on Patreon. Kofi and Twitch who helped keep this channel alive. I love you. Especially, my main mans, uh, Misha Queso, Mr. Coffin Green, and Bianca.
You guys specifically, I love you the most. I have favorites in this household is you guys.
Anyway, that uh yeah, that does it. Ah, I had an idea for fixing something and I forgot what it was. Um, the power of uh not sleeping.
Wow.
Related Videos

TOP 15 Data compression Interview Questions and Answers 2019 Part-2 | Data compression | Wisdom jobs
wisdomjobs
281 views•2019-06-28

CTS 158: 802.11w Management Frame Protection
ClearToSend
4K views•2019-02-04

NDSS 2019 Send Hardest Problems My Way: Probabilistic Path Prioritization for Hybrid Fuzzing
NDSSSymposium
496 views•2019-04-02

How realistic is Cities: Skylines?
CityBeautiful
159K views•2019-02-14

GUIs & TUIs: Choosing a User Interface for Your Python Project | Real Python Podcast
realpython
2K views•2025-04-04

The OSI Model - Explained by Example
hnasr
225K views•2019-05-12

Cloud Computing - Introduction
elithecomputerguy
98K views•2019-10-07

From Traveler's Dilemma to Dynamic Routing | Demystifying Networking
IITBombayJuly
5K views•2019-08-04
Trending

WOW! Judge TURNS THE TABLES on Trump in His OWN $10B LAWSUIT!!!
MeidasTouch
197K views•2026-07-23

Playstation NO DISC/NO BUY Fight Is Over...
DavidJaffeGames
4K views•2026-07-23

Steam and Xbox Just Dropped The Hammer On PlayStation
OhNoItsAlexx
9K views•2026-07-23

Americans Confused in Australia for 17 Minutes Straight
IWrocker
17K views•2026-07-23