OneCompanion

Nhà phát triển

Phát hành game trình duyệt của bạn trên OneCompanion.

Đọc hướng dẫn cho nhà phát triển

Mang game trình duyệt đến. Phần còn lại để chúng tôi lo.

Phòng chơi trực tuyến, tài khoản người chơi, lưu tiến trình, trang cửa hàng bằng 20 ngôn ngữ và ứng dụng máy tính của chúng tôi, miễn phí. Phát hành tại đây không độc quyền: game của bạn vẫn có thể có mặt ở bất kỳ đâu khác.

  • Chơi mạng không cần máy chủ

    Phòng relay và lockstep chạy ở phía chúng tôi. Game của bạn gửi byte; chúng tôi lo phòng chơi, liên kết mời, thứ tự lệnh và người vào sau.

  • Người chơi có sẵn

    Khách chơi không cần đăng ký, một tài khoản dùng cho mọi game, và tiến trình được nền tảng lưu giữ. Game chạy trên máy chủ có thể xếp hạng, với bảng xếp hạng và giải đấu.

  • 20 ngôn ngữ, trình duyệt và máy tính

    Trang cửa hàng của bạn đến với người chơi bằng 20 ngôn ngữ, kể cả viết từ phải sang trái. Game chạy trên trình duyệt và trong ứng dụng máy tính của chúng tôi, có khóa con trỏ, toàn màn hình và tay cầm khi bạn yêu cầu.

Đang có mặt tại đây

Game của các nhà phát triển độc lập chạy ở đây với phần chơi trực tuyến do chúng tôi thêm vào, và game của chính chúng tôi dùng cùng một hợp đồng như game của bạn.

  • Saltline Do @felixrieseberg làm ra, được chơi ở đây đúng như bản gốc. Chế độ chơi trực tuyến do OneCompanion thực hiện.
  • Lanternfall Do @loktar00 làm ra, được chơi ở đây đúng như bản gốc. Chế độ chơi trực tuyến do OneCompanion thực hiện.
  • Beaconyard Do OneCompanion làm ra.
  • Cinder Run Do OneCompanion làm ra.
  • Driftgate Do OneCompanion làm ra.
  • Voidwake Do OneCompanion làm ra.
  • Wrecktide Do OneCompanion làm ra.
  • Blindfire Do OneCompanion làm ra.
  • Ember Coast Do OneCompanion làm ra.

Studio của bạn

Đăng nhập để xem các studio của bạn.

Đăng nhập

Cách hoạt động

Bạn viết game bằng JavaScript hoặc TypeScript theo một hợp đồng nhỏ: một hàm mount cho phía máy khách và, nếu game cần, một mô-đun game cho máy chủ. Công cụ dòng lệnh của chúng tôi sẽ build, kiểm tra và tải game lên.

Đội ngũ của chúng tôi duyệt mọi phiên bản trước khi người chơi thấy. OneCompanion chạy game của bạn trong một khung sandbox: game không bao giờ thấy tài khoản người chơi, chỉ kết nối mạng qua phòng chơi của mình, và lưu dữ liệu qua nền tảng.

Nhiều người chơi

none
Chỉ chơi một mình, không có phòng.
relay
Phòng chuyển tin nhắn giữa người chơi. Hợp với game hợp tác và game vui nhóm. Không xếp hạng.
lockstep
Phòng sắp xếp lệnh của mọi người chơi theo từng bước và lưu nhật ký cho người vào sau. Mô phỏng của bạn phải tất định. Không xếp hạng.
server
Mô-đun game của riêng bạn chạy cạnh phòng chơi và quyết định mọi kết quả. Chỉ dành cho người được mời.

Phát hành bằng dòng lệnh

Tạo token trên trang studio, rồi chạy các lệnh này trong thư mục game:

Dùng Bun

git clone https://github.com/onecompanion-net/sample-game
cd sample-game && bun install
bun run validate
export ONECOMPANION_API=https://onecompanion.net
export ONECOMPANION_TOKEN=oc_…
bun run publish:game

Dùng npm

git clone https://github.com/onecompanion-net/sample-game
cd sample-game && npm install
npm run validate
export ONECOMPANION_API=https://onecompanion.net
export ONECOMPANION_TOKEN=oc_…
npm run publish:game

npm cài gói và chạy script, nhưng bản thân công cụ chạy trên Bun 1.3 trở lên, nên dù sao bạn vẫn cần cài Bun.

Bắt đầu game mới

Chưa có game? Hãy bắt đầu từ một mẫu nhỏ chơi được: solo, relay (người chơi dùng chung màn hình) hoặc lockstep (mỗi người điều khiển đơn vị của riêng mình). Mẫu vượt qua kiểm tra ngay khi tạo.

bunx github:onecompanion-net/game-cli init my-game --template relay
cd my-game && bun install && bun run dev

