1
\$\begingroup\$

I've hit a loss in creating a "game engine" in XNA, I'm extremely confused over how to approach collision in an Entity-Part System ( following this as a reference ). I can make all the entities with a collision part speak with one another, but lets say the system I'm using to check collision between all the entities with a collision part picks up a collision how does it go "Oh, since the player is colliding with fire they should take damage" instead of only being able to check which entity should move if any and enacting that.

I've got the EPS set up in my project and all is working happily, I just really want to learn and I'm finding myself far too stuck on this problem to continue farther.

My past work with inheritance and checking these things was very uncomfortable as it checked collision then both objects ran a function that passed the other object in and then it was hardcoded to see what type of object it was and if it was a certain thing ( like an event box which lowers the players movement ) it would act onto that thing. It was just far to clunky and requires a lot of extra work to make sure there are no problems.

This whole concept just seems to fall apart for me when I think of collision including anything past position correction. I really want to learn and need help and will be very appreciative with anyone who can help me get this concept. I'm not sure why it's so elusive to me, and is causing me great distress that I just can't understand it despite thinking about it through most parts of the day the past two days. I just want to build a non-invasive and easy to understand system for this.

So far I just understand that I should attach a collisionPart to the entity and then in my EntityManager I'll add a system that can check through all these entities, determine collision, and act on that.

\$\endgroup\$
7
  • \$\begingroup\$ Are you thinking of an Entity Component System? For example: gamedev.stackexchange.com/questions/104355/… \$\endgroup\$
    – jzx
    Oct 22, 2015 at 6:34
  • \$\begingroup\$ Yeah, but I call it by that different name just to signal that it isn't a textbook entity component system. Oh my link didn't go through, I didn't even notice. I'll fix that. \$\endgroup\$
    – Zombleh
    Oct 22, 2015 at 15:28
  • \$\begingroup\$ The resource you provided is a GameObject with Components. Entity Component deals with implementation separated from data. A GameObject with Components treats the entity as a container, and is usually updated as a whole. The difference between these two is flexibility. The GameObject is more flexible, as update order is how the user defines it. It's also easier to keep data contained, and prevents the update cycle from being polluted. ECS is designed for simplicity, but you loose flexibility. ECS is not meant for complexity. Anyways... what Physics engine are you using? \$\endgroup\$ Oct 22, 2015 at 20:59
  • \$\begingroup\$ The game is 2/3rd's top-down perspective and my current plan is to implement everything on my own if possible. I intend to check for collision using per-pixel collision. I'm trying to do as much as I can on my own to learn more about what goes into an "engine". \$\endgroup\$
    – Zombleh
    Oct 22, 2015 at 21:51
  • \$\begingroup\$ Your last sentence pretty much summed up what you need to do if you are using an approximate version of an ECS. I'm struggling to see exactly which part of the concept you are getting stuck on? \$\endgroup\$
    – Lex Webb
    Oct 23, 2015 at 15:37

0

You must log in to answer this question.

Browse other questions tagged .