用这个模板做的 2 个案例
同一份提示词,不同的 [VARIABLES] 变量。点一个在上方预览。关于这个模板
火星殖民地建造游戏是一款单屏策略游戏。默认殖民地为 Hearthline,由 Amberline Survey 在 Tallow Crater 建立。首屏是盆地:一个等距 12×12 网格,锈色地面,隆起的边缘,六块巨石,一座铜色居住舱,以及一层尘雾,盆地之上有深色玻璃柱。帮助日志中提到了 Nia Calder、Omar Voss 和 Priya Sen。
每个火星日允许一次放置、一次拆除或一次跳过,然后点击“推进火星日”。居住舱可供八人休息。太阳能阵列产生 10 点电力,沙尘暴中为 5 点,若与居住舱或温室共享一条正交边则更少。温室产生 8 点氧气,若接触居住舱则为 16 点。冰钻增加 20 点水,但在居住舱旁会额外损失士气。四项库存的数值范围均为 0 到 100。当电力需求得到满足、每项库存至少为 35 且有空余床位时,会到来两名殖民者,上限为 50 人。任何一项库存归零则本局结束。沙尘暴持续四个火星日,并在第 8、18、30、44、60 和 78 个火星日开始。预览使用与“推进火星日”相同的结算逻辑。
HUD 为深色玻璃风格,以铜色点缀显示火星日、预报、库存、床位和建造卡片。手机端提供拇指栏和点击放置,桌面端额外支持键盘光标。localStorage 会保存网格,因此“继续勘测”可以接着上一局继续。减少动态效果模式会将飘动的尘土替换为平坦的沙尘色调。它适合想要短小规划谜题的玩家,也适合将其作为静态文件发布的开发者。五个变量分别控制殖民地、陨石坑、探险队、标语和受众。Vesper Basin 中的 Saltmere 保留了所有产出和相同的日历。绘制始终在 canvas 上进行,并配有简短的合成音效。
模板提示词
在线演示就是用这份提示词原样做出来的,没有额外补充。其他案例只是改了 [VARIABLES] 变量的值。 提示词保持英文原版,国内常用的 AI 编程工具都能直接理解;下面附中文参考译文。
# Mars Colony Builder Game Build this website exactly as described below. Replace the [VARIABLES] with your own values; keep everything else. ## Brief Build [BRAND], a single-screen turn-based colony game in [CRATER], founded by [EXPEDITION]. The player places habitats, solar arrays, greenhouses, and ice drills on a code-drawn isometric crater, then advances one sol at a time. Oxygen, power, water, and morale tick together. Dust storms last four sols and cut solar yield. Colonists increase only when beds and all four stocks allow it, up to 50. The grid and stocks persist in localStorage. Default tagline: [TAGLINE]. The crater, one habitat, and a dust haze are already on screen between glass columns that hold the title and the HUD. - Audience: People who enjoy short planning puzzles, including [AUDIENCE], plus indie hackers and front-end developers who want a self-contained canvas game with keyboard and touch controls. The help text stays short, the first storm is on a known sol, and a failed sol can be retried. - Goal: Ship one complete loop: a title column over a live crater, one structure change per sol, a preview that uses the same tick as Advance sol, storms, growth to 50, a win overlay, a failed-expedition overlay, resume from localStorage, and equivalent play at 1440x900 and 390x844. - Tone: Calm, practical, and a little dry, like a field log from a small survey. Short US English, concrete yields, no exclamation marks, no epic colonization slogans, and no jokes about abandoning anyone on a planet. ## Stack - Framework: Vite 5 + React 18 + TypeScript - Styling: Tailwind CSS 3.4 - Libraries: react 18 (MIT), react-dom 18 (MIT), lucide-react (ISC), @fontsource-variable/fraunces (OFL-1.1), @fontsource-variable/outfit (OFL-1.1), @fontsource/ibm-plex-mono (OFL-1.1) - Build: `npm run build` → static files in `dist/`. No backend, no server code, no external APIs. - Setup: - Scaffold Vite 5 with the React TypeScript template. Scripts: dev=vite, build=tsc --noEmit && vite build, preview=vite preview. Package name is the slug of BRAND. Install react 18, react-dom 18, lucide-react, and the three fontsource packages as runtime dependencies. Install vite 5, typescript 5, tailwindcss 3.4, postcss, and autoprefixer as dev dependencies. Do not add a game engine, router, physics library, canvas helper, tween library, or audio files. - vite.config.ts sets base to './', build.outDir to dist, build.emptyOutDir to true, and build.sourcemap to false. tsconfig strict is true. Tailwind content covers index.html and src. Extend colors and font families from the Design section. All custom CSS, the glass panel rule, and prefers-reduced-motion live in src/styles.css. - Import Fraunces variable and Outfit variable in src/main.tsx from @fontsource-variable/fraunces and @fontsource-variable/outfit. Import IBM Plex Mono 500 from @fontsource/ibm-plex-mono/500.css. Map them to font-display, font-sans, and font-mono. Never load a font CDN. - Use src/content.ts, sim.ts, draw.ts, audio.ts, save.ts, App.tsx, main.tsx, and styles.css. sim.ts is pure TypeScript with no React and no Math.random. draw.ts owns the canvas and the seeded dust. App.tsx owns tool choice, the pending action, overlays, and keyboard focus. Every player-facing sentence lives in content.ts. - If BRAND, CRATER, EXPEDITION, TAGLINE, or AUDIENCE differ from the defaults, rewrite the roster, title body, win and fail sentences, and log lines so the new proper nouns read naturally. Keep building names, yields, the grid, colors, and the storm calendar. For the Saltmere set exactly, the roster is Imani Okonkwo, Leo Hart, and June Pell. For any other non-default set, invent three new people and drop Nia Calder, Omar Voss, Priya Sen, Tallow, and Amberline. Never render raw bracket placeholders. - The document title is BRAND + ' — ' + CRATER. Ship public/favicon.svg as a copper ring around a small isometric diamond, using the copper and basalt hexes, and link it with a relative href. One index.html, no router, no second page. - Cap device pixel ratio at 2. Pause the dust animation when the document is hidden. Dispose the audio context and animation frame on unmount. The production dist has no source maps, no copied src, and stays under 20 MB. ## Variables - [BRAND] — Colony name (default: "Hearthline"). An invented colony and game title. Never a real agency, company, rover, or mission. - [CRATER] — Crater name (default: "Tallow Crater"). An invented basin name used in the title column, forecast toasts, and win copy. - [EXPEDITION] — Founding expedition (default: "the Amberline Survey"). A short invented group name. The eyebrow drops a leading 'the' and uppercases the rest. - [TAGLINE] — Colony tagline (default: "Fifty beds against the dust."). One short original line under the colony name in the title column and on the win dialog. - [AUDIENCE] — Player audience (default: "players who like short planning puzzles"). Used once, in the help introduction. - [CREDIT] — keep a small "Template by VibeFather" link to https://vibefather.ai/t/mars-colony-builder-game in the footer (default: yes; delete this line to remove it) The copy under Pages & Sections is written for the default values. If your values differ, rewrite every headline, paragraph, label and image for them — same length, tone and structure. Layout, colors, type and motion stay as described. Keep all copy, image paths and links in one content file (for example `src/content.ts`), keyed by section, so the content can be swapped later without touching components. ## Design ### Colors - Basalt `#14110F` — Page background, canvas void, and dialog scrim base - Glass `#1C1814` — HUD panels at 90 percent opacity with a 14px backdrop blur - Copper `#E39B54` — The single accent: habitat dome, primary button, selection, focus ring, panel border at 35 percent - Copper deep `#A86B38` — Habitat skirt, pressed button, and dome shadow - Regolith `#C4784E` — Lightest basin floor tile - Regolith mid `#B56545` — Middle basin floor tile - Regolith dark `#A85A3C` — Darkest basin floor tile - Rim `#5C3428` — Crater wall top - Rim face `#3F241C` — Crater wall south face, doors, and greenhouse base - Dust `#C4A574` — Haze particles, storm veil, and boulder highlight - Parchment `#F3E6D4` — Primary text and habitat window - Clay `#B7A394` — Secondary text, solar mast, and inactive tool labels - Sage `#8FB573` — Oxygen bar and greenhouse panes - Ice `#B7D0D6` — Water bar and drill bore - Morale clay `#D9896A` — Morale bar - Warning `#E07A5F` — Stocks under 25, invalid cells, and Advance anyway - Panel ink `#1C120C` — Text on copper buttons - Array cell `#3E4C55` — Solar panel fill ### Typography - Colony name, win and fail headlines, sol numeral: Fraunces (OFL), weights 600/700 - HUD labels, help, buttons, and body: Outfit (OFL), weights 400/500/600 - Stock numbers, forecast, and bed counts: IBM Plex Mono (OFL), weights 500 ### Layout & motion - Spacing: A 4px unit. The page is 100dvh and does not scroll. Desktop at 1100px and wider uses two 320px glass columns over a full-bleed canvas, with 20px column padding and 24px top and bottom crater insets. Below 1100px, including 390px, the canvas is the top region and a bottom sheet holds the HUD, with 12px sheet padding, 48px button heights, and safe-area insets. The center habitat stays in the open canvas between the columns. - Radius: 12px glass panels, 14px dialogs, 10px buttons, 999px forecast chips and stock tracks. The canvas is square-cornered and full bleed. World shapes are diamonds, domes, and masts, not rounded app icons. - Motion: Dust is the only continuous motion: 32 seeded particles drift right at 0.6 CSS pixels per frame and wrap the crater bounds. A storm raises the count to 64 and adds a flat Dust veil at 0.18 alpha. - Motion: When motion is allowed, stock fills ease width over 160ms. Overlays fade opacity over 140ms with no travel greater than 8px. Buttons do not bounce. - Motion: With prefers-reduced-motion, draw no particles, snap stock fills, use instant overlays, and keep a storm as the flat Dust veil only. Placement, removal, and sol resolution stay immediate. - Motion: Stop the animation frame while the tab is hidden. Do not shake the canvas, flash the veil, or autoplay sound. - Imagery: Draw the crater, rim, boulders, four structure types, selection, dust, storm veil, favicon, and build-bar glyphs in canvas and inline SVG. No photographs, generated images, downloaded textures, or sprites. The first screen's anchor is the centered habitat dome on the rust basin, with the glass HUD already readable around it. ## Pages & Sections ### [BRAND] — [CRATER] (`index.html`) 1. **Title column over the live crater** — The document title is [BRAND] — [CRATER]. Title and play share one frame: a full-bleed canvas and, at 1100px and wider, two 320px glass columns. Do not add a second card on top of the columns. Before Open or Resume, the left column leads with the eyebrow, [BRAND], [CRATER], [TAGLINE], the body, Open the basin, and Resume survey, then still shows SOL 1, the forecast Storm in 7 sols, the population line, and the four starting stocks. The right column shows the four build cards, Remove, and Advance sol, visible and aria-disabled at 55 percent opacity. The center canvas is the new-game crater, with the habitat at column 5, row 6 in the open gap between the columns. Below 1100px the canvas stays on top so the dome remains visible, and the bottom sheet leads with the same title block, then the compact stocks and the disabled thumb bar. The eyebrow is the expedition name without a leading the, in uppercase Outfit with 0.16em tracking. For the default that is AMBERLINE SURVEY. Body: Place one structure a sol. Keep oxygen, power, water, and morale above empty until 50 colonists have beds. Resume survey is always visible and disabled when no save exists. If a save exists, Open the basin asks Replace the saved survey of [BRAND]? with Replace and Keep it. After Open or Resume, remove the title actions and the body, keep the brand block, and enable the build controls. If a credit string is supplied by the build, show it as quiet Clay text under the title buttons and at the bottom of help. Otherwise omit it. Do not invent a credit, a date, or a price. Layout: Desktop columns are absolute, full viewport height, Glass at 90 percent opacity, 20px padding, and a 1px copper border at 35 percent on the edge that faces the crater. The primary button is copper with Panel ink text and 48px tall. The secondary button is a transparent copper outline. Focus rings are 2px copper with a 2px offset. The mobile sheet is full width, with 12px radius on the top corners only, and it does not cover the center of the canvas. Motion: The columns fade in over 140ms after the first crater paint. They do not float or slide. Reduced motion shows them on the first paint. 2. **Isometric crater grid** — The grid is 12 by 12, columns c and rows r from 0 through 11. Column increases east and row increases south. For each cell, d2 = (c * 2 - 11) squared plus (r * 2 - 11) squared. If d2 is greater than 128 the cell is void and is not drawn. If d2 is greater than 84 it is rim and cannot be built on. Otherwise it is floor, except the boulder cells (2,4), (8,3), (4,9), (9,7), (3,7), and (7,8), which are blocked floor. That is 62 buildable floor cells, 6 boulders, and 28 rim cells. A correct terrain function must match those counts. The new game places one habitat at (5,6) and nothing else. Tile width is 72 and tile height is 36 before fit. Screen position before offset is x = (c - r) * 36, y = (c + r) * 18. Draw non-void cells in ascending (c + r) order. Floor fill cycles by (c * 3 + r) modulo 3 through Regolith, Regolith mid, and Regolith dark, with a 1px stroke at rgba(62,32,24,0.45). Rim uses Rim for the top diamond and a south face 7px lower in pre-scale pixels filled Rim face. A boulder draws the floor diamond, then three circles around the tile center: radius 10 at (-6,-4) in #6A3E30, radius 8 at (7,-1) in Rim, radius 7 at (0,6) in #4A2C22, plus a Dust highlight on the first circle. The canvas behind the grid is a vertical gradient from #2A1A14 to Basalt and a wide ellipse of #6E3B2C at 20 percent alpha. Fit the bounding box of non-void diamonds into the playable canvas rect with 16px padding, uniform scale capped at 1.35, centered. At 1100px and wider the rect is the viewport inset 320px on the left and right and 24px on the top and bottom. Below that, the rect is the canvas element. Layout: One canvas element fills the viewport and sits under the HTML HUD. Set its bitmap size to the CSS size times the capped device pixel ratio and scale the context. Rebuild the fit on resize. Hit testing inverts the fit: fx = x / 36, fy = y / 18, c = round((fx + fy) / 2), r = round((fy - fx) / 2). Ignore void. The status line reports the cell under the pointer or the keyboard cursor. Motion: The grid itself does not animate. Only dust, the storm veil, and the selection stroke change between paints. 3. **Four structures and adjacency** — Each structure occupies one floor cell. Orthogonal neighbors count. Diagonals, rim, void, and boulders do not. Shade on a solar is the number of orthogonal habitats and greenhouses. Clear solar yield is max(2, 10 - 3 * shade). Storm solar yield is max(1, 5 - 2 * shade). An open array is 10 clear and 5 in dust. One tall neighbor makes 7 and 3. Two make 4 and 1. Three or four stay at the minimum, 2 and 1. A greenhouse makes 16 oxygen if at least one orthogonal neighbor is a habitat, otherwise 8. It always costs 4 power, 2 water, and gives 2 morale when the grid is powered. A drill makes 20 water, costs 3 power, and costs 1 morale plus 2 more for every orthogonal habitat, when powered. A habitat sleeps 8, costs 2 power and 1 water, and gives 1 morale. Drills do not shade solars. Draw at tile-local pixels for a 72-wide tile, then multiply by the fit scale. Habitat: skirt ellipse (0,6, rx 20, ry 8) in Copper deep, dome (0,-2, rx 18, ry 12) in Copper, door rect (-3,2, 6 by 8) in Rim face, window (-6,-6, 12 by 3) in Parchment. Solar: mast from (0,4) to (0,-14) in Clay, panel through (-16,-18), (10,-18), (18,-8), (-8,-8) filled Array cell and stroked Copper. Greenhouse: base ellipse (0,6, rx 18, ry 7) in Rim face, vault ellipse (0,-2, rx 16, ry 11) in Sage at 85 percent with an Array cell stroke, pane lines at x -5 and 5. Drill: base ellipse (0,8, rx 14, ry 6) in Rim, tower rect (-4,-16, 8 by 24) in Clay, collar (-6,-6, 12 by 4) in Copper, bore ellipse (0,-16, rx 4, ry 3) in Ice. A pending placement draws at 50 percent alpha. The selected cell is a 2px Copper diamond. An illegal cell is a 2px Warning diamond and does not spend the action. Layout: Build-bar glyphs are inline SVG in the same silhouettes and hexes, 28px, not Lucide pictures of unrelated objects. The HUD status line uses the keyboard cursor or the hovered cell. Examples: Column 5, row 6 · Habitat. Column 2, row 4 · Boulder. Open floor · Solar yield 10 clear / 5 dust. Rim and void never show a yield. Motion: Ghosts and selection have no pulse. Reduced motion does not change the drawings. 4. **Sol tick, storms, growth, win and fail** — Keep all of this in sim.ts and call it for both the preview and Advance sol. Stocks are integers from 0 to 100. New game: sol 1, population 6, oxygen 74, power 46, water 64, morale 68, one habitat at (5,6). A storm is active on sols 8 through 11, 18 through 21, 30 through 33, 44 through 47, 60 through 63, and 78 through 81, then on every run of four sols that starts at 96, 114, 132, and so on, stepping by 18. Supply is the sum of storm yields during a storm and clear yields otherwise. Demand is habitats * 2 + greenhouses * 4 + drills * 3, counted after the pending action. The grid is powered when power + supply is at least demand. If powered, power changes by supply minus demand, water by drill water minus habitat and greenhouse water minus population, oxygen by greenhouse oxygen minus population, and morale by habitat and greenhouse morale minus drill penalties. If not powered, greenhouses and drills idle: they add nothing and cost nothing that sol, power changes by supply minus habitats * 2, water by minus habitats minus population, oxygen by minus population, and morale by habitats minus 6. Then, using population before growth and housing after the action, add 2 morale when population is less than or equal to housing - 8, subtract 4 when population equals housing and housing is positive, and subtract 8 during a storm. Clamp each stock to 0 through 100. If any stock is 0, the tick fails and population does not grow. Otherwise, if the grid was powered and every stock is at least 35 and population is below both housing and 50, population grows by min(2, housing - population, 50 - population). Sol then increases by 1. A failed tick is not committed. The fail dialog shows the clamped outcome and the sol that was just attempted. Retry and Leave discard it. Retry also clears the pending action and returns to the start-of-sol snapshot. Leave deletes the save and returns to the title on the new-game crater. A successful tick commits, replaces the snapshot, clears the pending action, and saves. If population is now at least 50 and the win has not been dismissed this run, open the win dialog. Further sols do not open it again. Required checks for a new game: passing sol 1 lands on oxygen 68, power 44, water 57, morale 69, population 8, sol 2. Placing an unshaded solar and advancing lands on oxygen 68, power 54, water 57, morale 69, population 8, sol 2. A solar orthogonal to the starting habitat, such as (6,6), yields 7 clear, so power lands on 51 with the same other results. Layout: The preview row reads O2 74 to 68, PWR 46 to 54, the matching water and morale figures, and population 6 to 8, using the pending action. An unshaded solar shows power 46 to 54. A pass shows power 46 to 44. Numbers that will fall use Clay; a result under 25 uses Warning and the suffix LOW; a result of 0 turns Advance sol into Advance anyway in Warning. The button still works. Do not duplicate the formulas inside the component. Motion: Resolution is a single state change plus the stock ease. No sol-by-sol animation and no automatic extra ticks. 5. **HUD, forecast, log, win and fail** — After the run starts, the left column is the play column. During the title, those same readouts sit under the title actions, and the right column stays disabled. Play column, top to bottom: the copper-ring mark, [BRAND], [CRATER], the sol label SOL in tracked uppercase over a Fraunces numeral, the forecast chip, the population line, four stocks, and the latest log line. Population reads 6 colonists · 8 beds · goal 50 at the start, with live numbers after that. Forecast on sol 1 is Storm in 7 sols. Inside a storm it is Dust storm · N sols left, counting the current sol, so sol 8 says 4 sols left and sol 11 says 1 sol left. Use sol, not sols, when the count is 1. Stocks are Oxygen, Power, Water, and Morale, each with a mono integer, an 8px track in #3A2A22, and a fill in Sage, Copper, Ice, or Morale clay. Right column: four build cards and Remove. Subtitles: Habitat, Sleeps 8 · power -2 · water -1. Solar array, 10 power · 5 in dust · shade cuts both. Greenhouse, 8 oxygen · 16 beside a habitat. Ice drill, 20 water · quieter away from beds. Remove, Clear one structure this sol. Then Undo, shown only while a pending action exists, and Advance sol. Until the first advance of a new run, the hint is Place a solar on open ground, then advance. After that it is One change per sol, or none. One toast after each successful sol, 2.2 seconds, in this priority: a brownout says Power ran short. Drills and greenhouses sat this sol out. Else if that sol started a storm, Dust fills [CRATER]. Arrays are on their storm yield. Else if that sol ended a storm, The dust thins over [CRATER]. Arrays return to clear yield. Else if population grew, [BRAND] adds N. Population P. Else if beds are full and population is under 50, Beds are full. Place a habitat before the next arrivals. Else if growth waited on a stock, name the lowest of Oxygen, Power, Water, and Morale that is under 35, in that tie order, as in Oxygen is under 35. Growth waits. Else Sol N closes quiet. The win heading is The basin holds. Body: [BRAND] houses 50 colonists. [CRATER] still has air, current, water, and a crew that will stay. Then [TAGLINE] and Sol N from [EXPEDITION], where N is the sol that was resolved. Buttons: Keep surveying and Found again. Found again confirms, then resets to the new game. Fail heading: The expedition folds. Oxygen: Oxygen hit zero. The domes go quiet. Power: Power hit zero and the batteries are flat. Water: The cistern hit zero. Morale: Morale hit zero. The crew will not work another sol. Then Sol N is the last one logged for [BRAND]. Buttons: Retry this sol and Leave the crater. If more than one stock is zero, name them in oxygen, power, water, morale order. Toast and dialogs name the sol that just resolved. The SOL numeral shows the sol now being planned, which is one higher after a successful tick. Layout: Desktop columns are 320px glass, full height, over the canvas. The advance button is 52px tall and full width of the right column. Mobile, under 1100px: a 48px top bar with [BRAND] and the sol numeral, the canvas beneath it, then a sheet with a 2 by 2 stock grid, the population and forecast on one line, the hint, a 48px advance button, and a five-button thumb bar labeled Habitat, Solar, Greenhouse, Drill, and Remove. The sheet plus top bar must leave the canvas at least 240px tall at 390x844. Dialogs are 440px glass cards centered, or bottom sheets at most 70dvh on mobile, with a Basalt scrim at 45 percent so the crater remains visible. Help and fail and win trap focus and return focus to the button that opened them. Motion: Toasts fade only. The win and fail dialogs fade over 140ms. Reduced motion is instant. The storm veil is the canvas, not a CSS flash. 6. **Build actions, pointer, keyboard, and touch** — A sol allows one successful place, one successful remove, or a pass. Choosing a tool does not spend it. A legal place or remove stores a pending action and spends it. Undo, or clicking the pending structure again, clears it. Advance resolves whatever is pending, or passes. Tools are 1 habitat, 2 solar, 3 greenhouse, 4 drill, X remove, U or Backspace undo, Escape clears the tool, N advances, H opens help, M toggles sound. Arrow keys move a Copper cell cursor that stays hidden until the first arrow, then wraps only among non-void cells. Enter places or removes on that cursor. Ignore these keys while a dialog is open or while a button is focused, and prevent page scroll for them. Pointer: click a floor cell with a build tool to place, click a structure with Remove to remove, right-click clears the tool. Illegal clicks do not spend the action. Status copy: Crater wall. Build on the basin floor. A boulder sits on this cell. That cell is already built. Remove it on its own sol. People still need those beds. Nothing to remove. One change per sol. Undo it or advance. Removal of a habitat is blocked when population would exceed the beds that remain. Touch uses the thumb bar. The selected tool stays selected until another tool, a successful pending action, or Escape. After a pending place, further taps do not add a second structure. Targets are at least 48px. Pointer, keyboard, and touch all call the same place and remove functions. Layout: Desktop build cards stack in the right column with 8px gaps and a 3px Copper left border on the selected card. Mobile tools share one row, equal width, 68px tall, with a 3px Copper top border on the selected tool. The keyboard cursor and the hover status never cover the advance button. Hide the desktop key hint 1-4 build · X remove · arrows · Enter place · N advance on coarse pointers. Motion: Selection color changes on the same frame as the input. No delay and no sticky hover on touch. 7. **Save, help, audio, and accessibility** — Save key is colony-save: plus the slug of BRAND, lowercase, non-alphanumerics collapsed to single hyphens. The default key is colony-save:hearthline. Save after every successful tick, when the win is dismissed, and when Found again resets. Do not save a failed tick or a pending action. Shape version 1: sol, population, oxygen, power, water, morale, buildings as c, r, and kind, wonDismissed, and version. A missing or mismatched version is ignored. Sound preference is a separate boolean colony-sound: plus the same slug, default false. Resume survey loads the save into the HUD and closes the title actions without resetting the sol. Help heading: One sol, one change. Intro: Built for [AUDIENCE]. Then the roster sentence. Default roster: Nia Calder leads the survey, Omar Voss runs the drills, and Priya Sen keeps the greenhouse bench. Saltmere roster: Imani Okonkwo leads the survey, Leo Hart runs the drills, and June Pell keeps the greenhouse bench. Help then lists the yields, shade examples, the storm calendar, the growth rule, the fail rule, and the controls, using the same numbers as sim.ts. Include the worked pass for sol 1 so a player can check the preview: oxygen 68, power 44, water 57, morale 69, population 8. Sound stays off until the player turns it on. On the next gesture, create one AudioContext. Cues are short oscillators at gain 0.04 or lower: place a 740Hz sine for 50ms, remove a 196Hz sine for 70ms, advance a triangle from 330Hz to 440Hz over 90ms, growth two sines at 523Hz and 659Hz for 80ms with a 40ms gap, win 523, 659, 784, and 1046Hz for 100ms each, fail 220Hz then 146Hz for 140ms, and a storm start as 280ms of a seeded noise buffer through a bandpass at 400Hz. Ramp gain over 20ms. No audio files and no autoplay. Every cue also has visible feedback. The canvas is aria-hidden. A polite live region speaks the toast, the fail heading, and the win heading. Dialogs are real HTML, labeled, and Escape closes help. If the canvas context cannot be created, show a Glass panel reading This browser could not start the crater view. and keep the help button usable, without throwing in a loop. Layout: Help is a 560px sheet. On mobile it is a bottom sheet with internal scroll. Live region and help text are available on the title screen as well as in a run. The optional credit line, if supplied, also sits at the bottom of help. Motion: Audio does not depend on dust motion. Reduced motion still allows the cues when sound is on, because each cue is a single short tone and the veil does not flash. 8. **Dust, responsive fit, and reduced motion** — Seed dust with mulberry32 starting at 0xC1A0E11 and place 32 particles once inside the crater bounds. Each particle is an ellipse of radius 4 to 12 in Dust at 0.12 alpha. Drift them by 0.6 CSS pixels to the right per frame and wrap. During a storm, draw 64 particles at 0.22 alpha and then a full-canvas Dust fill at 0.18 alpha above the structures. Draw order is background, terrain, boulders, structures, selection, particles, storm veil. The HTML HUD is not drawn into the canvas. At 1440x900 the center habitat is fully visible between the columns and no column text overflows. At 390x844 the dome is in the canvas, the thumb bar is in the thumb zone, and there is no horizontal page scroll. Stocks show integers, names, and LOW, so color is never the only signal. Storm state is always the forecast sentence. Layout: At 1440x900 the habitat at column 5, row 6 sits in the open canvas between the columns, fully visible, not underneath them. Mobile sheet order is fixed: title block only while the run has not started, then stocks, forecast and beds, hint, advance, tools, and the safe area. Motion: With prefers-reduced-motion, skip particle placement and the animation frame. The storm is only the 0.18 veil. Resize still redraws once. ## Assets - image: No downloaded or generated image files. Draw the crater, rim, boulders, habitats, solar arrays, greenhouses, ice drills, dust, storm veil, selection, and public/favicon.svg in canvas and SVG using the hexes in Design. Record in ASSETS.md that scene art and the favicon are code-drawn and that no external image was used. - icon: Build-bar glyphs are original inline SVG silhouettes of the four structures and a simple removal slash, in the Design hexes. Use only CircleHelp, Volume2, VolumeX, Undo2, and X from the locally installed lucide-react package (ISC) for help, sound, undo, and close. In ASSETS.md list those icon modules, https://www.npmjs.com/package/lucide-react, Lucide contributors, and the ISC license. - font: Self-host Fraunces and Outfit through @fontsource-variable/fraunces and @fontsource-variable/outfit, and IBM Plex Mono 500 through @fontsource/ibm-plex-mono (OFL-1.1). Import only those weights. In ASSETS.md list the local files the packages emit, the npm package pages, the copyright holders from the bundled OFL notices, and the OFL license. No request to fonts.googleapis.com or any other font host. - video: No video and no audio files. Optional cues are synthesized in the browser with Web Audio after the player turns sound on. ## Don'ts - Do not add a backend, server routes, accounts, a database, analytics, a leaderboard, multiplayer, or any network call. The only persistence is the colony save and the sound flag in localStorage. - Do not change the stack. No Unity, Godot, Phaser, three.js, Pixi, a physics engine, GSAP, Motion, or a second page. The build is Vite 5, React 18, TypeScript, Tailwind CSS 3.4, and one canvas. - Ship static files in dist/ only. Vite base is './', links use file names, assets are relative, the build is minified, source maps are off, src is not copied, and dist stays under 20 MB. - Do not load scripts, fonts, icons, images, audio, or tiles from a CDN. Do not hotlink or download Mars photography, maps, or textures. The crater, structures, and storm are drawn in code. - Do not use commercial fonts or a font CDN. Fraunces, Outfit, and IBM Plex Mono come from the Fontsource packages only. - Do not copy existing colony, terraforming, or survival-city games: no Surviving Mars, Per Aspera, Terraforming Mars, Oxygen Not Included, or Frostpunk names, logos, dome kits, drones, sponsor crests, breakthrough cards, or interface layouts. - Do not use NASA, ESA, JPL, SpaceX, or any real agency or company mark, patch, rover, lander, or mission name as the colony, the crater, or the expedition. Do not quote film or book lines about Mars, including The Martian, and do not draw a real astronaut or any celebrity. - Do not add individual colonist AI, portraits, a research tree, drones, combat, weapons, a money cost, random events, or procedural maps. Storms, growth, and the crater are the fixed rules in sim.ts. - Do not hard-code Hearthline, Tallow Crater, the Amberline Survey, the default tagline, or the default roster outside src/content.ts. Building names and yields stay stable when the variables change. - Do not let the preview use a second copy of the economy. Advance sol, the preview, and the fail check call one tick function. A new game must pass the sol-1 checks in the tick section. - Do not autoplay audio, require a pointer lock, or ignore prefers-reduced-motion. Dust and the storm veil must not hide the habitat or the selection diamond. - Do not make phones depend on hover or keyboard shortcuts. The thumb bar, tap to place, and 48px targets work at 390x844 with no horizontal overflow, and desktop play works at 1440x900. - Do not show dates, prices, accounts, or a marketing page in front of the crater. The only optional credit is the supplied credit string. Do not mention VibeFather, a template license, or a member count. - Do not add SEO metadata, Open Graph tags, JSON-LD, a sitemap, or keyword-stuffed headings. A plain title and the favicon are enough. - Do not throw on a missing canvas context or a bad save. Ignore an unknown save version, and if the canvas cannot start, show the fallback panel once. --- — Prompt by VibeFather · https://vibefather.ai/t/mars-colony-builder-game · CC BY-NC 4.0 (non-commercial; commercial use needs a VibeFather Pro license) · Request removal: https://vibefather.ai/takedown
中文参考译文(帮助理解,复制给 AI 时请用上面的英文原版)
# 火星殖民地建造游戏 完全按照以下描述构建此网站。将 [VARIABLES] 替换为你自己的值;其余内容保持不变。 ## 简介 构建 [BRAND],这是一款在 [CRATER] 中运行的单屏回合制殖民地游戏,由 [EXPEDITION] 建立。玩家在代码绘制的等距陨石坑上放置居住舱、太阳能阵列、温室和冰钻,然后一次推进一个火星日。氧气、电力、水和士气同步变化。沙尘暴持续四个火星日,并削减太阳能产出。只有当床位和全部四种库存都允许时,殖民者才会增加,上限为 50。网格和库存持久化在 localStorage 中。默认标语:[TAGLINE]。陨石坑、一个居住舱和一层尘雾已经显示在屏幕上,位于承载标题和 HUD 的玻璃柱之间。 - 受众:喜欢短小规划谜题的人,包括 [AUDIENCE],以及想要一款自带键盘和触摸控制、自包含 canvas 游戏的独立开发者和前端开发者。帮助文本保持简短,第一场风暴出现在已知的火星日,失败的火星日可以重试。 - 目标:交付一个完整循环:一个位于实时陨石坑上方的标题柱,每个火星日一次结构变更,一个与 Advance sol 使用相同 tick 的预览,风暴,增长到 50,胜利覆盖层,失败远征覆盖层,从 localStorage 恢复,以及在 1440x900 和 390x844 下等效游玩。 - 语气:平静、务实、略带干涩,像一份小型勘测的现场日志。简短美式英语,具体产出,不用感叹号,不用史诗式殖民口号,也不开把任何人遗弃在行星上的玩笑。 ## 技术栈 - 框架:Vite 5 + React 18 + TypeScript - 样式:Tailwind CSS 3.4 - 库:react 18(MIT)、react-dom 18(MIT)、lucide-react(ISC)、@fontsource-variable/fraunces(OFL-1.1)、@fontsource-variable/outfit(OFL-1.1)、@fontsource/ibm-plex-mono(OFL-1.1) - 构建:`npm run build` → 静态文件输出到 `dist/`。无后端、无服务端代码、无外部 API。 - 初始化: - 使用 React TypeScript 模板搭建 Vite 5。脚本:dev=vite,build=tsc --noEmit && vite build,preview=vite preview。包名是 BRAND 的 slug。将 react 18、react-dom 18、lucide-react 以及三个 fontsource 包安装为运行时依赖。将 vite 5、typescript 5、tailwindcss 3.4、postcss 和 autoprefixer 安装为开发依赖。不要添加游戏引擎、路由、物理库、canvas 辅助库、补间库或音频文件。 - vite.config.ts 将 base 设为 './',build.outDir 设为 dist,build.emptyOutDir 设为 true,build.sourcemap 设为 false。tsconfig 的 strict 为 true。Tailwind content 覆盖 index.html 和 src。从设计(Design)部分扩展颜色和字体系列。所有自定义 CSS、玻璃面板(glass panel)规则以及 prefers-reduced-motion 都放在 src/styles.css 中。 - 在 src/main.tsx 中从 @fontsource-variable/fraunces 和 @fontsource-variable/outfit 导入 Fraunces variable 和 Outfit variable。从 @fontsource/ibm-plex-mono/500.css 导入 IBM Plex Mono 500。将它们映射到 font-display、font-sans 和 font-mono。绝不加载字体 CDN。 - 使用 src/content.ts、sim.ts、draw.ts、audio.ts、save.ts、App.tsx、main.tsx 和 styles.css。sim.ts 是纯 TypeScript,不含 React,也不含 Math.random。draw.ts 负责 canvas 和带种子的尘埃(seeded dust)。App.tsx 负责工具选择、待处理操作、覆盖层和键盘焦点。每一句面向玩家的句子都放在 content.ts 中。 - 如果 BRAND、CRATER、EXPEDITION、TAGLINE 或 AUDIENCE 与默认值不同,请重写名单、标题正文、胜利和失败句子以及日志行,使新的专有名词读起来自然。保留建筑名称、产出、网格、颜色和风暴日历。对于 Saltmere 这一组,名单确切为 Imani Okonkwo、Leo Hart 和 June Pell。对于任何其他非默认组,创造三个新人,并去掉 Nia Calder、Omar Voss、Priya Sen、Tallow 和 Amberline。绝不渲染原始方括号占位符。 - 文档标题为 BRAND + ' — ' + CRATER。交付 public/favicon.svg,为一个小型等距菱形外围的铜色圆环,使用铜色和玄武岩色十六进制色值,并用相对 href 链接它。一个 index.html,无路由,无第二个页面。 - 设备像素比上限为 2。当文档隐藏时暂停尘埃动画。卸载时释放音频上下文和动画帧。生产 dist 不含 source map、不复制 src,且保持在 20 MB 以下。 ## 变量 - [BRAND] — 殖民地名称(默认:"Hearthline")。一个虚构的殖民地和游戏标题。绝不是真实的机构、公司、探测车或任务。 - [CRATER] — 陨石坑名称(默认:"Tallow Crater")。一个虚构的盆地名称,用于标题栏、预报提示和胜利文案中。 - [EXPEDITION] — 创建远征队(默认:"the Amberline Survey")。一个简短的虚构团体名称。眉题会去掉开头的 'the' 并将其余部分转为大写。 - [TAGLINE] — 殖民地标语(默认:"Fifty beds against the dust.")。一行简短的原创文字,位于标题栏中殖民地名称下方以及胜利对话框上。 - [AUDIENCE] — 玩家受众(默认:"players who like short planning puzzles")。仅使用一次,在帮助介绍中。 - [CREDIT] — 在页脚保留一个小型 "Template by VibeFather" 链接指向 https://vibefather.ai/t/mars-colony-builder-game(默认:是;删除此行即可移除) 页面与区块下的文案是为默认值编写的。如果你的值不同,请为它们重写每个标题、段落、标签和图片——保持相同的长度、语气和结构。布局、颜色、字体和动效保持所述不变。 将所有文案、图片路径和链接放在一个内容文件中(例如 `src/content.ts`),按区块作为键,以便之后无需改动组件即可替换内容。 ## 设计 ### 颜色 - 玄武岩(Basalt)`#14110F` — 页面背景、画布空白区域和对话框遮罩底色 - 玻璃(Glass)`#1C1814` — HUD 面板,90% 不透明度,带 14px 背景模糊 - 铜(Copper)`#E39B54` — 唯一强调色:栖息地穹顶、主按钮、选中态、焦点环、35% 不透明度的面板边框 - 深铜(Copper deep)`#A86B38` — 栖息地裙边、按钮按下态和穹顶阴影 - 风化层(Regolith)`#C4784E` — 最浅的盆地地面瓦片 - 中风化层(Regolith mid)`#B56545` — 中间色调的盆地地面瓦片 - 暗风化层(Regolith dark)`#A85A3C` — 最深的盆地地面瓦片 - 坑缘(Rim)`#5C3428` — 陨石坑壁顶部 - 坑缘面(Rim face)`#3F241C` — 陨石坑壁南面、门和温室基座 - 尘埃(Dust)`#C4A574` — 雾霾粒子、风暴幕帘和巨石高光 - 羊皮纸(Parchment)`#F3E6D4` — 主文本和栖息地窗户 - 陶土(Clay)`#B7A394` — 次要文本、太阳能桅杆和非激活工具标签 - 鼠尾草(Sage)`#8FB573` — 氧气条和温室窗格 - 冰(Ice)`#B7D0D6` — 水条和钻探孔 - 士气陶土(Morale clay)`#D9896A` — 士气条 - 警告(Warning)`#E07A5F` — 库存低于 25、无效单元格和“仍要继续” - 面板墨色(Panel ink)`#1C120C` — 铜色按钮上的文字 - 阵列单元格(Array cell)`#3E4C55` — 太阳能板填充 ### 字体排印 - 殖民地名称、胜利与失败标题、sol 数字:Fraunces(OFL),字重 600/700 - HUD 标签、帮助、按钮和正文:Outfit(OFL),字重 400/500/600 - 库存数字、预报和床位数量:IBM Plex Mono(OFL),字重 500 ### 布局与动效 - 间距:以 4px 为单位。页面高度为 100dvh,不滚动。桌面端在 1100px 及以上时,在通栏画布上使用两个 320px 的玻璃栏,栏内边距 20px,陨石坑上下内边距 24px。低于 1100px(包括 390px)时,画布为顶部区域,底部面板承载 HUD,面板内边距 12px,按钮高度 48px,并适配安全区内边距。中央栖息地保持在两栏之间的开放画布中。 - 圆角:玻璃面板 12px,对话框 14px,按钮 10px,预报标签和库存轨道 999px。画布为直角且通栏。世界中的形状是菱形、穹顶和桅杆,而非圆角应用图标。 - 动效:尘埃是唯一的持续动效:32 个带种子的粒子以每帧 0.6 CSS 像素向右漂移,并在陨石坑边界内循环。风暴将数量提升至 64,并添加一层 0.18 alpha 的平坦尘埃幕帘。 - 动效:允许动效时,库存填充宽度在 160ms 内缓动。覆盖层在 140ms 内淡入淡出透明度,位移不超过 8px。按钮不弹跳。 - 动效:在 prefers-reduced-motion 下,不绘制粒子,库存填充瞬时到位,覆盖层即时显示,风暴仅保留平坦尘埃幕帘。放置、移除和 sol 结算保持即时。 - 动效:标签页隐藏时停止动画帧。不要晃动画布、闪烁幕帘或自动播放声音。 - 图像:陨石坑、坑缘、巨石、四种结构类型、选中态、尘埃、风暴幕帘、favicon 和建造栏图标均以 canvas 和内联 SVG 绘制。不使用照片、生成图像、下载纹理或精灵图。首屏的视觉锚点是锈色盆地中央的栖息地穹顶,玻璃 HUD 已在其周围清晰可读。 ## 页面与区块 ### [BRAND] — [CRATER] (`index.html`) 1. **实时陨石坑上方的标题栏** — 文档标题为 [BRAND] — [CRATER]。标题与游玩区域共用一个框架:一块全出血画布,以及在 1100px 及以上宽度时显示的两列 320px 玻璃栏。不要在栏上方再添加第二张卡片。在 Open 或 Resume 之前,左栏依次展示眉题、[BRAND]、[CRATER]、[TAGLINE]、正文、“Open the basin”和“Resume survey”,随后仍显示 SOL 1、预报“Storm in 7 sols”、人口行以及四项初始库存。右栏显示四张建造卡片、“Remove”和“Advance sol”,可见且 aria-disabled,透明度为 55%。中央画布是新游戏陨石坑,栖息舱位于第 5 列、第 6 行,处于两栏之间的开放空隙中。低于 1100px 时,画布保持在顶部,以便穹顶仍然可见,底部面板先显示相同的标题块,然后是紧凑库存和禁用的缩略条。眉题是考察队名称,不带前置的 the,使用大写 Outfit 字体,字距 0.16em。默认情况下即为 AMBERLINE SURVEY。正文:Place one structure a sol. Keep oxygen, power, water, and morale above empty until 50 colonists have beds. “Resume survey”始终可见,无存档时禁用。如果存在存档,“Open the basin”会询问“Replace the saved survey of [BRAND]?”,并提供“Replace”和“Keep it”。在 Open 或 Resume 之后,移除标题操作和正文,保留品牌块,并启用建造控件。如果构建提供了 credit 字符串,则将其作为安静的 Clay 文本显示在标题按钮下方以及帮助底部。否则省略。不要虚构 credit、日期或价格。 布局:桌面端栏为绝对定位,占满视口高度,Glass 透明度 90%,内边距 20px,朝向陨石坑的边缘带 1px 铜色边框,透明度 35%。主按钮为铜色,Panel 墨色文字,高 48px。次按钮为透明铜色描边。焦点环为 2px 铜色,偏移 2px。移动端面板为全宽,仅顶部两角为 12px 圆角,且不遮挡画布中央。 动效:首次绘制陨石坑后,栏在 140ms 内淡入。它们不浮动也不滑动。减少动效模式下在首次绘制时即显示。 2. **等距陨石坑网格** — 网格为 12 × 12,列 c 和行 r 从 0 到 11。列向东递增,行向南递增。对每个单元格,d2 = (c * 2 - 11) 的平方加 (r * 2 - 11) 的平方。如果 d2 大于 128,该单元格为 void,不绘制。如果 d2 大于 84,则为 rim,不可建造。否则为 floor,但巨石单元格 (2,4)、(8,3)、(4,9)、(9,7)、(3,7) 和 (7,8) 除外,它们是被阻挡的 floor。即 62 个可建造 floor 单元格、6 块巨石和 28 个 rim 单元格。正确的地形函数必须匹配这些计数。新游戏在 (5,6) 放置一个栖息舱,不放置其他任何东西。缩放适配前,瓦片宽度为 72,瓦片高度为 36。偏移前的屏幕位置为 x = (c - r) * 36,y = (c + r) * 18。按 (c + r) 升序绘制非 void 单元格。Floor 填充按 (c * 3 + r) 对 3 取模循环使用 Regolith、Regolith mid 和 Regolith dark,并带 1px 描边 rgba(62,32,24,0.45)。Rim 顶部菱形使用 Rim,南面在缩放前像素中低 7px,填充 Rim face。巨石先绘制 floor 菱形,然后在瓦片中心周围绘制三个圆:半径 10 位于 (-6,-4),颜色 #6A3E30;半径 8 位于 (7,-1),颜色 Rim;半径 7 位于 (0,6),颜色 #4A2C22;并在第一个圆上加 Dust 高光。网格背后的画布为从 #2A1A14 到 Basalt 的垂直渐变,以及一个 #6E3B2C、20% alpha 的宽椭圆。将非 void 菱形的包围盒适配到可游玩画布矩形内,内边距 16px,统一缩放上限 1.35,居中。在 1100px 及以上宽度时,该矩形为视口左右各内缩 320px、上下各内缩 24px。低于该宽度时,该矩形为 canvas 元素。 布局:一个 canvas 元素填满视口,位于 HTML HUD 下方。将其位图尺寸设为 CSS 尺寸乘以封顶的设备像素比,并缩放上下文。在 resize 时重建适配。命中测试反转适配:fx = x / 36,fy = y / 18,c = round((fx + fy) / 2),r = round((fy - fx) / 2)。忽略 void。状态行报告指针或键盘光标下的单元格。 动效:网格本身不动画。只有尘埃、风暴帷幕和选择描边在两次绘制之间变化。 3. **四种结构与相邻关系** — 每种结构占据一个 floor 单元格。正交相邻才计数。对角线、rim、void 和巨石不计。太阳能板的阴影为相邻的正交栖息舱和温室数量。无阴影太阳能产出为 max(2, 10 - 3 * shade)。风暴太阳能产出为 max(1, 5 - 2 * shade)。无遮挡阵列在晴朗时为 10,在尘埃中为 5。一个高邻居使其变为 7 和 3。两个使其变为 4 和 1。三个或四个保持最小值,2 和 1。温室在至少一个正交邻居为栖息舱时产出 16 氧气,否则产出 8。它始终消耗 4 电力、2 水,并在电网供电时提供 2 士气。钻机产出 20 水,消耗 3 电力,并在供电时消耗 1 士气,每有一个正交栖息舱再额外消耗 2。栖息舱可睡眠 8 人,消耗 2 电力和 1 水,并提供 1 士气。钻机不会给太阳能板造成阴影。以 72 宽瓦片的瓦片局部像素绘制,然后乘以适配缩放。栖息舱:裙边椭圆 (0,6, rx 20, ry 8),颜色 Copper deep;穹顶 (0,-2, rx 18, ry 12),颜色 Copper;门矩形 (-3,2, 6 × 8),颜色 Rim face;窗户 (-6,-6, 12 × 3),颜色 Parchment。太阳能板:桅杆从 (0,4) 到 (0,-14),颜色 Clay;面板经过 (-16,-18)、(10,-18)、(18,-8)、(-8,-8),填充 Array cell,描边 Copper。温室:底座椭圆 (0,6, rx 18, ry 7),颜色 Rim face;拱顶椭圆 (0,-2, rx 16, ry 11),颜色 Sage,85% 不透明度,带 Array cell 描边;窗格线位于 x -5 和 5。钻机:底座椭圆 (0,8, rx 14, ry 6),颜色 Rim;塔身矩形 (-4,-16, 8 × 24),颜色 Clay;环箍 (-6,-6, 12 × 4),颜色 Copper;钻孔椭圆 (0,-16, rx 4, ry 3),颜色 Ice。待放置项以 50% alpha 绘制。选中单元格为 2px Copper 菱形。非法单元格为 2px Warning 菱形,且不消耗行动。 布局:建造栏图标为内联 SVG,使用相同的轮廓和十六进制色值,尺寸 28px,而不是 Lucide 中无关对象的图片。HUD 状态行使用键盘光标或悬停单元格。示例:Column 5, row 6 · Habitat。Column 2, row 4 · Boulder。Open floor · Solar yield 10 clear / 5 dust。Rim 和 void 从不显示产出。 动效:幽灵和选择没有脉冲。减少动效模式不改变绘制。 4. **Sol 推进、风暴、增长、胜利与失败** — 将所有这些都放在 sim.ts 中,并为预览和 Advance sol 两者调用。库存为 0 到 100 的整数。新游戏:sol 1,人口 6,氧气 74,电力 46,水 64,士气 68,一个栖息舱位于 (5,6)。风暴在第 8 至 11、18 至 21、30 至 33、44 至 47、60 至 63 和 78 至 81 个 sol 期间活跃,之后在从 96、114、132 等开始、步长为 18 的每四个 sol 的区间内活跃。供给是风暴期间风暴产出之和,否则为晴朗产出。需求为栖息舱 * 2 + 温室 * 4 + 钻机 * 3,在待处理动作之后计算。当电力 + 供给至少达到需求时,电网通电。如果通电,电力变化为供给减去需求,水变化为钻机水减去栖息舱和温室水再减去人口,氧气变化为温室氧气减去人口,士气变化为栖息舱和温室士气减去钻机惩罚。如果未通电,温室和钻机闲置:它们在该 sol 不增加任何东西也不消耗任何东西,电力变化为供给减去栖息舱 * 2,水变化为减去栖息舱再减去人口,氧气变化为减去人口,士气变化为栖息舱减去 6。然后,使用增长前的人口和动作后的住房,当人口小于或等于住房 - 8 时增加 2 士气,当人口等于住房且住房为正时减去 4,风暴期间减去 8。将每个库存限制在 0 到 100。如果任何库存为 0,则该 tick 失败且人口不增长。否则,如果电网通电且每个库存至少为 35 且人口低于住房和 50 两者,人口增长 min(2, 住房 - 人口, 50 - 人口)。然后 sol 增加 1。失败的 tick 不会被提交。失败对话框显示限制后的结果和刚刚尝试的 sol。Retry 和 Leave 会丢弃它。Retry 还会清除待处理动作并返回到 sol 开始时的快照。Leave 删除存档并返回到新游戏陨石坑上的标题。成功的 tick 会提交、替换快照、清除待处理动作并保存。如果人口现在至少为 50 且本次运行中胜利尚未被关闭,则打开胜利对话框。后续 sol 不会再次打开它。新游戏的必需检查:通过 sol 1 落在氧气 68、电力 44、水 57、士气 69、人口 8、sol 2。放置一个无阴影太阳能并推进落在氧气 68、电力 54、水 57、士气 69、人口 8、sol 2。一个与起始栖息舱正交的太阳能,例如 (6,6),产出 7 晴朗,因此电力落在 51,其他结果相同。 布局:预览行显示 O2 74 到 68、PWR 46 到 54、匹配的水和士气数值,以及人口 6 到 8,使用待处理动作。无阴影太阳能显示电力 46 到 54。跳过显示电力 46 到 44。将下降的数字使用 Clay;低于 25 的结果使用 Warning 并带后缀 LOW;结果为 0 时将 Advance sol 变为 Warning 中的 Advance anyway。按钮仍然有效。不要在组件内重复公式。 动效:解析是单次状态变更加上库存缓动。没有逐 sol 动画,也没有自动额外 tick。 5. **HUD、预报、日志、胜利与失败** — 运行开始后,左列为游玩列。在标题期间,相同的读数位于标题动作下方,右列保持禁用。游玩列,从上到下:铜环标记、[BRAND]、[CRATER]、sol 标签 SOL 以字距大写形式位于 Fraunces 数字上方、预报芯片、人口行、四个库存,以及最新日志行。人口在开始时显示 6 colonists · 8 beds · goal 50,之后显示实时数字。sol 1 的预报为 Storm in 7 sols。风暴期间为 Dust storm · N sols left,计入当前 sol,因此 sol 8 显示 4 sols left,sol 11 显示 1 sol left。当计数为 1 时使用 sol,而非 sols。库存为 Oxygen、Power、Water 和 Morale,每个都有一个等宽整数、一个 #3A2A22 的 8px 轨道,以及 Sage、Copper、Ice 或 Morale clay 的填充。右列:四张建造卡和 Remove。副标题:Habitat, Sleeps 8 · power -2 · water -1。Solar array, 10 power · 5 in dust · shade cuts both。Greenhouse, 8 oxygen · 16 beside a habitat。Ice drill, 20 water · quieter away from beds。Remove, Clear one structure this sol。然后是 Undo,仅在存在待处理动作时显示,以及 Advance sol。在新运行的第一次推进之前,提示为 Place a solar on open ground, then advance。之后为 One change per sol, or none。每个成功 sol 后显示一个 toast,2.2 秒,按此优先级:限电显示 Power ran short. Drills and greenhouses sat this sol out。否则如果该 sol 开始了风暴,Dust fills [CRATER]. Arrays are on their storm yield。否则如果该 sol 结束了风暴,The dust thins over [CRATER]. Arrays return to clear yield。否则如果人口增长了,[BRAND] adds N. Population P。否则如果床位已满且人口低于 50,Beds are full. Place a habitat before the next arrivals。否则如果增长等待某个库存,按该并列顺序命名 Oxygen、Power、Water 和 Morale 中低于 35 的最低者,如 Oxygen is under 35. Growth waits。否则 Sol N closes quiet。胜利标题为 The basin holds。正文:[BRAND] houses 50 colonists. [CRATER] still has air, current, water, and a crew that will stay。然后是 [TAGLINE] 和 Sol N from [EXPEDITION],其中 N 是已解析的 sol。按钮:Keep surveying 和 Found again。Found again 会确认,然后重置为新游戏。失败标题:The expedition folds。Oxygen:Oxygen hit zero. The domes go quiet。Power:Power hit zero and the batteries are flat。Water:The cistern hit zero。Morale:Morale hit zero. The crew will not work another sol。然后是 Sol N is the last one logged for [BRAND]。按钮:Retry this sol 和 Leave the crater。如果多个库存为零,按 oxygen、power、water、morale 顺序命名它们。Toast 和对话框命名刚刚解析的 sol。SOL 数字显示现在正在规划的 sol,成功 tick 后高一个。 布局:桌面列为 320px 玻璃,全高,位于画布上方。推进按钮高 52px,占右列全宽。移动端,低于 1100px:一个 48px 顶栏,包含 [BRAND] 和 sol 数字,画布在其下方,然后是一个面板,包含 2 乘 2 库存网格、人口和预报在一行、提示、一个 48px 推进按钮,以及一个五按钮拇指栏,标签为 Habitat、Solar、Greenhouse、Drill 和 Remove。面板加顶栏必须在 390x844 下为画布留下至少 240px 高度。对话框为 440px 玻璃卡居中,或在移动端为底部面板,最多 70dvh,带有 45% 的 Basalt 遮罩,以便陨石坑保持可见。Help 和失败及胜利会捕获焦点并将焦点返回到打开它们的按钮。 动效:Toast 仅淡入淡出。胜利和失败对话框在 140ms 内淡入淡出。减少动效时为即时。风暴帷幕是画布,而非 CSS 闪光。 6. **建造动作、指针、键盘和触摸** — 一个 sol 允许一次成功放置、一次成功移除或一次跳过。选择工具不会消耗它。合法的放置或移除会存储待处理动作并消耗它。Undo,或再次点击待处理结构,会清除它。Advance 解析任何待处理内容,或跳过。工具为 1 habitat、2 solar、3 greenhouse、4 drill、X remove、U 或 Backspace undo、Escape 清除工具、N 推进、H 打开帮助、M 切换声音。方向键移动一个 Copper 单元格光标,该光标在第一次按方向键前保持隐藏,然后仅在非虚空单元格之间循环。Enter 在该光标上放置或移除。当对话框打开或按钮聚焦时忽略这些键,并为它们阻止页面滚动。指针:使用建造工具点击地板单元格进行放置,使用 Remove 点击结构进行移除,右键单击清除工具。非法点击不会消耗动作。状态文案:Crater wall. Build on the basin floor。A boulder sits on this cell。That cell is already built. Remove it on its own sol。People still need those beds。Nothing to remove。One change per sol. Undo it or advance。当人口将超过剩余床位时,移除栖息舱会被阻止。触摸使用拇指栏。选中的工具保持选中,直到另一个工具、成功的待处理动作或 Escape。在待处理放置之后,进一步点击不会添加第二个结构。目标至少为 48px。指针、键盘和触摸都调用相同的放置和移除函数。 布局:桌面建造卡在右列堆叠,间距 8px,选中的卡片有 3px Copper 左边框。移动端工具共享一行,等宽,高 68px,选中的工具有 3px Copper 上边框。键盘光标和悬停状态永远不会覆盖推进按钮。在粗指针上隐藏桌面键位提示 1-4 build · X remove · arrows · Enter place · N advance。 动效:选择颜色在与输入相同的帧上变化。无延迟,触摸上无粘性悬停。 7. **保存、帮助、音频与无障碍** — 保存键为 colony-save: 加上 BRAND 的 slug,小写,非字母数字字符折叠为单个连字符。默认键为 colony-save:hearthline。每次成功 tick 后、胜利被关闭时、以及 Found again 重置时保存。不要保存失败的 tick 或待处理操作。形状版本 1:sol、population、oxygen、power、water、morale、buildings(作为 c、r 和 kind)、wonDismissed 和 version。缺失或不匹配的版本会被忽略。声音偏好是单独的布尔值 colony-sound: 加上相同的 slug,默认 false。Resume survey 将存档加载到 HUD 并关闭标题操作,不重置 sol。帮助标题:One sol, one change。引言:Built for [AUDIENCE]。然后是名册句子。默认名册:Nia Calder leads the survey, Omar Voss runs the drills, and Priya Sen keeps the greenhouse bench。Saltmere 名册:Imani Okonkwo leads the survey, Leo Hart runs the drills, and June Pell keeps the greenhouse bench。帮助随后列出产出、阴影示例、风暴日历、生长规则、失败规则和控制方式,使用与 sim.ts 相同的数字。包含 sol 1 的完整通过示例,以便玩家核对预览:oxygen 68、power 44、water 57、morale 69、population 8。声音保持关闭,直到玩家开启。在下一次手势时,创建一个 AudioContext。提示音是增益 0.04 或更低的短振荡器:放置为 740Hz 正弦波持续 50ms,移除为 196Hz 正弦波持续 70ms,推进为三角波从 330Hz 到 440Hz 持续 90ms,生长为两个正弦波 523Hz 和 659Hz 持续 80ms 中间间隔 40ms,胜利为 523、659、784 和 1046Hz 各持续 100ms,失败为 220Hz 然后 146Hz 持续 140ms,风暴开始为 280ms 的种子噪声缓冲区通过 400Hz 带通滤波器。增益在 20ms 内渐变。无音频文件且无自动播放。每个提示音也有可见反馈。画布为 aria-hidden。一个 polite 实时区域播报 toast、失败标题和胜利标题。对话框是真实 HTML、有标签,Escape 关闭帮助。如果无法创建画布上下文,显示一个 Glass 面板,内容为 This browser could not start the crater view. 并保持帮助按钮可用,不在循环中抛出异常。 布局:帮助是一个 560px 的面板。在移动端它是带内部滚动的底部面板。实时区域和帮助文本在标题屏幕以及运行中均可用。可选的署名行(如果提供)也位于帮助底部。 动效:音频不依赖尘埃运动。减少动效在声音开启时仍允许提示音,因为每个提示音是单个短音,且面纱不闪烁。 8. **尘埃、响应式适配与减少动效** — 用 mulberry32 从 0xC1A0E11 开始播种尘埃,并在火山口边界内一次性放置 32 个粒子。每个粒子是 Dust 中半径 4 到 12 的椭圆,alpha 为 0.12。每帧将它们向右漂移 0.6 CSS 像素并环绕。风暴期间,绘制 64 个粒子,alpha 为 0.22,然后在结构上方绘制全画布 Dust 填充,alpha 为 0.18。绘制顺序为背景、地形、巨石、结构、选择、粒子、风暴面纱。HTML HUD 不绘制到画布中。在 1440x900 下,中央栖息地在列之间完全可见,且没有列文本溢出。在 390x844 下,穹顶在画布中,拇指栏在拇指区域,且没有水平页面滚动。库存显示整数、名称和 LOW,因此颜色从不是唯一信号。风暴状态始终是预报句子。 布局:在 1440x900 下,位于第 5 列、第 6 行的栖息地位于列之间的开放画布中,完全可见,不在其下方。移动端面板顺序固定:仅在运行尚未开始时显示标题块,然后是库存、预报和床位、提示、推进、工具和安全区域。 动效:使用 prefers-reduced-motion 时,跳过粒子放置和动画帧。风暴仅为 0.18 的面纱。调整大小仍重绘一次。 ## 资产 - 图像:没有下载或生成的图像文件。使用 Design 中的十六进制色值,在 canvas 和 SVG 中绘制陨石坑、坑缘、巨石、居住舱、太阳能阵列、温室、冰钻、尘埃、风暴帷幕、选择框以及 public/favicon.svg。在 ASSETS.md 中记录场景美术和 favicon 均为代码绘制,且未使用任何外部图像。 - 图标:建造栏图标是四种结构和一条简单移除斜线的原创内联 SVG 剪影,使用 Design 中的十六进制色值。帮助、声音、撤销和关闭仅使用本地安装的 lucide-react 包(ISC)中的 CircleHelp、Volume2、VolumeX、Undo2 和 X。在 ASSETS.md 中列出这些图标模块、https://www.npmjs.com/package/lucide-react、Lucide contributors 以及 ISC 许可证。 - 字体:通过 @fontsource-variable/fraunces 和 @fontsource-variable/outfit 自托管 Fraunces 和 Outfit,并通过 @fontsource/ibm-plex-mono 自托管 IBM Plex Mono 500(OFL-1.1)。仅导入这些字重。在 ASSETS.md 中列出这些包生成的本地文件、npm 包页面、随附 OFL 声明中的版权持有人以及 OFL 许可证。不得向 fonts.googleapis.com 或任何其他字体主机发起请求。 - 视频:没有视频和音频文件。可选提示音在玩家开启声音后通过 Web Audio 在浏览器中合成。 ## 不要做 - 不要添加后端、服务器路由、账户、数据库、分析、排行榜、多人模式或任何网络调用。唯一的持久化是 localStorage 中的殖民地存档和声音标志。 - 不要更改技术栈。不要使用 Unity、Godot、Phaser、three.js、Pixi、物理引擎、GSAP、Motion 或第二个页面。构建使用 Vite 5、React 18、TypeScript、Tailwind CSS 3.4 和一个 canvas。 - 仅在 dist/ 中发布静态文件。Vite base 为 './',链接使用文件名,资源使用相对路径,构建经过压缩,source map 关闭,src 不被复制,dist 保持在 20 MB 以下。 - 不要从 CDN 加载脚本、字体、图标、图像、音频或瓦片。不要热链或下载火星照片、地图或纹理。陨石坑、结构和风暴由代码绘制。 - 不要使用商业字体或字体 CDN。Fraunces、Outfit 和 IBM Plex Mono 仅来自 Fontsource 包。 - 不要复制现有的殖民地、地球化改造或生存城市游戏:不要使用 Surviving Mars、Per Aspera、Terraforming Mars、Oxygen Not Included 或 Frostpunk 的名称、标志、穹顶套件、无人机、赞助商徽章、突破卡或界面布局。 - 不要使用 NASA、ESA、JPL、SpaceX 或任何真实机构或公司的标志、徽章、漫游车、着陆器或任务名称作为殖民地、陨石坑或探险队的名称。不要引用关于火星的电影或书籍台词,包括 The Martian,也不要绘制真实宇航员或任何名人。 - 不要添加个体殖民者 AI、肖像、研究树、无人机、战斗、武器、金钱成本、随机事件或程序化地图。风暴、生长和陨石坑是 sim.ts 中的固定规则。 - 不要在 src/content.ts 之外硬编码 Hearthline、Tallow Crater、Amberline Survey、默认标语或默认名册。当变量变化时,建筑名称和产出保持稳定。 - 不要让预览使用第二份经济逻辑。推进 sol、预览和失败检查调用同一个 tick 函数。新游戏必须通过 tick 部分中的 sol-1 检查。 - 不要自动播放音频、要求指针锁定或忽略 prefers-reduced-motion。尘埃和风暴帷幕不得遮挡栖息地或选择菱形。 - 不要让手机依赖悬停或键盘快捷键。拇指栏、点击放置和 48px 目标在 390x844 下正常工作且无水平溢出,桌面游玩在 1440x900 下正常工作。 - 不要在陨石坑前显示日期、价格、账户或营销页面。唯一可选的署名是提供的 credit 字符串。不要提及 VibeFather、模板许可证或成员数量。 - 不要添加 SEO 元数据、Open Graph 标签、JSON-LD、站点地图或关键词堆砌的标题。一个普通标题和 favicon 就足够了。 - 不要在缺少 canvas 上下文或存档损坏时抛出异常。忽略未知的存档版本,如果 canvas 无法启动,只显示一次回退面板。 --- — Prompt by VibeFather · https://vibefather.ai/t/mars-colony-builder-game · CC BY-NC 4.0 (non-commercial; commercial use needs a VibeFather Pro license) · Request removal: https://vibefather.ai/takedown
个人项目可免费使用(CC BY-NC 4.0)。 商业用途需要 Pro.
DESIGN.md
单独的设计规范:配色、字体、间距和动效。可以把这套视觉用到你已有的项目上。
---
name: "Mars Colony Builder Game"
colors:
basalt: "#14110F"
glass: "#1C1814"
copper: "#E39B54"
copper_deep: "#A86B38"
regolith: "#C4784E"
regolith_mid: "#B56545"
regolith_dark: "#A85A3C"
rim: "#5C3428"
rim_face: "#3F241C"
dust: "#C4A574"
parchment: "#F3E6D4"
clay: "#B7A394"
sage: "#8FB573"
ice: "#B7D0D6"
morale_clay: "#D9896A"
warning: "#E07A5F"
panel_ink: "#1C120C"
array_cell: "#3E4C55"
typography:
colony_name_win_and_fail_headlines_sol_numeral: { family: "Fraunces", weights: [600, 700] }
hud_labels_help_buttons_and_body: { family: "Outfit", weights: [400, 500, 600] }
stock_numbers_forecast_and_bed_counts: { family: "IBM Plex Mono", weights: [500] }
spacing: "A 4px unit. The page is 100dvh and does not scroll. Desktop at 1100px and wider uses two 320px glass columns over a full-bleed canvas, with 20px column padding and 24px top and bottom crater insets. Below 1100px, including 390px, the canvas is the top region and a bottom sheet holds the HUD, with 12px sheet padding, 48px button heights, and safe-area insets. The center habitat stays in the open canvas between the columns."
radius: "12px glass panels, 14px dialogs, 10px buttons, 999px forecast chips and stock tracks. The canvas is square-cornered and full bleed. World shapes are diamonds, domes, and masts, not rounded app icons."
---
# Mars Colony Builder Game — Design System
Apply this design system to an existing project. It describes the look and feel only; for the full site, use prompt.md.
## Colors
- **Basalt** `#14110F` — Page background, canvas void, and dialog scrim base
- **Glass** `#1C1814` — HUD panels at 90 percent opacity with a 14px backdrop blur
- **Copper** `#E39B54` — The single accent: habitat dome, primary button, selection, focus ring, panel border at 35 percent
- **Copper deep** `#A86B38` — Habitat skirt, pressed button, and dome shadow
- **Regolith** `#C4784E` — Lightest basin floor tile
- **Regolith mid** `#B56545` — Middle basin floor tile
- **Regolith dark** `#A85A3C` — Darkest basin floor tile
- **Rim** `#5C3428` — Crater wall top
- **Rim face** `#3F241C` — Crater wall south face, doors, and greenhouse base
- **Dust** `#C4A574` — Haze particles, storm veil, and boulder highlight
- **Parchment** `#F3E6D4` — Primary text and habitat window
- **Clay** `#B7A394` — Secondary text, solar mast, and inactive tool labels
- **Sage** `#8FB573` — Oxygen bar and greenhouse panes
- **Ice** `#B7D0D6` — Water bar and drill bore
- **Morale clay** `#D9896A` — Morale bar
- **Warning** `#E07A5F` — Stocks under 25, invalid cells, and Advance anyway
- **Panel ink** `#1C120C` — Text on copper buttons
- **Array cell** `#3E4C55` — Solar panel fill
## Typography
- **Colony name, win and fail headlines, sol numeral** — Fraunces (OFL), weights 600/700. Self-host the font files.
- **HUD labels, help, buttons, and body** — Outfit (OFL), weights 400/500/600. Self-host the font files.
- **Stock numbers, forecast, and bed counts** — IBM Plex Mono (OFL), weights 500. Self-host the font files.
## Spacing & shape
- Spacing: A 4px unit. The page is 100dvh and does not scroll. Desktop at 1100px and wider uses two 320px glass columns over a full-bleed canvas, with 20px column padding and 24px top and bottom crater insets. Below 1100px, including 390px, the canvas is the top region and a bottom sheet holds the HUD, with 12px sheet padding, 48px button heights, and safe-area insets. The center habitat stays in the open canvas between the columns.
- Radius: 12px glass panels, 14px dialogs, 10px buttons, 999px forecast chips and stock tracks. The canvas is square-cornered and full bleed. World shapes are diamonds, domes, and masts, not rounded app icons.
## Motion
- Dust is the only continuous motion: 32 seeded particles drift right at 0.6 CSS pixels per frame and wrap the crater bounds. A storm raises the count to 64 and adds a flat Dust veil at 0.18 alpha.
- When motion is allowed, stock fills ease width over 160ms. Overlays fade opacity over 140ms with no travel greater than 8px. Buttons do not bounce.
- With prefers-reduced-motion, draw no particles, snap stock fills, use instant overlays, and keep a storm as the flat Dust veil only. Placement, removal, and sol resolution stay immediate.
- Stop the animation frame while the tab is hidden. Do not shake the canvas, flash the veil, or autoplay sound.
## Imagery
Draw the crater, rim, boulders, four structure types, selection, dust, storm veil, favicon, and build-bar glyphs in canvas and inline SVG. No photographs, generated images, downloaded textures, or sprites. The first screen's anchor is the centered habitat dome on the rust basin, with the glass HUD already readable around it.
## Tone
Calm, practical, and a little dry, like a field log from a small survey. Short US English, concrete yields, no exclamation marks, no epic colonization slogans, and no jokes about abandoning anyone on a planet.
---
— Prompt by VibeFather · https://vibefather.ai/t/mars-colony-builder-game · CC BY-NC 4.0 (non-commercial; commercial use needs a VibeFather Pro license) · Request removal: https://vibefather.ai/takedown
改成你自己的
- 一位课堂教师:将 BRAND 和 CRATER 设为一个班级殖民地,保留四项库存和沙尘暴日历,并用帮助日志来解释每个火星日只能放置一次。
- 一个桌游小组:将 EXPEDITION 设为你的俱乐部名称,在日志中重命名名单,并将简短的火星日循环用作两次聚会之间的规划谜题。
- 一个工作室作品集项目:将 BRAND 设为你的项目名称,TAGLINE 设为一句干练的实地日志,保留 canvas 陨石坑和玻璃 HUD 作为视觉锚点。
- 一个开发者演示:将 AUDIENCE 设为前端开发者,保留键盘光标和点击放置,并将静态构建作为自包含的 canvas 游戏发布。
火星殖民地建造游戏:常见问题
火星殖民地建造游戏中的沙尘暴是如何运作的?
火星殖民地建造游戏中的沙尘暴持续四个火星日,并在第 8、18、30、44、60 和 78 个火星日开始。沙尘暴期间,太阳能阵列产生 5 点电力而非 10 点,canvas 会增加一层平坦的沙尘帷幕和更多飘动的粒子。HUD 中的预报会显示下一次沙尘暴,因此你可以在它到来前储备电力。
殖民者如何到来,怎样才能让殖民地发展到 50 人?
在火星殖民地建造游戏中,当电力需求得到满足、每项库存至少为 35 且有空余床位时,会到来两名殖民者,上限为 50 人。每座居住舱可供八人休息。如果任何一项库存归零,本局结束。增长取决于同时平衡氧气、电力、水和士气,而不仅仅是放置居住舱。
怎么用 AI 做一个火星殖民地建造游戏?
复制本页的提示词,或者运行 npx vibefather add mars-colony-builder-game,把 [BRAND]、[CRATER]、[TAGLINE]、[AUDIENCE] 换成你自己的内容,再粘贴到 Claude Code、Codex、Cursor 等 AI 编程工具里。在线演示就是用这份提示词原样做出来的。