Is there any particular reason why is the SyncedTransform update sending is based on frameCount instead of a delta time?
Could there be an option to change into delta time instead?
Is there any particular reason why is the SyncedTransform update sending is based on frameCount instead of a delta time?
Could there be an option to change into delta time instead?
Hi Gilderko,
The SyncedTransform
component is designed to synchronize game object positions and rotations over the network. It uses frameCount
for sending updates, which is often based on the concept of consistency between frames in a rendering loop. This can provide a smoother experience for fast-moving objects, as it allows the system to batch updates efficiently depending on frame rates.
Using deltaTime
would mean the updates would be dependent on the time elapsed per frame, which can vary significantly if the frame rate fluctuates. This could lead to inconsistencies in update frequency, especially in networked environments where timing is critical.
Currently, changing the mechanism to use deltaTime
instead of frameCount
isn’t a built-in feature, but it may be possible with custom modifications. You would need to adjust the logic in the onBeforeRender
function of the SyncedTransform
class to use deltaTime
for the update decisions instead of frameCount
.
Here’s a simplified illustration of what that might look like:
if (this._needsUpdate && (this.context.time.deltaTime > someThreshold)) {
// Send update logic
}
Make sure to consider the implications of this change on synchronization and performance during testing.
If you need a deeper integration or a specific implementation example, feel free to ask further questions!
1 replies left - Get a PRO license for more AI replies.
thread_tPW33M35jWW2Y6wDvnbnZ08x
Reply to this message to continue the conversation
Is there any way to adjust the FAST and Basic interval of frames between updates?
Hi Gilderko,
You can adjust the interval for FAST
and Basic
synchronization of the SyncedTransform
component by modifying the logic inside the component. Here’s a summary of how the FAST_INTERVAL
is calculated and used:
Fast Mode: This mode sends updates more frequently for fast-moving objects. It can be enabled by setting the fastMode
property.
Basic Interval Control: The basic sending interval is managed through the updateInterval
variable in the method that checks whether an update should be sent. This is set to 10
, meaning updates are sent every 10 frames by default.
Adjusting Intervals: You can replace the updateInterval
and the threshold logic within the onBeforeRender
method to the desired intervals.
Example of how to set custom intervals:
const customBasicInterval = 5; // Custom interval for basic updates
const customFastUpdateInterval = 2; // Custom interval for fast updates
if (this._needsUpdate && (customBasicInterval <= 0 || customBasicInterval > 0 && this.context.time.frameCount % customBasicInterval === 0 || fastUpdate)) {
FAST_ACTIVE_SYNCTRANSFORMS++;
if (fastUpdate && FAST_INTERVAL > 0 && this.context.time.frameCount % customFastUpdateInterval !== 0) return;
}
Feel free to adapt the intervals to your specific needs. This will impact the frequency at which your transforms are synchronized across clients effectively.
Let me know if you need any further assistance!
1 replies left - Get a PRO license for more AI replies.
thread_tPW33M35jWW2Y6wDvnbnZ08x
Reply to this message to continue the conversation
Hi – would you mind describing your usecase a bit more?
Well the problem is that on a more powerful hardware like laptops or desktop PCs I am getting well over 60 FPS and when I join into a room using for example a phone or a VR device there is just unnecessary ammount of messages going into my BE server from the more powerful device.
When you couple this with several items moving at the same time you cat get quite a lot of somewhat unnecessary messages.
Thanks for the context.
Needle limits FPS to 60 by default. Is it intentional that you want these devices to run faster framerates? (modern laptops and monitors might have north of 240fps, and usually don’t have the GPUs to back that up)
I am trying for above 60FPS for the VR experience as approx 90FPS is a good value for a decent experience. But I have already managed to reduce the ammount of message by giving up the ownership of objects and synchronising after moving the root object.
The only thing I would like to ask for is a simpler way to giving up ownership of SyncedTransform items since as of now the only way is to call onDisable() which is somewhat clumsy.
Thanks for your feedback. We’ll add an extra method to free ownership and will look into your original question about FPS<>time being used for updates.
This topic was automatically closed 13 days after the last reply. New replies are no longer allowed.