UnityRef is currently in early development. Some features may be incomplete and/or not functioning.

UNITYREF

Your Pit Stop For Solving ANYTHING in Unity

architecture

Netcode Architecture for Physics FPS

Under Audit

networkingmultiplayerphysicsproject architecturear development

Unity 6.4 - Unity 6.4

Published 5 days ago

Exploring optimal netcode architectures for high-frequency physics-based multiplayer games, specifically addressing challenges with GameObject vs. DOTS/ECS approaches for synchronized movement and combat.

Issue

 Developing a multiplayer movement FPS with physics-based mechanics presents significant challenges in selecting an optimal netcode architecture. The game involves high-frequency physics state synchronization, including wall running, grappling, swinging, and throwable weapon trajectories, for 8+ players on both mobile and PC platforms. The core concern revolves around the reliability and performance of physics synchronization across various architectural options. Several architectural approaches are under consideration: * GameObjects + Netcode for GameObjects: This familiar workflow is straightforward to iterate on, but raises concerns regarding its ability to handle the volume and frequency of physics state updates required, especially for complex interactions like grapple rope simulation and projectile trajectories. Performance on mobile hardware with high movement frequency for 8+ players is also a concern. * Full DOTS/Entities + Netcode for Entities: This option leverages Unity Physics, which is deterministic and designed for high-frequency simulation sync. However, it incurs a substantial migration cost from existing GameObject-based prototypes. Additionally, managing aspects not cleanly covered by DOTS, such as animation, VFX Graph, and character management, introduces significant development complexity, particularly for cross-platform targets. * GameObjects + Netcode for Entities: This hybrid approach aims to preserve an existing GameObject workflow for game logic, rendering, animation, and VFX, while utilizing Netcode for Entities as the networking layer. A critical uncertainty is how effectively Netcode for Entities, designed around ECS architecture, can sync GameObject-based physics. Questions arise regarding the preservation of core Netcode for Entities advantages, such as deterministic physics, proper client prediction, and rollback, if the underlying simulation uses Rigidbody components. The viability and support for such a hybrid model, especially at scale (8+ players cross-platform), remains unclear. Specific challenges include: * Physics Synchronization: Determining if Rigidbody with Netcode for GameObjects state sync is reliable enough for fast-moving physics bodies at scale, or if it will lead to constant desynchronization, particularly on mobile. For DOTS, understanding how Unity Physics determinism addresses sync problems and how client-side prediction and rollback are handled with Netcode for Entities. In the hybrid GameObject + Netcode for Entities path, it's questioned whether the determinism and prediction advantages of Netcode for Entities persist if the physics simulation relies on Rigidbody components. * Visual Effects, Animation, and Character Management in Full DOTS: Significant concerns exist regarding handling character animation (e.g., using Animator on separate GameObjects), VFX Graph integration without hybrid workarounds, and managing dynamic character switching in a pure ECS environment. * Hybrid Viability at Scale: Confirming if any stable middle ground, like the GameObject + Netcode for Entities hybrid or a DOTS for logic/physics with GameObjects for rendering/animation approach, is successfully deployed with 8+ players on cross-platform mobile and PC. The potential for hybrid approaches to create more problems than they solve is a key consideration.

Experimental Fixes
  • Optimize Rigidbody interpolation and extrapolation settings based on network conditions. * Implement client-side prediction and server reconciliation for player-controlled entities. * Adjust network tick rates and physics update frequencies to balance responsiveness and bandwidth usage.

Editor's Note:

The above fixes have not been verified by our audit team yet. They are provided exclusively for your own technical research. We recommend creating a backup of your project before proceeding with any attempts. Utilize at your own discretion!

Related Posts Haven't quite found a solution to your problem? We think these posts might help you.

Content inspired by a Unity discussion post.