Rayhem
Joined 7 years ago
Joined 7 years ago
The Little Shaman[1] has been one of the most comprehensive-yet-approachable resources I've found for understanding these kinds of high-conflict personalities. In particular [2-4] are pretty relevant to your question.
[1]: https://www.youtube.com/@thelittleshamanhealing/videos [2]: https://www.youtube.com/watch?v=uJZeXxU7QTg [3]: https://www.youtube.com/watch?v=TokWBgMQIZ4 [4]: https://www.youtube.com/watch?v=e5Hq_xNxrOg
This may be the colloquial description of how narcissism manifests, but it isn't even close to (and possibly completely opposite) clinical narcissism. The grandiosity isn't so much a belief as it is a "false self" put on to garner caretaking from others. It's not "I got all the toys as a kid, so I deserve more stuff!" but a failure to individuate from caregivers. "Mom (as a tool, not a wholly independent person) came when I cried as a kid, so I need you to lavish attention on me and make me feel better now as an adult. I can't see myself without external input; I only see myself as a reflection through you."
for(auto &entity: entities) {
entity.update();
}
You're then responsible for weaving the health changes into your update (or getting it from your parent). Weird stuff can happen if one entity updates before another, too: you likely want all of the health updates to occur after all of the damaging events. So now this update function has to register a deferred health update to occur down the line.Option 2 with something like an Entity-Component-System design would have a "Health" system that handles health updates across the board.
for(auto &damageEntity: entitiesThatDoDamage) {
damageEntity.registerDamage();
}
for(auto &healthEntity: entitiesWithHealth) {
healthEntity.updateHealth();
}
Neither of these options is strictly better than the other. Option 1 is good if you need a lot of bespoke logic for health updates (dragons update differently from humans which are different from vehicles etc.). Option 2 is better if everyone has `newHealth = oldHealth - damage`. Things are generally more similar than they are different, so you end up changing all values of a single "kind" (structures-of-arrays) more often. monsters[0].health = //calculation
monsters[1].health = //calculation
monsters[2].health = //calculation
and not monsters[0].health = //calculation
monsters[1].name = //update
monsters[2].is_poisoned = //check
Striding over your monsters array means you have to load each monster to access one field which just blows your cache to hell. Much better is to pack all of your health values together in a structures-of-arrays layout as opposed to the usual arrays-of-structures approach here. Entity-component-system architectures are a brilliant tool for managing this with some pretty performant results.If you're strictly optimizing for memory size out of necessity, then yes. It's dangerous to use an unsigned type in any context where you might even consider subtraction, though, and it's pretty effortless to see that new_health = health - damage is going to be used somewhere. Congrats! Your 100hp lvl3 monster just got resurrected with sixteen thousand hp.
I don't think mentioning "authors" is absolutely necessary, but I think this is both a faithful attempt to convert this to natural active voice and easier to read/understand.
Sadly, I don't see this ever happening due to the insane number of regulations you'd have to satisfy and the major players in this space only doing it to collect PII.
The problem domain is things like your physical model. Your 3d mesh. Financial transactions. All things that need to be represented in software.
The software domain is things like components and queries. Things you can build in-software to realize your problem domain on a computer.
Defining a component and the behaviors of a component has nothing at all to do with the problem domain; it's purely an artifact of software to make your system more extensible/reliable/faster/whatever. But this is the part that's OOP excels at because you get to write the rules of your component taxonomy in its entirety. You have a ThingDoer class that can accept any number of Components to give it the behaviors you need, and then you start writing out components to model your problem domain. The objects and their behaviors remain at the level of "how do I put these pieces together". OOP sucks for the problem domain, though, because you're always stuck trying to munge some limited inheritance tree (animal <- dog <- wolf) onto the Real World and it's always going to miss something. Far better to build atomic building blocks that are expressive enough to compose into whatever you need.