Bản dịch: lệnh i18n tạo mỗi ngôn ngữ còn thiếu dưới dạng bản sao tiếng Anh và in ra một câu lệnh để công cụ lập trình AI của bạn dịch. Bản tải lên sẽ bị từ chối nếu còn bản sao chưa dịch.

Đọc hướng dẫn cho nhà phát triển

Tích hợp bằng công cụ lập trình AI

Mở thư mục game của bạn trong Claude Code, Cursor, GitHub Copilot hoặc công cụ lập trình AI khác rồi đưa nó lời nhắc này. Nó sẽ đọc hướng dẫn của chúng tôi, điều chỉnh game cho nền tảng, kiểm tra và dừng lại trước khi xuất bản.

I want to publish my browser game on OneCompanion (https://onecompanion.net), which hosts it, lists it in its catalog and runs its multiplayer rooms. Help me integrate this project with the platform and get it ready to upload.

1. Read the developer guide first: https://onecompanion.net/developers/guide.md. It is the contract; where my code disagrees with it, the guide wins. When unsure, compare with the sample game: https://github.com/onecompanion-net/sample-game.
   Use the OneCompanion integration skill as well: https://github.com/onecompanion-net/skills (the skill is skills/onecompanion-integration). If it is not installed in this tool, read its SKILL.md and the reference files it points to; use its templates (contract, client, relay, lockstep, dev host) instead of writing them from scratch.
2. Study this project and show me a short plan before you change anything: the engine, how the game starts and what it draws into, where its text lives, how it saves, any network code, and which room kind fits (none, relay or lockstep; server only if we were invited).
3. Integrate without breaking how the game runs today:
   - Add game.json with "studio": "<my-studio-handle>", an "id" I approve (it becomes the URL and can never be reused) and "version": "1.0.0".
   - Add a client entry that exports mount(host, options) and returns { onMessage, pause, resume, dispose }. Copy the types from the guide into src/contract.ts; import nothing from the platform. Draw only inside host, send onEvent({ type: 'ready' }) after the first frame, and make dispose() undo everything (animation loops, timers, listeners, DOM nodes, WebGL contexts, audio, workers).
   - Move every player-facing string into messages/en.json and show it through options.t (ICU plurals for counts). Lay out with CSS logical properties so right-to-left works.
   - Save with options.storage instead of localStorage, IndexedDB or cookies. Remove fetch and WebSocket calls to other hosts; load our own files with relative URLs.
   - For multiplayer, send with options.online.send and receive in onMessage, using the guide's byte formats exactly, and validate every message. For lockstep, keep the simulation deterministic (the room's seed, no Math.random() or clock).
   - Write listing/en.json (with "play" and "modes" lines if they fit the game); step 6 translates it. Prepare the art at the sizes in the guide, set the rating, and list every third-party asset and its licence under rights.
   - Keep the client entry and its static imports under 450 KB gzip; load the rest with dynamic import().
4. Add the CLI as a dev dependency from GitHub, never from the npm registry by name: "bun add -d github:onecompanion-net/game-cli" (or "npm install -D github:onecompanion-net/game-cli"). Add the scripts "validate": "onecompanion-game validate .", "i18n": "onecompanion-game i18n ." and "publish:game": "onecompanion-game publish .". The tools need Bun 1.3 or later even when I use npm.
5. Copy the sample's dev page (index.html and src/dev.ts) so I can test solo, with ?net=room in two tabs, and with &lang=vi and &dir=rtl.
6. Run the i18n script and translate every file it marks "$untranslated" (the 12 launch store locales are required; in-game languages are up to me), removing the marker from each file you finish. Then run the skill's preflight check (node <skill folder>/scripts/preflight.mjs ., from an installed or cloned copy of the skill), then the validate script, and fix every issue until both pass.
7. Then stop. Tell me what you changed, what you could not do and what I should check by hand. Do not publish: I will set ONECOMPANION_API=https://onecompanion.net and ONECOMPANION_TOKEN in my own terminal and run the publish:game script. Never ask for the token, print it, write it to a file or commit it.

Thay <my-studio-handle> bằng mã studio của bạn, hoặc sao chép lời nhắc từ trang studio, nơi mã đã được điền sẵn.

Không bao giờ dán token studio vào khung chat AI. Hãy đặt nó trong terminal của chính bạn khi xuất bản.

Quy định

  • Sở hữu hoặc có giấy phép cho mọi thứ trong game, và liệt kê những gì bạn dùng của người khác.
  • Dịch trang giới thiệu game sang cả 12 ngôn ngữ. Chữ trong game cần có tiếng Anh; hãy thêm mọi ngôn ngữ bạn có thể.
  • Không giả lời nhắc đăng nhập, hộp thoại của nền tảng hay liên kết ra ngoài game. Phân loại game trung thực.