When to use this prompt
Your browser game connects players directly with WebRTC and only needs somewhere to meet. Players behind strict routers may fail to connect, because we do not relay.
If you are not sure this is the right prompt, answer the five questions on the check first: it names the one prompt that fits.
The prompt
Status: Draft. The manifest is checked; the engine steps are not yet proven.
TASK: This browser game already connects players directly with WebRTC. Connect it to the NetCraftGames room signaling instead of your own signaling server. Do not change the game's WebRTC code.
1. Create a room with POST /api/public/games/<gameId>/rooms and the body {"maxPlayers": 4}. Join with POST /api/public/games/<gameId>/rooms/join and the body {"code": "ROOMCODE"}. maxPlayers is a whole number from 2 to 16. Both calls return {roomId, code, peerId, token, wsUrl, iceServers}. Open wsUrl with the room token and exchange offer, answer and ICE messages through it. Read the address and game id from the connection config, never hard-code them.
2. This service does NOT relay game traffic and has no TURN media relay. Players behind strict routers may fail to connect. Tell me how the game behaves when a peer cannot connect.
3. Write ncg.json with exactly this content. Change "signalingAdapterImplemented" to true only after you have wired the room signaling AND tested it with two browsers:
----- ncg.json (start) -----
{
"ncg": 1,
"game": {
"name": "My Game"
},
"version": "0.1.0",
"build": {
"dir": "./"
},
"manifest": {
"engine": "browser-wss",
"transport": "webrtc",
"platforms": [
"web"
],
"mode": "relayed",
"networkingImplemented": true,
"profile": "standard",
"signalingAdapterImplemented": true
}
}
----- ncg.json (end) -----
About ncg.json (the project file the ncg tool reads):
- Write it in the project root with exactly the content shown. Change only "game.name" (the real name of the game, 1 to 100 characters) and "manifest.platforms".
- This lane has no server build to upload: there is nothing to pack, and no program of yours runs on the host.
4. If the ncg tool is installed, run "ncg check" in the project folder. If it is not installed, say so.After your AI finishes
- Read what it changed. It was told to change only what the prompt lists and to stop and ask when something needs a redesign.
- Run the game with two real players. A prompt cannot prove your game plays well.
- Come back to the check and answer again, or run the local check the prompt ends with when you have the ncg tool.