Thanks to visit codestin.com
Credit goes to github.com

Skip to content

isaozler/yahyaio-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ Yahya & Dad's Block World

A Roblox-style 3D block building game built with TypeScript, Next.js, and Three.js - perfect for learning game development together!

๐Ÿš€ Getting Started

Prerequisites

  • Bun (already installed)
  • Node.js 18+

Installation & Running

# Install dependencies
bun install

# Start the development server
bun dev

Then open http://localhost:3000 in your browser.

๐ŸŽฎ How to Play

Controls

  • W, A, S, D: Move your character (red block)
  • Space: Jump
  • Mouse: Look around (drag to rotate camera)
  • Mouse Click: Place blocks
  • Mouse Scroll: Zoom in/out

Features

  • 3D world with physics
  • Block placement system
  • Different colored blocks
  • Character movement and jumping
  • Save/Load game (coming soon)

๐Ÿ› ๏ธ For Developers (Dad & Yahya)

Project Structure

src/
โ”œโ”€โ”€ app/                # Next.js app directory
โ”‚   โ”œโ”€โ”€ page.tsx       # Main game page
โ”‚   โ””โ”€โ”€ layout.tsx     # App layout
โ”œโ”€โ”€ components/        # Game components
โ”‚   โ”œโ”€โ”€ Game.tsx       # Main game component
โ”‚   โ”œโ”€โ”€ Player.tsx     # Player character
โ”‚   โ”œโ”€โ”€ Ground.tsx     # Game ground
โ”‚   โ”œโ”€โ”€ BlockPlacer.tsx # Block placement system
โ”‚   โ””โ”€โ”€ GameUI.tsx     # User interface
โ”œโ”€โ”€ hooks/             # Custom React hooks
โ”‚   โ””โ”€โ”€ useGameManager.ts # Game state management
โ””โ”€โ”€ types/             # TypeScript type definitions
    โ””โ”€โ”€ game.ts        # Game-related types

Technologies Used

  • Next.js 14: React framework
  • TypeScript: Type-safe JavaScript
  • Three.js: 3D graphics library
  • React Three Fiber: React renderer for Three.js
  • React Three Cannon: Physics engine
  • Tailwind CSS: Styling

๐ŸŽฏ Learning Goals

For Yahya (Age 10)

  • Basic Programming Concepts

    • Variables and functions
    • If/else statements
    • Loops
    • Objects and properties
  • Game Development

    • How games work (game loop, rendering, input)
    • 3D coordinates (X, Y, Z)
    • Physics (gravity, collision)
    • User interfaces
  • Problem Solving

    • Breaking down big problems into smaller ones
    • Debugging (finding and fixing bugs)
    • Testing and iteration

For Dad

  • Modern React patterns (hooks, context)
  • TypeScript best practices
  • 3D programming with Three.js
  • Game architecture and state management

๐Ÿ”ง Development Ideas

Easy Features to Add Together

  1. More Block Types

    // Add to BlockPlacer.tsx
    const blockTypes = ['normal', 'bouncy', 'slippery', 'glowing'];
  2. Sound Effects

    // Add sound when placing blocks
    const playSound = (soundName: string) => {
      const audio = new Audio(`/sounds/${soundName}.mp3`);
      audio.play();
    };
  3. Particle Effects

    // Add sparkles when placing blocks
  4. Score System

    // Count blocks placed, time played, structures built

Medium Features

  1. Multiplayer (local split-screen)
  2. Building Templates (houses, castles, etc.)
  3. Game Modes (creative, survival, racing)
  4. Inventory System

Advanced Features

  1. Custom Block Shapes
  2. Scripting System (simple visual programming)
  3. World Generation
  4. Animation System

๐Ÿ“š Learning Resources

For Kids

For Adults

๐ŸŽจ Customization Ideas

Change Colors

Edit src/components/GameUI.tsx to add new colors:

const colors = [
  { name: 'Blue', value: '#3b82f6' },
  { name: 'Pink', value: '#ec4899' },    // Add this
  { name: 'Cyan', value: '#06b6d4' },    // Add this
  // ... more colors
];

Change Physics

Edit src/components/Game.tsx:

<Physics gravity={[0, -30, 0]}> // Make gravity stronger/weaker

Change Player Speed

Edit src/components/Player.tsx:

const speed = 5; // Make player faster/slower
const jumpForce = 15; // Make jumping higher/lower

๐Ÿ› Common Issues

Game Won't Start

  1. Make sure all dependencies are installed: bun install
  2. Check the browser console for errors (F12)
  3. Make sure you're using a modern browser (Chrome, Firefox, Safari)

Performance Issues

  1. Reduce the number of blocks
  2. Lower the shadow quality in Game.tsx
  3. Disable Stats component for better performance

๐Ÿค Contributing

This is a learning project! Feel free to:

  • Add new features
  • Fix bugs
  • Improve documentation
  • Add comments to help understand the code

๐Ÿ“ Development Log

Keep track of what you've learned and built:

Session 1 (Today)

  • โœ… Set up the basic game structure
  • โœ… Added player movement (WASD + Space)
  • โœ… Added block placement system
  • โœ… Created basic UI

Next Session Ideas

  • Add sound effects
  • Create different block types
  • Add a simple scoring system
  • Make the player look like a character instead of a red box

Have fun building and learning together! ๐ŸŽฎโœจ

About

Game with my son

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published