Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Naming the Base Class of Organisms" in the Game World

Discussion in 'Scripting' started by Masea1, Dec 23, 2019.

  1. Masea1

    Masea1

    Joined:
    Jun 9, 2018
    Posts:
    41
    So, it is not hard to tell me that I am really obsessed with the names of my classes, variables or whatever, you name it.

    And here it comes to a base class where it basically carries all the common data that an NPC, Mob and Player may have. Things like health, inventory (don't ask me why a mob would have an inventory, that's more like a loot table, it is going to drop every item in its inventory when it dies), and blah...blah... So the issue is that to name this very class.

    I've come up with an idea of naming it as "Entity" but I am not quite good with it. Due to the fact that "Entity" actually could mean anything that exists in the game world. Apart from the ones I mentioned above, a projectile is also an entity or an item on the ground.

    I've also thought of "Living Being", "Organism" and similar. But, god, this looks like I am too far away from the actual point.

    Guys, give me hand with this. What could be the best fitting name for this base class?
     
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,594
    Could be Unit, or Creature, Character, LifeForm, LifeEntity, LifeInstance, or alternative synonyms.
    For example https://www.thesaurus.com/browse/creature?s=t

    In the end Bullet can share same base properties as Mob. I.e. position, direction, isAlive etc.
     
    Masea1 likes this.
  3. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    I like Organism. Just pick one and move on though. Whatever you pick you'll think it is wrong in 6 months anyway :p
     
    neoshaman, palex-nx, Suddoha and 2 others like this.
  4. Masea1

    Masea1

    Joined:
    Jun 9, 2018
    Posts:
    41
    Well, I had actually imagined the Character one already last night just before the sleep but somehow I forgot it this morning so made this post.

    Thanks though!
     
  5. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    1,905
    I think of "thing" as anything that has a location and can cease to exist (unlike, say, the terrain itself). After that, it is up to what extra traits you add with MonoBehaviour classes. I think of "character" as anything that can be involved in a story and can change over time of its own will, like Gollum or even the One Ring. I think of "actor" as anything that can be controlled by the player if the game allows the player to switch viewpoints, and this can also standardize how an AI controls it. I think of "carrier" as one with an inventory, while "container" as one which can merely contain other things. I think of "fungibles" as things which cannot change state and are interchangeable and can be lumped into quantities (like a Stack of Ore, or a bunch of bananas).

    How you name things IS important because you will live with the choices for a long time. How you ARCHITECT classes to be composable or remixed easily is just as important.
     
  6. palex-nx

    palex-nx

    Joined:
    Jul 23, 2018
    Posts:
    1,745
    Name them component-wise. Let health be class Health , inventory be class Inventory. Those are separate things and theres actually no need to combine them into super classes like organizm or character. Treasure chest can have inventory too and a road sign may have a dialog assigned to it without being an organizm