Initial commit
This commit is contained in:
@@ -0,0 +1,414 @@
|
||||
require('dotenv').config();
|
||||
const { pool } = require('../src/models/db');
|
||||
const { generateGame } = require('../src/utils/claude');
|
||||
|
||||
const ADMIN_USER_ID = 2; // arcade_master
|
||||
|
||||
const classicGames = [
|
||||
{
|
||||
title: "Snake",
|
||||
prompt: `Create a classic Snake game where the player controls a snake that grows longer each time it eats food.
|
||||
|
||||
GAMEPLAY MECHANICS:
|
||||
- The snake moves continuously in the current direction
|
||||
- Arrow keys (desktop) or swipe gestures (mobile) change direction
|
||||
- A food item (apple or dot) appears randomly on the screen
|
||||
- When the snake eats food, it grows by one segment and score increases by 10
|
||||
- The game ends if the snake hits the wall or its own body
|
||||
- Snake should start with 3 segments moving to the right
|
||||
- Speed should gradually increase every 50 points
|
||||
|
||||
VISUAL DESIGN:
|
||||
- Use a grid-based playing field with a subtle grid pattern
|
||||
- Snake head should be slightly different color than body (dark green head, lighter green body)
|
||||
- Food should be red and visually distinct (like an apple)
|
||||
- Display score prominently in the top-left corner
|
||||
- Show a "Game Over" screen with final score and "Play Again" button
|
||||
|
||||
CONTROLS:
|
||||
- Desktop: Arrow keys for direction
|
||||
- Mobile: Swipe in any direction to change snake direction
|
||||
- Prevent 180-degree turns (can't go directly backward)`
|
||||
},
|
||||
{
|
||||
title: "Tetris",
|
||||
prompt: `Create a Tetris-style falling block puzzle game.
|
||||
|
||||
GAMEPLAY MECHANICS:
|
||||
- Seven different tetromino shapes (I, O, T, S, Z, J, L) fall from the top
|
||||
- Player can move pieces left/right and rotate them
|
||||
- Pieces fall automatically at a steady pace
|
||||
- When a horizontal line is completely filled, it clears and awards points
|
||||
- Clearing multiple lines at once awards bonus points (1 line=100, 2=300, 3=500, 4=800)
|
||||
- Game ends when pieces stack to the top
|
||||
- Show the next piece that will appear
|
||||
|
||||
VISUAL DESIGN:
|
||||
- 10 columns wide, 20 rows tall playing field
|
||||
- Each tetromino type has a distinct bright color
|
||||
- Ghost piece shows where current piece will land
|
||||
- Clear lines with a satisfying flash animation
|
||||
- Display score, level, and lines cleared
|
||||
- Level increases every 10 lines, increasing fall speed
|
||||
|
||||
CONTROLS:
|
||||
- Left/Right arrows or A/D: Move piece horizontally
|
||||
- Up arrow or W: Rotate piece clockwise
|
||||
- Down arrow or S: Soft drop (faster fall)
|
||||
- Space: Hard drop (instant drop)
|
||||
- Mobile: On-screen buttons for all actions`
|
||||
},
|
||||
{
|
||||
title: "Pong",
|
||||
prompt: `Create a classic Pong game - the original video game tennis.
|
||||
|
||||
GAMEPLAY MECHANICS:
|
||||
- Two paddles on opposite sides of the screen (left and right)
|
||||
- A ball bounces between them
|
||||
- Players score when the ball passes the opponent's paddle
|
||||
- Ball speed increases slightly after each paddle hit
|
||||
- Ball angle changes based on where it hits the paddle (edges = sharper angles)
|
||||
- First player to 11 points wins
|
||||
- Ball resets to center after each point, launching toward the player who was scored on
|
||||
|
||||
VISUAL DESIGN:
|
||||
- Black background with white elements (classic arcade look)
|
||||
- Dotted line down the center of the screen
|
||||
- Paddles are simple white rectangles
|
||||
- Ball is a small white square
|
||||
- Large score display at top for both players
|
||||
- "Player 1 Wins!" or "Player 2 Wins!" message at game end
|
||||
|
||||
CONTROLS:
|
||||
- Player 1 (left): W/S keys to move up/down
|
||||
- Player 2 (right): Up/Down arrow keys
|
||||
- Mobile: Touch left side to control left paddle, right side for right paddle
|
||||
- Alternatively, make Player 2 a simple AI opponent`
|
||||
},
|
||||
{
|
||||
title: "Breakout",
|
||||
prompt: `Create a Breakout/Brick Breaker arcade game.
|
||||
|
||||
GAMEPLAY MECHANICS:
|
||||
- Rows of colored bricks at the top of the screen
|
||||
- Player controls a paddle at the bottom
|
||||
- Ball bounces around, breaking bricks on contact
|
||||
- Different colored bricks may take multiple hits (green=1, yellow=2, orange=3, red=4)
|
||||
- Some bricks drop power-ups: wider paddle, multi-ball, slow ball
|
||||
- Player has 3 lives, loses one if ball falls below paddle
|
||||
- Level complete when all bricks are destroyed
|
||||
- Ball angle changes based on where it hits the paddle
|
||||
|
||||
VISUAL DESIGN:
|
||||
- Colorful brick arrangement (rainbow pattern from top to bottom)
|
||||
- Bricks should visibly crack or change color when damaged
|
||||
- Particle effects when bricks break
|
||||
- Paddle has a metallic/shiny appearance
|
||||
- Display score at top, lives as small ball icons
|
||||
- Power-ups are falling capsules with distinct colors
|
||||
|
||||
CONTROLS:
|
||||
- Mouse movement or Left/Right arrows move the paddle
|
||||
- Click or Space to launch the ball from paddle at game start
|
||||
- Mobile: Touch and drag to move paddle`
|
||||
},
|
||||
{
|
||||
title: "Space Invaders",
|
||||
prompt: `Create the classic Space Invaders alien shooting game.
|
||||
|
||||
GAMEPLAY MECHANICS:
|
||||
- Grid of alien invaders (5 rows of 11) march left and right, dropping down each time they hit an edge
|
||||
- Player ship at bottom can move left/right and shoot upward
|
||||
- Aliens occasionally drop bombs downward
|
||||
- Player has 3 lives, loses one if hit by bomb
|
||||
- Killing aliens awards points (bottom row=10, increasing by 10 per row up)
|
||||
- Mystery UFO occasionally flies across the top (bonus 50-300 points)
|
||||
- Aliens speed up as fewer remain
|
||||
- Game over if aliens reach the bottom
|
||||
|
||||
VISUAL DESIGN:
|
||||
- Classic pixel-art style aliens (3 different designs for variety)
|
||||
- Aliens animate between 2 frames as they move
|
||||
- Green player ship with white bullets
|
||||
- Four destructible shields/bunkers that erode when hit
|
||||
- Black space background with stars
|
||||
- Score and high score at top, lives shown as ship icons
|
||||
|
||||
CONTROLS:
|
||||
- Left/Right arrows or A/D to move ship
|
||||
- Space bar to shoot (limit: one bullet on screen at a time for authenticity, or allow 3)
|
||||
- Mobile: Touch left/right sides to move, tap center to shoot`
|
||||
},
|
||||
{
|
||||
title: "Pac-Man",
|
||||
prompt: `Create a Pac-Man style maze chase game.
|
||||
|
||||
GAMEPLAY MECHANICS:
|
||||
- Player controls Pac-Man through a maze eating dots
|
||||
- Four ghosts chase Pac-Man with different behaviors
|
||||
- Small dots = 10 points, large power pellets = 50 points
|
||||
- Power pellets make ghosts vulnerable (blue) for 8 seconds - eating them = 200, 400, 800, 1600 points
|
||||
- Player has 3 lives, loses one if touched by a non-vulnerable ghost
|
||||
- Level complete when all dots are eaten
|
||||
- Tunnels on sides wrap around to opposite side
|
||||
- Ghosts get faster with each level
|
||||
|
||||
VISUAL DESIGN:
|
||||
- Classic maze layout with blue walls
|
||||
- Pac-Man is yellow circle with animated chomping mouth
|
||||
- Four colorful ghosts: red (Blinky), pink (Pinky), cyan (Inky), orange (Clyde)
|
||||
- Ghosts have cute eyes that look in their direction of travel
|
||||
- Dots are small, power pellets are large and flashing
|
||||
- Display score, high score, and lives
|
||||
|
||||
CONTROLS:
|
||||
- Arrow keys for direction (Pac-Man turns at next intersection)
|
||||
- Mobile: Swipe in direction to turn
|
||||
- Pac-Man continues moving in current direction until wall`
|
||||
},
|
||||
{
|
||||
title: "Flappy Bird",
|
||||
prompt: `Create a Flappy Bird-style endless flying game.
|
||||
|
||||
GAMEPLAY MECHANICS:
|
||||
- Bird automatically falls due to gravity
|
||||
- Tapping/clicking makes the bird flap and rise
|
||||
- Pipes (or obstacles) scroll from right to left with gaps to fly through
|
||||
- Each pipe passed = 1 point
|
||||
- Game over if bird hits pipe or ground/ceiling
|
||||
- Pipe gap size stays constant, but spacing between pipes can vary
|
||||
- Bird rotates based on velocity (nose up when rising, nose down when falling)
|
||||
- High score is saved and displayed
|
||||
|
||||
VISUAL DESIGN:
|
||||
- Cute, simple bird with flapping wing animation
|
||||
- Colorful green pipes coming from top and bottom
|
||||
- Scrolling background with clouds and simple scenery
|
||||
- Ground at bottom with scrolling texture
|
||||
- Large score display in center-top during play
|
||||
- Game over screen shows score vs best score with "Tap to Retry"
|
||||
|
||||
CONTROLS:
|
||||
- Spacebar, click, or tap anywhere to flap
|
||||
- That's it - one-button gameplay!
|
||||
- Bird should feel floaty with satisfying physics`
|
||||
},
|
||||
{
|
||||
title: "2048",
|
||||
prompt: `Create the 2048 sliding number puzzle game.
|
||||
|
||||
GAMEPLAY MECHANICS:
|
||||
- 4x4 grid of tiles
|
||||
- Tiles contain powers of 2 (2, 4, 8, 16... up to 2048+)
|
||||
- Swiping/arrow key slides ALL tiles in that direction
|
||||
- When two tiles with same number collide, they merge into their sum
|
||||
- After each move, a new tile (2 or 4) appears in a random empty spot
|
||||
- Goal: Create a 2048 tile (though game continues after)
|
||||
- Game over when no more moves are possible
|
||||
- Score increases by the value of each merged tile
|
||||
|
||||
VISUAL DESIGN:
|
||||
- Clean, modern design with rounded tile corners
|
||||
- Each number has a distinct background color (2=light, higher=darker/warmer)
|
||||
- Smooth sliding and merging animations
|
||||
- Tiles should pop/scale when they appear and merge
|
||||
- Display current score and best score
|
||||
- Large, clear numbers on tiles
|
||||
- "You Win!" celebration when reaching 2048, with option to continue
|
||||
|
||||
CONTROLS:
|
||||
- Arrow keys to slide all tiles in a direction
|
||||
- Mobile: Swipe gestures in any direction
|
||||
- Consider adding "Undo" button for last move`
|
||||
},
|
||||
{
|
||||
title: "Minesweeper",
|
||||
prompt: `Create the classic Minesweeper puzzle game.
|
||||
|
||||
GAMEPLAY MECHANICS:
|
||||
- Grid of covered cells (start with 10x10 with 15 mines for beginner)
|
||||
- Left-click reveals a cell
|
||||
- Numbers show how many adjacent cells (including diagonals) contain mines
|
||||
- Empty cells auto-reveal adjacent empty cells (flood fill)
|
||||
- Right-click places a flag to mark suspected mines
|
||||
- First click is always safe (never a mine)
|
||||
- Win by revealing all non-mine cells
|
||||
- Lose by clicking a mine (reveal all mines, show X on wrong flags)
|
||||
- Timer starts on first click
|
||||
|
||||
VISUAL DESIGN:
|
||||
- Clean grid with beveled 3D-style unrevealed cells
|
||||
- Revealed cells are flat with clear numbers
|
||||
- Numbers colored by value (1=blue, 2=green, 3=red, etc.)
|
||||
- Mines shown as black circles/bombs when revealed
|
||||
- Flags are red
|
||||
- Smiley face button to restart (changes expression: smile, surprised on click, dead on loss, cool on win)
|
||||
- Display mine count remaining and timer
|
||||
|
||||
CONTROLS:
|
||||
- Left-click to reveal cell
|
||||
- Right-click to toggle flag
|
||||
- Mobile: Tap to reveal, long-press to flag
|
||||
- Include toggle button for flag mode on mobile`
|
||||
},
|
||||
{
|
||||
title: "Asteroids",
|
||||
prompt: `Create the classic Asteroids space shooter game.
|
||||
|
||||
GAMEPLAY MECHANICS:
|
||||
- Player ship in center of screen can rotate and thrust
|
||||
- Ship wraps around screen edges (appears on opposite side)
|
||||
- Shoot bullets to destroy asteroids
|
||||
- Large asteroids split into 2 medium, medium split into 2 small
|
||||
- Points: Large=20, Medium=50, Small=100
|
||||
- Player has 3 lives, loses one if hit by asteroid
|
||||
- Ship has brief invincibility after respawning
|
||||
- UFOs occasionally appear and shoot at player (Small=1000pts, Large=200pts)
|
||||
- Hyperspace: random teleport as escape (risky - might teleport into asteroid)
|
||||
|
||||
VISUAL DESIGN:
|
||||
- Vector graphics style (white lines on black background)
|
||||
- Ship is a simple triangle that rotates smoothly
|
||||
- Asteroids are irregular polygons that rotate as they drift
|
||||
- Bullets are small dots/lines
|
||||
- Thrust shows small particles behind ship
|
||||
- Ship explosion is satisfying particle burst
|
||||
- Display score and lives (ship icons)
|
||||
|
||||
CONTROLS:
|
||||
- Left/Right arrows or A/D to rotate ship
|
||||
- Up arrow or W to thrust forward
|
||||
- Space to shoot
|
||||
- Shift or X for hyperspace
|
||||
- Mobile: On-screen joystick for rotation/thrust, fire button`
|
||||
},
|
||||
{
|
||||
title: "Frogger",
|
||||
prompt: `Create a Frogger-style road and river crossing game.
|
||||
|
||||
GAMEPLAY MECHANICS:
|
||||
- Frog starts at bottom, must reach one of 5 home bases at top
|
||||
- Bottom half: Cross road with cars/trucks moving at different speeds
|
||||
- Top half: Cross river by jumping on logs and turtles
|
||||
- Falling in water or getting hit by vehicle = lose a life
|
||||
- Turtles occasionally submerge (warning animation first)
|
||||
- Bonus items appear on logs (flies for points, female frog for bonus)
|
||||
- Time limit per frog (30 seconds) - bonus points for time remaining
|
||||
- Fill all 5 home bases to complete level
|
||||
- Each level, traffic and logs move faster
|
||||
|
||||
VISUAL DESIGN:
|
||||
- Colorful top-down view
|
||||
- Cute pixel-art frog that faces direction of last move
|
||||
- Road section: gray with lane markings, colorful vehicles
|
||||
- River section: blue water, brown logs, green turtles
|
||||
- Safe zones: green grass/lily pads
|
||||
- Home bases at top with flowers when empty, frog when filled
|
||||
- Display score, time bar, and lives
|
||||
|
||||
CONTROLS:
|
||||
- Arrow keys for hopping in four directions
|
||||
- Each press = one hop (grid-based movement)
|
||||
- Mobile: Swipe in direction to hop, or on-screen d-pad`
|
||||
},
|
||||
{
|
||||
title: "Simon Says",
|
||||
prompt: `Create a Simon Says memory pattern game.
|
||||
|
||||
GAMEPLAY MECHANICS:
|
||||
- Four colored buttons arranged in quadrants (red, blue, green, yellow)
|
||||
- Computer plays a sequence by lighting up buttons with sounds
|
||||
- Player must repeat the sequence by clicking buttons in same order
|
||||
- Sequence grows by one each successful round
|
||||
- Wrong button = game over, show final score (rounds completed)
|
||||
- Speed increases gradually as sequence gets longer
|
||||
- Each color has a distinct tone/sound
|
||||
- High score is saved and displayed
|
||||
|
||||
VISUAL DESIGN:
|
||||
- Large circular or rounded square device
|
||||
- Four bright colored quadrants that light up when active (glow effect)
|
||||
- Center shows current round number
|
||||
- Buttons dim when inactive, bright when pressed/shown
|
||||
- "Simon Says" title at top
|
||||
- Satisfying button press animations (press down effect)
|
||||
- Game over screen with score and "Play Again"
|
||||
- Consider a "strict mode" toggle (one mistake = restart from beginning vs. one mistake = retry same sequence)
|
||||
|
||||
CONTROLS:
|
||||
- Click/tap on colored buttons to repeat sequence
|
||||
- Each button should have hover effect on desktop
|
||||
- Consider keyboard shortcuts (1,2,3,4 or Q,W,A,S for the four colors)
|
||||
- "Start" button to begin new game`
|
||||
}
|
||||
];
|
||||
|
||||
async function createGame(gameData, index) {
|
||||
console.log(`\n[${index + 1}/12] Generating: ${gameData.title}...`);
|
||||
|
||||
try {
|
||||
const result = await generateGame(gameData.prompt);
|
||||
|
||||
if (!result.success) {
|
||||
console.error(` Failed to generate ${gameData.title}: ${result.error}`);
|
||||
return null;
|
||||
}
|
||||
|
||||
// Insert into database with prompt
|
||||
const dbResult = await pool.query(
|
||||
`INSERT INTO games (creator_id, title, description, game_code, prompt, status, published_at)
|
||||
VALUES ($1, $2, $3, $4, $5, 'published', NOW())
|
||||
RETURNING id`,
|
||||
[
|
||||
ADMIN_USER_ID,
|
||||
gameData.title,
|
||||
gameData.prompt.split('\n\n')[0], // Use first paragraph as description
|
||||
result.code,
|
||||
gameData.prompt
|
||||
]
|
||||
);
|
||||
|
||||
console.log(` Created: ${gameData.title} (ID: ${dbResult.rows[0].id})`);
|
||||
return dbResult.rows[0].id;
|
||||
} catch (error) {
|
||||
console.error(` Error creating ${gameData.title}:`, error.message);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async function main() {
|
||||
console.log('Creating 12 classic games with detailed prompts...\n');
|
||||
console.log('Using Claude Sonnet 4 for high-quality game generation.');
|
||||
console.log('This will take several minutes...\n');
|
||||
|
||||
const createdGames = [];
|
||||
|
||||
for (let i = 0; i < classicGames.length; i++) {
|
||||
const gameId = await createGame(classicGames[i], i);
|
||||
if (gameId) {
|
||||
createdGames.push({ title: classicGames[i].title, id: gameId });
|
||||
}
|
||||
|
||||
// Small delay between API calls
|
||||
if (i < classicGames.length - 1) {
|
||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||
}
|
||||
}
|
||||
|
||||
console.log('\n========================================');
|
||||
console.log('SUMMARY');
|
||||
console.log('========================================');
|
||||
console.log(`Successfully created: ${createdGames.length}/12 games\n`);
|
||||
|
||||
createdGames.forEach(g => {
|
||||
console.log(` - ${g.title} (ID: ${g.id})`);
|
||||
});
|
||||
|
||||
await pool.end();
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
main().catch(err => {
|
||||
console.error('Fatal error:', err);
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in New Issue
Block a user