零后端经验用 Claude Code 搭建 Cloudflare 多人游戏后端,如何避免烧光 token?
Оригинальный заголовок: Need help before I overspend my tokens and ruin my project/wallet.
Заголовок и краткое изложение на выбранном языке ожидают перевода.
一位零后端和 Cloudflare 经验的开发者,正靠 Claude Code 设计并实现一个词汇学习 Web 应用的多人游戏基础设施,需求包括基于 WebSocket 的实时房间(6 人 + 10 名观众)、随机房间码、断线重连、服务端权威状态、货币与每日登录防刷,以及 Firebase Authentication 与 Cloudflare 后端集成。
I’m building a vocabulary-learning web app that works on mobile browser/api and I have essentially zero backend/Cloudflare knowledge. Like, AT ALL. I know Cloudflare is a service that basically does all the connectivity things we see in games we play (daily login, showing users the same thing, multiplayer), but I’m relying heavily on Claude Code to design and implement the infrastructure since I just don't know how to do it.
My question is -- is it possible for Claude to do so, and what models/reasoning is best for the task? Have you ever had a similar experience with similar needs and can you share if Claude worked?
These are the things I need Cloudflare to handle (I used ChatGPT for this list and added some of my own wording):
- Real-time multiplayer rooms for several vocabulary games where people can join, trigger smalls stickers/animation, up to 6 people in a room + 10 spectators that just watch
- WebSocket-based multiplayer with fast/reliable updates between players. I want the real time gameplay to be as best as possible (the way games here work is that the game starts at the same time for all players, they see each others' points and progress in real time, and what they get in the game should be exactly the same from the app -- like some order of questions or animations for instance). however they don't actually really interact much with each other like say, a shooting game.
- Room creation using randomly generated room codes.
- Reliable disconnect/reconnect handling without losing the player’s game state.
- Handling temporary network drops, refreshes, app closures, host disconnects, etc.
- Keeping multiplayer game state authoritative on the server while still making the games feel instant on the client.
- Handle multiple changing online rooms at all times.
- manging/gatekepeing currency earning/daily logins/ etc so users don't exploit them
- Synchronizing scores, answers, combos, rounds, timers, game states, etc. between players.
- Preventing duplicate/out-of-order requests or other network problems from corrupting a match.
- Saving the final multiplayer results reliably once a match finishes.
- Designing the multiplayer architecture so it doesn't generate an insane number of Cloudflare requests. ChatGPT told me that it should be built in a way that does not just send tons of unnecessary requests.
- Making sure inactive multiplayer rooms aren't wasting resources.
- Firebase Authentication + Cloudflare backend integration
Thanks!
Источник: Reddit · ClaudeCode / Codex / VibeCoding · reddit.com