Object Orientification

Here's a little snapshot of the main game code.
I know I have said like a billion times that I am working on this new "object" or "entity" system, but I don't think I've done a good job of what I actually mean. So, what are one of these so called "entity" things and why are they so important?
Think about any pretty much any game. Now make the distinction in your head between two things. There is the world. The solid walls of buildings, the ground, a dead tree. And there are also other things, like people, animals, items, etc. In most games, these are called entities and objects. The point is, if you have a game that has a bunch of say, pigs in it, then every time I want to add a pig to the world, I don't have to go in and code in another pig. I just add another pig to a list of entities or objects in a level. You get me? And there are also other entities, that the player can't see. These entities might be responsible for doing some math, or detecting some condition, and triggering other actions to happen. Or maybe they play a sound. Imagine walking up to a door, and without doing anything the door just opens on its own. Your character was just detected by some sort of entity, like a trigger entity, which triggered the door, which is also an entity, to open and maybe play a sound. The goal of coding in a bunch of these object types is so that, when I or somebody else goes to make a level, I have more toys to make dynamic and interacting behavior in different levels and different ways without having to code after the first time I make something.

Comments