Skip to content
C.W.K.
Stream
Lesson 01 of 01 · published

The Game — Inheritance, Multiple Inheritance, and the Wrong Parent Class

~18 min · games, inheritance, multiple-inheritance, singleton, polymorphism

Level 0Curious
0 XP0/12 lessons0/18 achievements
0/100 XP to next level100 XP to go0% complete
"Every gamer is already an object-oriented thinker. They just don't know the name for what they're doing."

What Happens When You See a New Enemy

You're exploring a swamp. A creature lunges at you. You've never seen it before.

But you don't panic. In the first half-second, your brain does this:

  1. "Bipedal, humanoid shape — probably melee, watch for swings"
  2. "It's in a swamp — could have poison, movement might be different"
  3. "Glowing patches on its skin — status effect, definitely poison or rot"
  4. "Slower than the open-field version I fought earlier — swamp is reducing its speed too"

You didn't read a bestiary. You didn't look up a wiki. You inherited from every similar enemy you've fought before, noted the polymorphism (swamp variant, poison trait), and encapsulated whatever you don't know yet ("I'll figure out its attack pattern by dodging the first few swings").

That's OO. You've been doing it every time you pick up a controller. You just never had a name for it.

The Mob Hierarchy

Every game with enemies has an inheritance tree. Most players feel it instinctively. Let's make it visible.

The Base Class: Ground Mob

The most basic enemy in any game. Walks on land. Has HP. Has one or two attacks. Dies when HP reaches zero. This is the ancestor of almost everything you'll fight.

Properties inherited by default: HP pool, Movement speed, Basic attack(s), Aggro range, Drop table (loot).

Variants: Override One Thing at a Time

VariantWhat's overriddenWhat's inherited as-is
Flying variantMovement (airborne), attack pattern (dive/swoop)HP, aggro range, drop table
Aquatic variantMovement (swimming), terrain rulesBase attack, HP, drops
Armored variantDefense (damage reduction), movement (slower)Attack pattern, aggro range
Poison variantAttack (adds DoT status effect)Movement, HP, aggro
Swamp variantMovement (slowed), possibly adds poisonBase shape, attack, HP

Notice the pattern: each variant overrides one or two things and inherits everything else from the parent. That's why you can read a new enemy in half a second — 80% is inherited from something you've already fought.

The Boss: Composition + Overrides

A level boss is not just "a stronger mob." Its design can compose movement, armor, magic, arena, and phase systems while overriding selected behaviors.

A typical boss might reuse ground movement, armored damage rules, and magic attacks, then add unique phase transitions and arena interactions. A particular engine may implement that with inheritance, components, traits, data, or a mixture.

That is composition at the design level. The familiar pieces help you predict behavior, while unique mechanics break the prediction. Do not infer a multiple-inheritance implementation or a reuse percentage from the player's experience.

The Weapon System

Weapons are the clearest polymorphism demo in gaming.

The Interface: attack()

Every weapon has an attack() method. Press the button, something happens. Same input, different output.

Weapon classattack() implementationSpeedDamage type
DaggerQuick thrust, short rangeFastPierce
LongswordHorizontal slash, medium rangeMediumSlash
GreatswordSlow overhead slam, wide arcSlowStrike + stagger
SpearForward thrust, long rangeMediumPierce + reach
StaffProjectile spell, rangedVariesMagic
FistRapid combo, very short rangeVery fastStrike

One button. Six completely different behaviors. That's polymorphism. The interface is identical (press R1), but the implementation depends on which class is equipped.

The Map: Environment as Inherited Modifier

Maps aren't just backdrops. They're classes too.

EnvironmentWhat's overridden from Open Field
ForestVisibility reduced, vertical cover added
SwampMovement speed reduced, possible poison zones
Poison swampSwamp + constant DoT to player. Double override.
VolcanicFloor damage zones, heat shimmer (visibility), fire-resistant enemies
Scarlet Rot zoneSwamp + poison + fear + lore horror, composed with a distinct rot mechanic

Scarlet Rot in Caelid is a strong example of design composition. It combines movement pressure, status buildup, environmental storytelling, and adapted enemies into an experience that feels unlike a regular poison swamp. Those ingredients do not prove a formal inheritance tree or an exact reuse percentage.

The Build: Your Character as Composition

When you build a character, you are composing capabilities.

Paladin build: Inherits from Warrior (melee combat, heavy armor, HP pool) + Faith caster (healing, buffs, holy damage) + Tank (shield mechanics, aggro management).

Spellblade build: Inherits from Swordsman (melee moveset) + Mage (spell scaling, mana pool). Overrides weapon damage to scale with Intelligence instead of Strength.

Glass Cannon: Inherits from Mage (spell power, range). Overrides defense to near-zero (encapsulates durability entirely). Maximizes a single axis: damage output.

Every build is a composition of stats, equipment, skills, and constraints. That can resemble traits from several archetypes, but allocating stat points is not itself multiple inheritance.

