SiO2 EventBus Events

There is SO much more to it than that. You just create lots of extra work for yourself in the end by doing things the “wrong” way. Go with the ES way as far as you can and it solves a lot of problems you didn’t even know you had yet.

1 Like

You misunderstood. I simply meant that you create all your HealthChange entities where you detect that it must happen, and then in some other System you work on only those HealthChange entities regardless of what created it. Then you can loop over those and accumulate it for every entity and choose what happens.

I wonder why you even need a single “killed by” component? If it’s possible for multiple things to commit damage then multiple things might have killed something.

Else, you end up as I said before where the person was hit by an explosion, 21 guns, and bitten by an ant… but the ant was processed first so the person was killed by an ant. It’s silly and arbitrary.

If in one frame, a bunch of HealthChange entities lower the health below 0 then create a bunch of KilledBy entities. The player was killed by all of those things.

You should call them HealthChange entities or something to indicate that these are separate entities just to hold the health change for some other entity.

Agreed. That’s is more clear.

Edit: I edited my posts to change this, for future readers.

Well probably because I am used to it from many Games.

Also I just realized that the order of damage is really irrelevant since it all happend in the same Frame anyway, so it is Impossible to tell the last hit (even inbetween the weapon system it would be useless)

Spot on.

If your damage system is projectile based you should apply the damage acoording to the impact time of the bullets. LastPos, HitPos, MovementSpeed should be enough to order the incoming bullets.
Of course only if you need the information at some point.

Sure if you have in one frame simultaneously damage then it is like @pspeed says, it’s just a random, maybe the one withe the biggest hit force. But yeah do it how you think it is right I only wanted to provide some ideas :slight_smile:

Yep, it’s done this way many times, especially in single player games. And this is actually an exploit: I recall, I could attack some big cruiser, get its return fire maneuvering in front of another one that some of the fire damage was taken by 2nd cruiser, resulting them effectively starting a duel, and when the one I wanted to destroy was at 2% hp or so - go back and finish it off. And in the scores - whoa, destroyed cruiser :slight_smile:
But Paul’s point is fair: it doesn’t work this way in multiplayer, say, 20-ppl raid, where you have to count of who did what dps share to the boss, you can’t just say: “This guy #16 killed it”.