Culling Entities wont work properly if entity is already far away and its nearby to other players

Hi, im trying to create racing resource where you can race with local peds and vehicle.

im trying to use SetEntityDistanceCullingRadius Server Native to make the Task eg. taskvehiclechase works without issue even if the entity is very far away.

i read a lot about this native too in the forums and nobody reported or have this issue yet.

this will work without any issue if you are the only player in the server

or your only the player inside the culled distanced grid

. eg. 2000 radius culling is called to server side for entity.

The issue:

is if the entity is culled to large numbers like 2000.
and the first owner of entity is not moving or stay on the same spot while the entities are moving to assign locations, the problem will start if the Entity is nearby to other player. ( out of scope of first owner normal culling radius eg 400.0)

the entities are teleported back to first location of the spawned locations where the first owner.

More Info:
Peds and Vehicles Entities are spawned via Server RPC Createped and CreateVehicle.
Tasks are used in client side from the Host of race for example.

  • server side.
RegisterNetEvent('renzu_race:SetCullingRadius', function(data)
	inrace[source] = true
	SetEntityDistanceCullingRadius(NetworkGetEntityFromNetworkId(data.ped),4000.0) -- try set culling radius, prevent ped from stoping the task or having entity deleted if owner is very far away
	SetEntityDistanceCullingRadius(NetworkGetEntityFromNetworkId(data.vehicle),4000.0)
	SetPlayerCullingRadius(source,4000.0) -- just incase
end)
  • server side.

This is the entity dummy to followed by Taskvehiclechase

RegisterNetEvent('renzu_race:MoveDummy', function(net,coord)
	--print(NetworkGetEntityFromNetworkId(net),'moved',net,coord.x,coord.y,coord.z)
	SetEntityCoords(NetworkGetEntityFromNetworkId(net),coord.x,coord.y,coord.z+5.0)
end)
  • Client Side
            local ped = NetworkGetEntityFromNetworkId(v.ped)
			local vehicle = NetworkGetEntityFromNetworkId(v.vehicle)
			SetEntityInvincible(NetworkGetEntityFromNetworkId(dummy),true)
			--SetPedIntoVehicle(NetworkGetEntityFromNetworkId(dummy))
			SetBlockingOfNonTemporaryEvents(ped,true)
			TaskSetBlockingOfNonTemporaryEvents(ped,true)
			SetPedConfigFlag(ped,294,true)
			--TaskVehicleMissionPedTarget(ped,vehicle,dummy,8, 200.0, 4980736,1.0,100000.0,true)
			TaskVehicleChase(ped,NetworkGetEntityFromNetworkId(dummy)) -- need to do this logic to make the ped driver drive aggresively and faster, instead of using any other taskvehicle
			SetDriveTaskDrivingStyle(ped,4980736)
			SetTaskVehicleChaseBehaviorFlag(ped,1,true)
			SetTaskVehicleChaseIdealPursuitDistance(ped,1.0)
			SetDriveTaskCruiseSpeed(ped,300.0)
			SetPedAlertness(ped,3)
			SetVehicleUseAlternateHandling(vehicle,true)
			SetPedAsCop(ped,false)
			SetPedKeepTask(ped,true)
			SetEntityLoadCollisionFlag(ped,true)
			SetEntityLoadCollisionFlag(vehicle,true)
			print('set task', ped, vehicle)

other issue:
The thing that i have seen is i think the entity is re assign to other player who is nearby
and sometimes the tasks are forgotten and stay not driving.
or teleported back to original spawned location.

workarounds
i have tried setting the radius to default 0.0 or not use it
the teleport issue will be fixed but ofcourse the task will be forgotten once the entities are not nearby to any players

Last Method
im trying to avoid this , The last thing i am thinking is if this is a normal behavior of one sync.
i should just leave multiplayer feature with locals and i should just create a different world for the each race session for every single player if racing with local entities.

other info:
the entity id and net id are still valid and entity is existing
other player is in the other side like 1000 radius ( one of checkpoint )

video
https://streamable.com/uz3z2c

just incase i created an issue in github repo too
Thank

i removed the

SetPlayerCullingRadius(source,4000.0)

teleport bug is not happening anymore