here is the updated multiplayer demo with up to date physics and the new client authoritative replication(built with UE 5.4)
Sometimes the skidding (sound and mark) and smoke effects are activated at very low speed, would it be possible to set a minimum speed for these effects to start working?
ps: I mean wheel speed, not car speed, these effects are good in case of a burnout.
And where is the link for the example project with that new cars on the Fgear marketplace page? The link on description is the old example from 4.27. Âż?
Nevermind, they are in a new Sandbox2 level i just saw.
v1.8 is now available
- Unreal5.4 support
- Client authoritative replication
- Enhanced input support
- Rev-matching for manual transmission
- Replicated sleeping
- Forward offset option for wheels
Warning: If you have difficulty running the example project with Unreal5 copy the FGearPlugin folder in Unreal5\Engine\Plugins to FGearExample\Plugins folder.
Notes
- Checkout CoreModule.pdf document for a more detailed explanation of the new replication options.
- In client authoritative mode all the vehicles are simulating physics and the control over your vehicle is just like a standalone game. While the input replication is quite similar to the server authoritative mode, state replication is quite different. It is a combination of a network correction and temporary physics blending after collisions. We tried to handle collisions gracefully but you can still encounter bad collision reactions with bad network conditions.
- Client authoritative replication can blend replication transform with the physics transform. For this to happen we listen to the NotifyHit callbacks in the vehicle class and trigger the blend if the conditions are met. If the collision profiles of the vehicles are not properly setup then this blend may not be triggered at all and itâs difficult tell whether if itâs working or not. In order to diagnose such issues we introduced a new telemetry option called âPrint Collision Logsâ. When this is on you should see a log printed whenever two vehicles collide at a speed greater then MinCollisionBlendingSpeed. If you do not see the logs you can tell that there is a problem with the collision(hit event) setups. This log is only printed with the client authoritative replication mode.
- Existing server authoritative replication is still available but it is off by default. It can be turned back on via setttings in ProjectSettings > Game > FGearCommon.
- Each vehicle had its own replication settings and we had the option to override and use common settings(ProjectSettings > Game > FGearCommon). From now on we use the common settings by default and each vehicle can override the settings if needed.
- Removed buffered input replication. This prevents any input delay due to server slowdowns.
- Reduced default input send rate from 50 to 20 same as state send rate.
- Input and state replication variables are now compressed/quantized for reducing bandwidth costs.
- Input and state replications are no longer optional but you can set zero send rate for each to pause the RPCs.
- Added an AI driver following a spline loop in the Multiplayer map.
- Auto drive is no longer a component but an AIController. Instead of adding as a component you need to possess the vehicle with this controller. The controller wonât function with its default form so itâs better to derive from it and create a BP(there is a sample bp called FGearAutoDrive_BP in the sample project). Spawn the controller(you can both manually spawn or let the engine spawn it), tune itâs settings, provide a spline to follow(FGearAutoDrive_BP looks for the first spline in the map and assigns it at beginplay) and finally possess the vehicle. This is exemplified in the AITest map.
- Auto drive inputs were applied directly to the vehicle components before but now the inputs are applied via the standard input component. This made it possible to use it with both server & client authoritative replication modes.
- Auto drive is no longer ticking by its own but it is updated by the onOverrideInput delegate which is explained below. This letâs the AI inputs to be replicated properly.
- Removed overrideInputTick native event and added onOverrideInput delegate instead. This delegate is either called in the actor tick or the replication tick so we can also override inputs in multiplayer.
- Mobile input sample now uses the onOverrideInput delegate to inject UI inputs.
- Replication component used to override input-reading option of standard input. This is no longer needed and is not mandatory for input overriding.
- Checkout CoreModule.pdf document(StandardInput settings) for a more detailed explanation of how you can activate and use enhanced input system.
- We have added some basic enhanced input assets under FGearAssets/Inputs folder in the sample project.
- Raw input values can be accessed via BP now. This lets you keep current player inputs and modify/alter some of them.
- Open differential implementation used to check the wheel rotation speeds but it is only based on wheel load right now which is better at imitating an open diff.
- Torque bias ratio was unlimited for locking diff calculation, it is limited to 9:1 now.
- Manual transmission rev-matching is only for downshifting.
- A sleeping vehicle couldnât wake up in a multiplayer game, this is fixed now.
- Users can now query the visual location and rotation of each wheels with UFGearWheel.getWheelPosition and UFGearWheel. getWheelRotation functions.
- Forward offset of a wheel can be updated at runtime with UFGearWheel. setLateralOffsets function.
- Added a separate option to mute the engine sound when the vehicles goes to sleep.
- Added a config line(AspectRatioAxisConstraint) to the DefaultEngine.ini which prevents the camera fov change that started happening after 5.3.
- Fixed a crash case which happens when you put a vehicle in a sublevel and stream out in unreal5.
Great work as always @lazybitgames will check this out.
Is there a way to unbrick my project after updating?
Thank you for implementing âForward offsetâ and the option to keep the engine sound when the vehicle sleeps!
The plugin is compiling without problems for UE4, however it is necessary to enable the âEnhanced Input pluginâ, otherwise the plugin presents an error and does not load. The âEnhanced Input pluginâ is in Beta and does not have full functionality in UE4, I hope there is no risk of any conflict or loss of performance due to the plugin being loaded.
Still about the effects:
When the vehicle sleeps, the smoke particles disappear suddenly, I looked at the code and you are using âmSmokes[i]->SetVisibility(true / false)â, I am not a C++ programmer, I would like to know if it is safe for me to change it to: âmSmokes[i]->Activate() / Deactivate()â, this way the smoke would appear/disappear smoothly and the visibility would change anyway (in addition to the fact that an inactive emitter consumes less resources than an invisible one).
Activating and deactivating the tire smoke at runtime is essential for my project, since the âmEnableTireSmokeâ variable already exists and using âsetEnableSkidmarksâ as an example, if I create the following lines in FGearEffects.h, it would be possible to activate/deactivate the smoke safely at runtime?
UFUNCTION(BlueprintCallable, Category = FGear)
void setEnableTireSmoke(bool e) { mEnableTireSmoke = e; }
UFUNCTION(BlueprintCallable, Category = FGear)
bool getEnableTireSmoke() const { return mEnableTireSmoke; }
I would like to ask you to reconsider your position regarding improvements to the effects system, it is something that enriches the plugin and was one of the reasons that made me decide to purchase it. My suggestion would be:
Checkboxes to enable and disable engine sound and backfire.
A variable to determine when the wheel effects will start, âminSlipFXVelocityâ.
Two runtime functions: âenable/disable smokeâ and âenable/disable backfireâ.
Good but not essential: âFadeOutâ instead of âStopâ on sounds.
This would be more than enough to make the implementation of the effects much more viable, because at the moment itâs more like âuse all or nothingââŚ
Thanks
Destroyed function is removed in v1.8, using EndPlay instead, replace it and it should work.
it is safe to call activate/deactivate but the effect can be reactivated after sleeping.
I guess it is also safe if you add those functions to enable/disable smoke at runtime(you need to recompile the plugin or use the plugin source as a part of your project or just adding those lines will not make them appear in BP).
effects component was never intended to be used for production, we do some improvements from time to time but a generic implementation can not fit everyoneâs needs, so no promises.
I always need to recompile my plugins with RunUAT to run on UE4 Source.
I would then need a condition to prevent the smoke from activating when the vehicle is sleeping, and if I add â!= mSleepEventsRegisteredâ in the function below, would it work?
If so, which âifâ structure should I put it in? (if you could please rewrite the condition, to avoid mistakes on my part, I am completely new to C++)
//smokes
if (mEnableTireSmoke && cs && physicalMaterial->mSmokeParticle != nullptr)
{
if (mSmokes[i]->Template == nullptr || mSmokes[i]->Template != physicalMaterial->mSmokeParticle)
mSmokes[i]->SetTemplate(physicalMaterial->mSmokeParticle);
mSmokes[i]->Activate();
mSmokes[i]->SetWorldLocation(hit.ImpactPoint);
}
else
{
mSmokes[i]->Deactivate();
}
ps: Thinking better, instead of changing the visibility or activating, changing âmEnableTireSmokeâ to false/true would be easier, right?
Where would I replace it? I canât open the project at all.
Did you backup the old plugin?
If so, you could use it to remove the discontinued node and then update the plugin again.
Unfortunately, I donât have a backup of the plugin for 5.3
I guess one of your project dll is trying to access a function that no longer exists.
is this a BP only project, could you have overridden the âDestroyedâ function of the vehicle.
going back to the older plugin and checking that is a good idea, if you do not have backup, drop a mail with your unreal version and I can provide a link.
setting mEnableTireSmoke would work or you can edit the if case like this:
if (mEnableTireSmoke && cs && physicalMaterial->mSmokeParticle != nullptr && !mVehicle->getIsSleeping())
Thanks, Iâll try with the âifâ, because thinking even better now, if I change the variable, when the car wakes up the effect will be activated even if I had disabled it previously.
These were the changes, before compiling, can you please tell me if there is something wrong or am I forgetting something?
FGearEffects.h
UFUNCTION(BlueprintCallable, Category = FGear)
void setEnableTireSmoke(bool e) { mEnableTireSmoke = e; }
UFUNCTION(BlueprintCallable, Category = FGear)
bool getEnableTireSmoke() const { return mEnableTireSmoke; }
FGearEffects.cpp
//if (mEnableTireSmoke && cs && physicalMaterial->mSmokeParticle != nullptr)
if (mEnableTireSmoke && cs && physicalMaterial->mSmokeParticle != nullptr && !mVehicle->getIsSleeping())
//if (mStopEffectsWhenSleeping)
//{
// if (mSkidSoundComponent && mSkidSoundComponent->bIsPaused) mSkidSoundComponent->SetPaused(false);
// for (int i = 0; i < mSmokes.Num(); i++)
// {
// if (mSmokes[i]) mSmokes[i]->SetVisibility(true);
// }
//}
//if (mSmokes[i]) mSmokes[i]->SetVisibility(false);
if (mSmokes[i]) mSmokes[i]->Deactivate();
I successfully rebuilt the project. It now works. Thanks guys
if (mStopEffectsWhenSleeping)
{
if (mSkidSoundComponent && mSkidSoundComponent->IsPlaying()) mSkidSoundComponent->SetPaused(true);
//for (int i = 0; i < mSmokes.Num(); i++)
//{
// if (mSmokes[i]) mSmokes[i]->SetVisibility(false);
//}
}
if you want to pause the skidding sound effect leave that one, if not you can comment it all.
you donât need to call deactivate here since it will be called whenever the vehicles goes to sleep.
It worked perfectly, Thanks!
Disregard one of my suggestions for the effects âA variable to determine when the wheel effects will start.â I saw that it is possible to adjust this using the variables already exposed: âLong Slip Thresholdâ and âLat Slip Thresholdâ.