Skip to content

Implement Phase 1–2 Unity prototype foundation for WebGL/mobile co-op networking and player control#1

Merged
Keith skaggs (ksksrbiz-arch) merged 3 commits into
mainfrom
copilot/create-coop-survival-horror-prototype
May 17, 2026
Merged

Implement Phase 1–2 Unity prototype foundation for WebGL/mobile co-op networking and player control#1
Keith skaggs (ksksrbiz-arch) merged 3 commits into
mainfrom
copilot/create-coop-survival-horror-prototype

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 17, 2026

  • Phase 1: Networking (Relay + WebSocket transport + menu UI)
  • Phase 2: Cross-platform player controller + networked stats
  • Phase 3: Object-pooled inventory & interaction (ItemData, IInteractable, NetworkedPoolManager, ScrapPile, InventorySystem, PlayerInteractionRaycast, InventoryGridUI)
  • Phase 4: Scrap-metal building (BuildableData, BuildingManager with snap-to-grid + ServerRpc pooled placement, StructureHealth)
  • Phase 5: Escape mechanic (VehicleRepair with 3 required components, networked repair state, escape sequence)
  • Phase 6: Performant AI + sanity drain (EnemyAI state machine with throttled NavMesh updates, SanityDrain with darkness sampling + audio hallucinations)
  • Phase 7: Polish (DayNightCycle baked-friendly, PerformantFlashlight shadowless, ResponsiveCanvasScaler 1920x1080 adaptive match)
  • Run codeql_checker security validation (0 alerts) and finalize
Original prompt

Role: You are an expert Principal Unity Game Developer and Technical Architect. Your objective is to build an end-to-end prototype for a Co-Op Survival Horror Game with building mechanics in Unity, specifically optimized for Mobile (iOS/Android) and WebGL (Browser) deployment.
Project Overview:

  • Engine: Unity 2022.3 LTS (or newer).
  • Target Platforms: WebGL and Mobile (Cross-platform play).
  • Render Pipeline: Universal Render Pipeline (URP) configured for low-end mobile/WebGL (Mobile/Performance tier, minimal post-processing, baked static lighting).
  • Networking: Unity Netcode for GameObjects (NGO) + Unity Relay/Lobby. CRITICAL: WebGL requires WebSocket transport. You must configure the UnityTransport component to use WebSockets (UseWebSockets = true).
  • Theme: Industrial wasteland survival. Players must scavenge metal scrap, build defenses, and repair a wrecked off-road vehicle while hunted by an AI anomaly.
  • Architecture Pattern: Component-based architecture, ScriptableObjects for data, and Object Pooling for all instantiated entities to prevent Garbage Collection spikes on browsers/mobile.
    Execution Rules:
  1. Use the new Unity Input System and include the "On-Screen Controls" package for mobile touch support.
  2. Provide complete, production-ready C# scripts. Do not use placeholders like // Add logic here.
  3. Ensure all networked variables use NetworkVariable and RPCs are correctly implemented.
  4. Structure the project: Scripts, Prefabs, ScriptableObjects, Scenes, UI, TouchControls.
    Please execute the development of this game strictly following these phased steps.

Phase 1: Core Setup & Cross-Platform Networking

Goal: Establish the foundation, WebGL-compatible networking, and cross-platform architecture.

  1. Initialize a URP Unity Project and set the build target to WebGL.
  2. Import Unity Netcode for GameObjects, Multiplayer Tools, and the New Input System.
  3. Network Setup: Create a NetworkManager prefab. Configure UnityTransport and explicitly set UseWebSockets = true so the browser build can connect to the relay server.
  4. Write RelayManager.cs to handle Unity Relay connections (Host/Join via Join Code).
  5. Create a responsive, Canvas-scaled Main Menu UI.

Phase 2: Cross-Platform Player Controller

Goal: Create a responsive, networked player that supports both Keyboard/Mouse and Touch Inputs.

  1. Input Configuration: Create an Input Actions asset. Map Move (Vector2), Look (Vector2), Sprint (Button), Jump (Button), Interact (Button), BuildMode (Button).
  2. Touch UI: Build a Canvas with Unity's On-Screen Stick for movement (left side), a drag zone for camera look (right side), and On-Screen Button components for Jump, Interact, and Build. Hide this UI if the platform is not Mobile.
  3. Player Prefab: Create a capsule with a local camera.
  4. Networked Movement: Write PlayerController.cs (NetworkBehaviour). Ensure if (!IsOwner) return;. Implement smooth CharacterController movement and touch-friendly camera look logic.
  5. Survival Stats: Write PlayerStats.cs (Health, Stamina, Sanity) using NetworkVariable.

Phase 3: Object-Pooled Inventory & Interaction

Goal: Allow players to scavenge without tanking WebGL memory.

  1. Data: Create an ItemData ScriptableObject (ItemName, Icon, MaxStack).
  2. Object Pool: Write ObjectPoolManager.cs to handle spawning and despawning of interactive items (Scrap Metal, Car Parts) to avoid Instantiate/Destroy calls at runtime.
  3. Interactables: Create an IInteractable interface. Implement on a ScrapPile object. Utilize a touch-friendly raycast or overlap sphere (for mobile targeting leniency) to detect interactables.
  4. Inventory: Write InventorySystem.cs (Networked) and build a scalable grid UI.

Phase 4: Optimized Scrap-Metal Building

Goal: Construct barricades using mobile-friendly controls.

  1. Data: Create a BuildableData ScriptableObject.
  2. Ghost System: Write BuildingManager.cs. Because precision is hard on mobile, implement a "Snap-to-Grid" or robust auto-alignment logic for the translucent "ghost" prefab.
  3. Placement: Upon clicking the on-screen "Confirm Build" button, fire a [ServerRpc] to pull the networked building prefab from the Object Pool and spawn it.
  4. Durability: Add a StructureHealth.cs script.

Phase 5: The Escape Mechanic

Goal: Core map objective.

  1. The Vehicle: Create a low-poly 4x4 Off-Road Vehicle prefab.
  2. Repair Logic: Write VehicleRepair.cs. Requires 3 specific components (e.g., CarBattery, Alternator, SparkPlugs).
  3. Sync: Interaction syncs repair state via NetworkVariable. Trigger an optimized visual escape sequence when fully repaired.

Phase 6: Performant AI & Sanity

Goal: Introduce the threat without heavy physics calculations.

  1. NavMesh: Configure a baked NavMesh.
  2. Enemy AI: Write EnemyAI.cs using a simple State Machine and NavMeshAgent. En...

Copilot AI changed the title [WIP] Build end-to-end prototype for co-op survival horror game Implement Phase 1–2 Unity prototype foundation for WebGL/mobile co-op networking and player control May 17, 2026
@ksksrbiz-arch
Copy link
Copy Markdown
Contributor

Copilot id like you to continue implementing phase 1 and 2 end 2 end

@ksksrbiz-arch Keith skaggs (ksksrbiz-arch) marked this pull request as ready for review May 17, 2026 01:37
@ksksrbiz-arch Keith skaggs (ksksrbiz-arch) merged commit 701fed2 into main May 17, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants