Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 02 Nov 2011
Offline Last Active Sep 30 2013 12:10 PM

Posts I've Made

In Topic: Inventory System

22 July 2013 - 11:48 AM

Yep that's almost exactly how I have it right now.  Then for my Inventory class I have an "addItem(Item item)" function.  It iterates through the list to see if the item has been added before.  If it has then it increments counts by 1 otherwise it'll create a new slot and set count to 1.

In Topic: Basic Component Based Entity

17 November 2011 - 03:33 PM

When you say units, are you implying that you have like a master AI system and then child AI subsystems? Then those child AI systems can request from the parent AI subsystem pointers to the various AI child systems to communicate back and forth and work with other various AI components without using the event dispatcher? As for your comment about see/hear rules, I don't follow.

I'm thinking my AI system is more complicated than yours. Rather than just one part running scripts there are other systems for things like sensory input. These systems watch for things like sounds to play or check via rays if the entity can see another entity. These will notify the decision making system which looks at the data and decides what to do. Using this I can effectively turn off a monster's ability to hear and it would function as if it never had it. Some with vision. I could turn off it's ability to receive a list of objects it can see making it have to solely by hearing find a target.

The ai has a set of targets kept in a list and when it gets it's vision feedback it'll compare those objects to the target objects and then take the right actions to try to kill the player.

So in short all of these systems make up the AI system as a unit. If one system doesn't exist the unit needs rules to make sure it can still operate.

Best example of what I'm doing:
Left 4 dead AI

It does make sense from the perspective of keeping things simple, but I decided to take a different stance when I started. With the editor in mind, I will be able to construct my terrain, shape it as I wish. Additionally, the editor will allow me to place an entity (broad-term) anywhere on the scene. The entity being placed can be selected in two ways 1) pre-fabricated or 2) dynamically. The user will be able to create a monster by simply selecting and dragging components to the entity container, setting values and moving the entity in the scene where they want it to be placed. They'll be able to script in behavior or add AI elements by specifying path points, etc; all because of the components that a selected entity has. The users can create a silly entity and if they like what they have, they can easily with a simple click copy an entity to a pre-fabricated template. Later when they move on to another area, they can grab that entity from the pre-frabricated list instead and simply tweak parameters as they need. It's a big project no doubt, but that's the goal and with that in mind, I am of the opinion that entity components are somewhat dynamic. It certainly adds a bigger element of complexity :(


This is where considering certain parts as units would come in handy. If you give them the option of choosing what input the ai should receive so when the decision making part of the AI unit does it's thing it'll look to see if it has the ability to hear or see.

One current debate I have with all this is where to draw the line, particularly where it surrounds the render engine's components, such as lights, meshes, planes, and movable text, etc. Most of these objects require access to the scene manager for their respective render engine equivalent to be created. One way I considered is that all these "specialized subsystems" are child component systems of the render system. So when the render engine starts, there are about 10 different subsystems that start up with it. These subsystems handle various render-component types. Another alternative is that I have 1 system that manages all these components in various lists. The downside here though is I end up with a laundry list of logic methods in this one system for various component types; albeit they all depend heavily on the OGRE render engine to work. I just can't seem to put my finger on a good design for these types of components.

I'm not sure about OGRE but in Irrlicht things like text is handled by the GUIEnvironment. So maybe have that as either a separate system.

A light that can change it's state should be an entity and in Irrlicht I think is still considered a scene node so the renderComponent which stores said node can still hold a reference to it.

In Topic: Basic Component Based Entity

17 November 2011 - 02:38 PM

I'll probably make two tools. An entity generator and the level editor.In my system the blueprints for entities are stored in .init files that are parsed by the entityFactory creating the components in the correct order. So before actually constructing a level in an editor I would go through and create the entities I.E. enemy types, pick-ups, weapons, and other dynamic stuff. After I have designed them for their purpose the generator goes through and using it's set of rules makes sure the components are listed in the correct order. Note that the generator does not need to use the components so it doesn't have to have them added to it in the correct order either. (I hope that made sense)

The level editor on startup will look through the "scripts/Init" folder find the entities available to it and allow you to place them in the level.

As of right now I don't need to come up with new entity types on the fly I just plan to use the ones I have planned out ahead of time. It keeps things simple for now.

I've been going through and writing notes and drawing diagrams using the systems as the updater and the components as data-bags and I'm seeing why you do it. It's easier to communicate data between components via the systems. Same with system to system.

To me it seems like multiple systems with dependencies on each other should be considered as units especially ones that function together to form AI. So those components need to be made together anyway so the dependency shouldn't really be too worried about. Now using AI as an example again since not all entities need to hear or see rules can be made to exclude those from the system that stores the action queue or makes decisions based on those two's input.

In Topic: Basic Component Based Entity

17 November 2011 - 11:28 AM

This is my 100000 ft view on where I plan to head, but not sure whether that is right :P

. I'm still working on basics



Same here. As I work on it I find that certain things don't work (problem I'm having right now) and that certain things do. Also that certain things work better with others. Coding isn't hard it's designing it first. The nice thing though is that I have it set up in a way that I could complete remove the entity system without having to rewrite other parts (stateManager, game) since they are independent of each other. I know that isn't impressive but it's a first for me to design things modularly like this. lol

I need to sit down list what I need in the game how things need to work based on the players view and from there figure out how it needs to work behind the scenes. I also think I'm going to drop CopperCube/irrEdit and make my own editor so that I can decide what components are applied to what and have it generate the .init files for me. But first things first I need to figure out what components I need.

Like for example:
A playable entity needs a component for: Spatial, Render, Animation, Collision, Controllable, Equiping.
A weapon would need: Spatial, Render, Animation, Behavior, and Equipable.
AI NPC (Zombie): Spatial, Render, Animation, Collision, Sight, Hearing, AI Logic.

And if I'm thinking right it should be created and updated in the order I listed the components.

Now for the components Equiping and Equipable:
My thinking is that since every weapon has it's own behavior and other attributes making it able to attach and receive input via a entity with an Equiping component which receives controlling events will let me be able to use it easier.

In Topic: Basic Component Based Entity

17 November 2011 - 10:07 AM

So if I'm reading right your actual system is updating the information based on the component data rather than having your component have an update function and it does it's task?

So for example a collision system just pulls the data from the current component it's looking at and updates the data based on that itself? I can see that working for some of the components but what about a more complex component like AI? In my system I have two AI like components. AI and Behavior. Behvavior runs a simple script while AI deals with more complicated inputs and outputs.


I found an article that I think is explaining what you are talking about correct?
Entity Systems

The point your making is about halfway down the page under "Almost"