Skip to content

Build and start the server app in the browser for peer-to-peer games #244

Open

Description

@Tchips46

Which command is this feature request for?

build, start (and @nanoforge-dev/config)

Feature

Sub-issue of NanoForge-dev/Engine#284 (multiplayer without a game server). In peer-to-peer mode the game's server app runs in the host player's browser, so the CLI must build and start it differently.

Ideal solution or implementation

  • @nanoforge-dev/config: add network: "dedicated" | "p2p" to the workspace config (default dedicated).
  • nf build with network: "p2p": also build each server app with --target browser into the client's output, under server/. This runs after the client build, since that one resets the output.
  • nf start with network: "p2p": add NANOFORGE_NETWORK_MODE=p2p to the env of both apps. The engine reads it.
  • Dedicated mode is unchanged.

Other context

Engine side: @nanoforge-dev/network/server and @nanoforge-dev/ecs/server pick their browser builds on their own. In p2p mode the Bun server process only does WebRTC signaling, on LISTENING_TCP_PORT.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions