Entity System

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
XianForce
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 767
Joined: Wed Oct 29, 2008 8:36 pm

Entity System

Post by XianForce »

So I'm trying to maintain a better coding style, and for the next game I plan to make, I want to make an 'EntitySystem'.

Now in my mind, I think of an Entity as anything that moves, so I was thinking of having the EntitySystem composed of 3 other systems:

*PlayableCharacterSystem
*NPCSystem
*(Placeholder) System - Not exactly sure what to call everything else that moves (such as bullets).

But my question is, is this a good set up? Should things such as bullets be grouped with Characters/NPCs?

(As an added note, I'm not making something huge like an RPG, just a SHMUP, but I want to be able to have a lot of reusable code in the end)

Thanks in advance for any input.
User avatar
GroundUpEngine
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 835
Joined: Sun Nov 08, 2009 2:01 pm
Current Project: mixture
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Location: UK

Re: Entity System

Post by GroundUpEngine »

Heres my input, I use a vector of bullet objects in my player/character class and as long as it's a shooter I think it's perfectly fine ;)
XianForce
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 767
Joined: Wed Oct 29, 2008 8:36 pm

Re: Entity System

Post by XianForce »

GroundUpEngine wrote:Heres my input, I use a vector of bullet objects in my player/character class and as long as it's a shooter I think it's perfectly fine ;)
Hehe, makes sense...

It was just I thought of something that would be in my game last night right before I fell asleep, and then I thought about how to actually implement it, and how it moved and such... Then I woke up and forgot what it was... I just can't remember what it is, and where it would fit >.>
User avatar
GroundUpEngine
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 835
Joined: Sun Nov 08, 2009 2:01 pm
Current Project: mixture
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Location: UK

Re: Entity System

Post by GroundUpEngine »

Cool. Hey ya think that's bad, I got all this crap that I wrote last night to try make sense of ;)

Code: Select all

class Entity;

Code: Select all

class Actor : public Entity;
class Object : public Entity;
class GUI : public Entity;
class Text : public Entity;

Code: Select all

class Player : public Actor;
class Enemy : public Actor;
// Player & Enemy has vector<Bullet>
class Vehicle : public Actor;
class Bullet : public Object; // hmm
class Item : public Object;
class Map; // Map has vector<Object*>
// e.g. Map->Object[i] = new Object;
class Console : public GUI;
class Textbox : public GUI;

Code: Select all

class Pushable : public Object;
// e.g. Map->Object[i] = new Pushable;
XianForce
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 767
Joined: Wed Oct 29, 2008 8:36 pm

Re: Entity System

Post by XianForce »

Haha... That's why I always draw some flow charts =D - They usually help explain crap like that to me >.>
User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

Re: Entity System

Post by eatcomics »

XianForce wrote:Haha... That's why I always draw some flow charts =D - They usually help explain crap like that to me >.>
Same, and if I come up with a solution at night, I can't sleep until I write it down...
Image
XianForce
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 767
Joined: Wed Oct 29, 2008 8:36 pm

Re: Entity System

Post by XianForce »

eatcomics wrote:
XianForce wrote:Haha... That's why I always draw some flow charts =D - They usually help explain crap like that to me >.>
Same, and if I come up with a solution at night, I can't sleep until I write it down...
Unfortunately, my ideas come when I'm almost asleep - So I usually tell myself that I'll write it down in the morning, but then I forget >.>
Post Reply