0
\$\begingroup\$

This is a style question.

I have a 3D game (think Quake) and the OOP design at a very high level has 3 main base classes:

  1. "World"
  2. "Entity" - like "Player", "Grunt", "Barrel", "Door"
  3. "Weapon" - like "Shotgun", "Nailgun"

The question is I want players to carry more than just weapons in this game. For example, World of Warcraft you can carry many things besides weapons like shields, armor, clothing, amulets, rings, etc. So, I need a base class for Weapon that is more generic.

I have thought of "Item", "Gear", "Equipment", "Kit" as the base class. But I am assuming there must be a standard term for this out. What do other game engines use for this type of base class?

\$\endgroup\$
3
  • \$\begingroup\$ That will likely be up to you: what is the clearest term for you and your team? To have a "standard", you'll need to have all of the teams of a single company to agree (e.g. at Ubisoft, you'll need to have the Assassin's Creed teams, the Far Cry team, the Tom Clancy teams to agree to a single term). Then, you'll need to have multiple companies do the same process, and then come up with the same term. Given the human nature, and the importance of the standard (which is: not important at all), it's unlikely that there will ever be a standard for this concept. \$\endgroup\$
    – Vaillancourt
    Commented Aug 24, 2022 at 17:03
  • 1
    \$\begingroup\$ "Item", "Gear", and "Equipment" are all good options I've seen in use elsewhere. I don't know that anything more standard exists. \$\endgroup\$
    – DMGregory
    Commented Aug 24, 2022 at 17:44
  • 1
    \$\begingroup\$ When in doubt - use thesaurus.com. Meanwhile call it a "jiffy" and move on coding. You will rename it later on if/when need arises =) \$\endgroup\$
    – Kromster
    Commented Aug 24, 2022 at 18:43

1 Answer 1

1
\$\begingroup\$

As others have commented, there's no single strategy for this. Personally, I prefer the term "equipment" for items that the player can equip (such as armor and weapons), not for consumables (such as potions). However, you should take your in-game terminology into consideration. It's generally a good idea to make developer terminology reasonably consistent with in-game terminology so that your team members don't get confused.

Here's an example of a frustrating scenario: you have a base class Item, and several child classes such as Weapon, Armor, Consumable, Key, Ammo. Then your boss/client/UX team decides that within the game UI, "Equipment" will be a term for weapons and armor, and "Item" will be a blanket term for all other things that can go into your inventory, such as consumables, keys, and ammo. Now, whenever someone talks about an "item", you have to ask for clarification - are they referring to the Item class or the "Item" category in the game?

Another way you can avoid confusion is to use developer terminology that would never appear in an actual game. For example, in the Unity engine, any object that can be placed in the world is a GameObject. If I recall correctly, in the Source engine, any object that can be placed in the world is an Entity. In some engines and frameworks, any type of character is an Actor. Because these terms are never used in actual games, they help to avoid ambiguity in developer conversations.

With that in mind, you could consider base class names like Equipable, Holdable, PlayerItem that would definitely never appear as in-game terminology.

It's not always practical, but when possible you should try to work out all of your terminology early on and try to make it consistent between the code and in-game UI to avoid confusion/ambiguity.

\$\endgroup\$
2
  • \$\begingroup\$ +1, except this part: "you should try to work out all of your terminology early on" - more often than not it is just not feasible in larger projects. \$\endgroup\$
    – Kromster
    Commented Aug 25, 2022 at 4:32
  • \$\begingroup\$ @Kromster Yes, that's why I started that sentence with "It's not always practical". Better to include general advice that is applicable to some games than omit it because it isn't applicable to all games. \$\endgroup\$
    – Kevin
    Commented Aug 25, 2022 at 20:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .