Development Logs: Entity Movement Code

So update time, been working on some proper movement code, its now handled and calcualted by the entities themselves not in the client/server loops, all the loops do now is tell the entity if they are moving and what modifier to apply to their movement speed. Speaking of, entities now have their own built in movement speed. When they update their location component it will check to see if the entity has a movement component and if it does it will update the position internally based on the entity’s movement speed, which is by default 400, and will apply modifiers to that movement speed.

So say someone is only slightly pushing on an analog stick, the entity will not move at full speed. The server can also do this, the entites move at about four pixels per update by default, so if we wanted to apply a “slow” debuff we would just set the movement modifier to 0.25f and the entity would do the math from there.

Need to do a bit of tweaking to get the server’s modifiers linked up with the clients, so say an analog stick is about 50% moved, we would want to convert the 0.5f the client sends to 0.125, though this is a moot thought becuase thinking about it buffs and debuffs are going to be applied directly to the base movement speed calculation. More soon!

Leave Comment