Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
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.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
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.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
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.
Posts: 1,450
Threads: 53
Joined: Feb 2011
Thanks: 15
Given 120 thank(s) in 91 post(s)
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
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
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.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
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.
Posts: 1,450
Threads: 53
Joined: Feb 2011
Thanks: 15
Given 120 thank(s) in 91 post(s)
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.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
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.
Posts: 1,469
Threads: 57
Joined: Jul 2012
Thanks: 66
Given 127 thank(s) in 108 post(s)
Aren't cacti entities that cause damage?