New Sports Vehicle
A new vehicle has been added to the Plugin and can be tested in the Demo, it’s the Sports Car. Thanks to the new Animator Component, vehicle now supports Tilt and Roll animations. Those animations can be configured independently from the physics to give the vehicle a more realistic feeling while keeping the cool and simple arcade logic under it.
This new component is responsible for handling everything that’s related to the vehicle’s animations. Previously, some variables needed by the Animation Blueprint were computed directly in the main VehicleSystem class which was a little confusing as those settings were not needed by the Physics Vehicle System to work.
Now all those properties have been moved to the ArcadeVehicleAnimator whose only job is to look at the Vehicle state and computed all the right values for the Animation Blueprint.
The Animator is responsible for calculating the following:
- Wheels direction angle
- Wheels rotation angle
- Drift direction
- Tilt and Roll angles
Suspension offsets for the wheels are still computed buy the vehicle system. This should change in v1.2
The latest Tilt and Roll settings are brand new and add a lot of realism to the vehicle are completely parametrable. As those values are computed and not generated by the physics engine, it means that you can tweak the physics of your vehicle and its animations separately without having one influencing the other.
Some new properties have been added to the Vehicle System
- MaxReverseSpeed: yes you could previously reach huge speeds just by going in reverse continuously…
- DriftRecoverDuration: this is to avoid the issue where the car would appear to recover too fast from a drift, you can now decide how long it will take before its adherence is back to 100%
- DisableLinearDampingInAir: this settings will allow the car to keep all its momemtum while being airborne. This is handy for vehicle with hight linear damping that still need to do big long jumps.
- AccelerateBrakeOffset: this setting will allow the vehicle to tilt by applying an offset to the position where the acceleration and brake forces are applied. This means that the tilt is computed by the physics engine. You should not use this setting if using the Animator. This settings will impact the simulation and could cause side effects. If possible its recommended to use the Animator for all Tilt and Roll animations.
Networking / Replication
I’ve started working on networking. The first step has been to network the BaseController class. There’s now a blueprint networked base controller class that can be used as the GameMode controller to play in networked multiplayer.
The current version is server authoritative and does not have client prediction. Getting a Physics based system to work nicely with networked physics is a very hard task (you can check unreal’s forums if you’re curious :)).
Even with a server authoritative implementation without client prediction the result is jerky. The vehicle looks great server side and on the other clients as a simulated proxy but it does not behave properly on the local client. This is due to the physics state replication.
There’s may possibilities that needs to be tested, mainly:
- Overriding the actor’s replication code so that even if the actor is physically simulated, only it’s position and rotation are set, not its physics state. Then add some interpolation code to smooth out the reconciliations. This may even be done by using the Projectile Movement component which already has all the code for doing the interpolations.
- Switching to client authoritative
- Rewriting the system so that it’s kinematic. That’s the most time consuming but definitive solution. That’s actually what the CharacterMovementComponent is doing.