cEntity and physics - Printable Version +- Cuberite Forum (https://forum.cuberite.org) +-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html) +--- Forum: Development (https://forum.cuberite.org/forum-13.html) +--- Thread: cEntity and physics (/thread-660.html) Pages:
1
2
|
cEntity and physics - xoft - 12-25-2012 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. RE: cEntity and physics - Luksor - 12-25-2012 That could be awesome for things like projectiles, TNT, mobs, pickups in water and so on. I like that idea RE: cEntity and physics - xoft - 12-26-2012 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. RE: cEntity and physics - xoft - 12-27-2012 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. RE: cEntity and physics - FakeTruth - 12-28-2012 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 RE: cEntity and physics - xoft - 12-28-2012 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. RE: cEntity and physics - xoft - 12-28-2012 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. RE: cEntity and physics - FakeTruth - 12-28-2012 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. RE: cEntity and physics - xoft - 12-29-2012 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. RE: cEntity and physics - bearbin - 12-29-2012 Aren't cacti entities that cause damage? |