cEntity and physics
#1
I'm trying to rewrite cEntity in regard to physics. I'd like all entities to have their "speed" and to handle physics by default (overridable in subclasses). So that we can write the fluid interaction once, in the cEntity class and not in every subclass that is affected by fluids (basically everything except for players and falling blocks).

However, it is proving more difficult than at first anticipated. The most difficult part so far is the collision checking with the walls. Entities may be several blocks in diameter and in height, meaning several blocks need to be checked in each direction. It's one hell of a geometry nightmare. 3D Bresenham algorithm with fractional direction, yuck.
Reply
Thanks given by: Taugeshtu
#2
That could be awesome for things like projectiles, TNT, mobs, pickups in water and so on. I like that idea Smile
Reply
Thanks given by: Taugeshtu
#3
Also, it would mean that the cProtocol class won't need so many damn parameters for SpawnObject(), it could take them all from the cEntity class.
Reply
Thanks given by:
#4
I'm wondering, what's the reason for distinction between cEntity and cPawn? From what it seems, I'd say it's worth joining those two classes into one, simply cEntity should have all the stuff that cPawn has. All entities can take environmental damage, all entities do have some sort of physics simulation, all entities can be on fire (or set as non-flammable), all entities have health.
Reply
Thanks given by:
#5
Pawns are sentient, entities are not. It's called pawn because that's what it's called in the unreal engine but they also use a controller class which MCServer does not :p
Reply
Thanks given by:
#6
And is there any difference in sentient and non-sentient entity in MC / MCServer? I can't see one so far, data-wise. Maybe behavior-wise there will be one, but since cPawn descendants include cPlayer, there isn't much common behavior to them either. I think that class will become more and more a dud.
Reply
Thanks given by:
#7
Okay, one thing comes to mind as the difference between a cEntity and cPawn. cPawn objects have the ability to wield weapons and wear armor.
Reply
Thanks given by:
#8
Yup. I also don't see why an entity would need health?
In the UE you would specify things like movement speed and jump height, sounds and stuff like that in a pawn.
The controller would then use that information in its Ai.
Reply
Thanks given by:
#9
All entities in MC can move, so I'm actually moving the speed, adding momentum and other such things into cEntity directly (so that it can be used for the physics handling, too).
True that pawns will likely have more parameters - spiders can climb walls, squid can swim, ghasts can fly... These might get represented in the cPawn already.

The problem is, the TakeDamageInfo currently makes use of cPawn, so only a cPawn can cause damage. Dunno if that's alright, or will there be entities that cause damage and are not cPawns? (excluding projectiles, these will probably be handled differently, they will use their source entity (shooter) for TDI).
If I used cEntity in TDI instead, it would become difficult for plugins to test wielded weapons and armor, since those are only in the cPawn class, so they would need to test if the entity is a cPawn and only then test.
Reply
Thanks given by:
#10
Aren't cacti entities that cause damage?
Reply
Thanks given by:




Users browsing this thread: 4 Guest(s)