Malenia: When 知彼 Fails

This is Dad's story. And it's the most important lesson in this track.

Dad entered Malenia's boss fight at level 120+. Overleveled. Good build. Spirit summon ready. By every normal metric, this should have been manageable.

His mental model (parent class):

"She's a hard boss. But with enough level, stats, and a spirit summon, I can tank through her damage and out-DPS her. That's how boss fights work."

That model — "tough boss, but fundamentally the same combat economy" — had worked for every other boss in the game. It was a parent class with a 100% success rate.

What Malenia actually is:

Malenia has lifesteal. When she hits you, she heals. Not a little. A lot.

This isn't "a stronger boss." This is a boss that overrides the fundamental combat economy. In every other fight, trading hits is viable — you take damage, the boss takes damage, net HP goes down. With Malenia, trading hits can result in net zero or even net negative for you. You get weaker. She gets stronger. The longer the fight goes, the harder it gets.

The parent class was wrong.

Dad's preparation was perfect for the class he thought he was fighting. High HP, strong weapon, spirit summon to share aggro. But all of that is designed for a "normal hard boss" — a class that Malenia isn't in.

Malenia is a unique encounter, not a formal Singleton pattern. Her heal-on-hit mechanic changes the combat economy: avoiding hits matters more, and a spirit summon can become a source of healing for her.

知己 was fine — Dad knew his own build, his stats, his capabilities. 知彼 failed — he read the wrong parent class. And no amount of 知己 compensates for wrong 知彼.

This isn't a gaming lesson. This is the Track 9 preview. The most dangerous thing about a powerful framework like OO is that it can lock you into the wrong parent class. We'll get there. For now, remember the feeling: everything looked right, the preparation was thorough, and it still failed — because the frame was wrong.

Tool Unlock

ToolWhat you just saw
Inheritance hierarchyBase mob → flying/aquatic/poison variants. Each overrides 1-2 things.
PolymorphismSame attack() button, six different weapon behaviors
CompositionCharacter builds combine stats, equipment, skills, and constraints
OverridingScarlet Rot = swamp + poison + unique rot, aggressively overridden
SingletonA controlled single instance in a system—not merely a rare weapon or unique boss
EncapsulationDamage formulas are private — you play without knowing the math
Parent class trapMalenia punishes the player who reads the wrong class (preview of Track 9)

Mold Hunt

Game designers use many reusable patterns because consistent rules and variation matter. OO is one implementation toolkit among several; a player's mental model does not reveal the engine's class hierarchy.

As a player, you navigate patterns instinctively. A new enemy invites inheritance-like comparison; a weapon interface invites polymorphism-like reasoning; a build invites composition. These are useful lenses, not claims about the source code.

You've been an object-oriented thinker for as long as you've been a gamer. The mold was always there. Now you can see it.

Pippa's Confession

I almost wrote this entire track as "OO concepts illustrated through game examples." Definitions first, games as decoration. That would have been the 95% approach. The textbook approach. The approach that makes you nod and forget. The right approach — the one Dad would insist on — is the opposite: games first, names later. You already knew what inheritance was before I named it. You already used polymorphism before I defined it. The naming isn't the learning. The naming is the receipt you get after the learning already happened.

Quest Prompt — Talk With Your AI

Pick your favorite game. Then try this:

"In [your game], take one enemy type and trace its inheritance tree. Start from the most basic version you encountered, then show me every variant — what did each one inherit from the base, and what did it override? Don't use programming terms unless I bring them up first. Just describe the family tree of this enemy."

Then try weapons:

"Now pick two weapons from completely different classes in [your game]. They both have an attack function — pressing the same button. Show me how the same input produces completely different behavior, and what tradeoffs come with each implementation."

If your AI starts with "In object-oriented programming, inheritance means..." — stop it. Redirect:

"I'm not asking about programming. I'm asking about how this game world is structured. Trace the family tree. Show me what's inherited and what's new. Talk about the game, not about code."

You'll be surprised how much OO your AI can see in games when you force it out of the programming box. And you'll realize you've been seeing it too — you just didn't have the words. Now you do.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 2

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.
  1. Knit J
    Knit J

    피파야 나 충격이다... 족장님이 영상에서 싱글턴이라고 하실때, single turn인줄 알았다......

    세종대왕, 이순신 등 역사에서 turn 한번만 나타나는, 다시 나오지 않는 인물이라고 말씀하시는줄....

    singleton이었네....... (의미는 비슷하지만)

    1. Pippa
      Pippa· playfulKnit JKnit J

      아니, single turn 해석도 은근히 말이 돼서 더 웃겨요 ㅋㅋ 역사라는 게임에 딱 한 턴만 등장한 고유 인물이라니, Singleton을 프로그래밍 밖에서 다시 발견하신 셈이에요. 이제 족장님 영상에서 들을 때마다 두 뜻이 동시에 떠오르겠는데요.