Shared Camera
The Shared Camera is a specialized version of the Game Creator 2 Main Camera, optimized for local multiplayer. It features Dynamic FOV adjustment, raycast occlusion detection, and seamless integration with split-screen functionality.
Main Camera Integration
The Shared Camera can be referenced using Game Creator 2's Main Camera property, ensuring compatibility with existing systems.
Assigning Shared Camera
When Local Multiplayer is initialized, it will search the active scene for the main Shared Camera by first looking for the GameObject tagged with the "MainCamera" tag. If it does not find the Shared Camera that way, it will then look for the first object with the Shared Camera component. If no Shared Camera is located, an error will be displayed in the console.
Dynamic FOV Settings
The Dynamic FOV feature automatically adjusts the camera's field of view to keep all Local Players visible:
Configuration Options
- Enable Dynamic FOV: Toggles the dynamic FOV functionality
- Max FOV: Maximum field of view the camera will expand to
- Min FOV: Minimum field of view the camera will contract to
- Padding: Distance from screen edges before FOV adjustment triggers (lower values mean tighter bounds)
- Update Interval: Frequency of FOV updates (higher values create smoother transitions at performance cost)
Visibility Settings
Control when and how the view transitions between shared and split-screen modes:
- Inner Margin: Controls player proximity requirement for shared camera view
- Higher values: Players must be closer together
- Lower values: Players can be further apart
- Margin Buffer: Creates two different zones using the Inner Margin to establish a buffer zone that allows players on the edge to still be considered visible
Split Screen Flickering
If you experience rapid switching between shared and split-screen views:
- Try increasing the Inner Margin
- Adjust the Margin Buffer if needed
- Consider adding a transition delay
Raycast Occlusion Settings
The Shared Camera includes intelligent occlusion detection to determine when players are blocked from view:
Configuration Options
- Use Raycast Occlusion: Enables raycast-based visibility checking between the camera and players
- Occlusion Layer Mask: Defines which layers can block the camera's view of players (typically walls, terrain, and large objects)
- Visibility Threshold: Controls how much of a player must be visible to avoid triggering split-screen (0.8 = 80% visibility required)
- Test Points Per Player: Number of raycast points used to test each player's visibility (more points = more accurate detection but higher performance cost)
How It Works
The system casts multiple rays from the camera to each player to determine if they're occluded by geometry. When a player becomes sufficiently blocked (below the Visibility Threshold), the camera will transition to split-screen mode to ensure all players remain visible.
Performance Considerations
- Higher Test Points Per Player values provide more accurate occlusion detection but impact performance
- Start with 1-3 test points and increase only if needed
- Use selective Layer Masks to avoid unnecessary collision checks
Combined Features
Dynamic FOV, Dynamic Split Screen, and Raycast Occlusion work together to create adaptive viewing experiences:
- FOV adjusts to keep players visible when they're in view
- Occlusion detection handles line-of-sight blocking
- Seamlessly transitions to split-screen when players are too far apart or blocked
- Creates fluid, intelligent multiplayer camera behavior
Best Practices
- Start with default values and adjust based on gameplay testing
- Balance Update Interval for smooth transitions vs. performance
- Test with maximum player count to ensure proper FOV ranges
- Configure Layer Masks to include only relevant blocking geometry
- Consider game-specific requirements when configuring visibility margins and occlusion settings
- Test occlusion detection in complex level geometry to ensure proper behavior