Skip to content

๐ŸŽฎ A web-based implementation of Hollow Knight built with vanilla JavaScript and HTML5 Canvas. Features 2D platformer mechanics, boss battles, sprite animations, and atmospheric audio. Created in 2022 without AI assistance.

Notifications You must be signed in to change notification settings

TinTinWinata/hollow-knight-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

86 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Hollow Knight JavaScript Game

A web-based implementation of Hollow Knight built with vanilla JavaScript, HTML5 Canvas, and modern web technologies. This project recreates the atmospheric 2D platformer experience in the browser.

Project Initiated: 2022 | Created WITHOUT the use of any Artificial Intelligence

Hollow Knight Game Screenshot

๐ŸŽฎ Game Overview

This is a browser-based adaptation of the beloved indie game Hollow Knight. Players control the enigmatic Knight as they explore a vast, ancient kingdom beneath the fading town of Dirtmouth. The game features platforming mechanics, combat systems, boss battles, and atmospheric audio-visual design.

โœจ Features

Core Gameplay

  • 2D Platformer Mechanics: Jump, dash, and navigate through challenging environments
  • Combat System: Attack enemies with your nail, use special abilities like blast attacks
  • Boss Battles: Face off against formidable foes like the False Knight
  • Enemy AI: Fight against Crawlids, Booflies, and other creatures
  • Health System: Manage your health with a visual health bar
  • Currency System: Collect geo (money) from defeated enemies

Technical Features

  • HTML5 Canvas Rendering: Smooth 60fps gameplay
  • Sprite Animation: Detailed character and enemy animations
  • Audio System: Immersive sound effects and background music
  • Camera System: Dynamic camera following with screen shake effects
  • Particle Effects: Visual feedback for attacks and environmental effects
  • Pause System: Full game pause with options menu
  • Fullscreen Mode: Immersive fullscreen gameplay experience

UI/UX Features

  • Responsive Design: Works across different screen sizes
  • Landing Page: Beautiful promotional website with game information
  • Interactive Elements: Animated menus and transitions
  • Settings Menu: Volume control and FPS display options

๐Ÿš€ Getting Started

Prerequisites

  • A modern web browser (Chrome, Firefox, Safari, Edge)
  • A local web server (for asset loading)

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/hollow-knight-js.git
    cd hollow-knight-js
  2. Start a local server

    Using Python:

    # Python 3
    python -m http.server 8000
    
    # Python 2
    python -m SimpleHTTPServer 8000

    Using Node.js:

    npx http-server

    Using PHP:

    php -S localhost:8000
  3. Open in browser Navigate to http://localhost:8000 in your web browser

๐ŸŽฏ How to Play

Controls

  • Arrow Keys / WASD: Move left/right
  • Space / W / Up Arrow: Jump
  • X: Attack with nail
  • C: Dash
  • Z: Blast attack
  • Escape: Pause game
  • F: Toggle fullscreen
  • Enter: Start game

Gameplay Tips

  • Defeat enemies to collect geo (money)
  • Use platforms to reach higher areas
  • Watch your health - you have 5 hearts
  • Find the boss door by defeating enough enemies
  • Use dash to avoid attacks and reach distant platforms
  • Rest at benches to recover health

๐Ÿ—๏ธ Project Structure

hollow-knight-js/
โ”œโ”€โ”€ assets/                 # Game assets
โ”‚   โ”œโ”€โ”€ game/              # In-game sprites and audio
โ”‚   โ”‚   โ”œโ”€โ”€ audio/         # Sound effects and music
โ”‚   โ”‚   โ”œโ”€โ”€ hero/          # Player character sprites
โ”‚   โ”‚   โ”œโ”€โ”€ boss/          # Boss enemy sprites
โ”‚   โ”‚   โ”œโ”€โ”€ enemies/       # Enemy sprites (crawlid, boofly)
โ”‚   โ”‚   โ””โ”€โ”€ ui/            # User interface elements
โ”‚   โ”œโ”€โ”€ landing/           # Landing page assets
โ”‚   โ””โ”€โ”€ font/              # Custom fonts
โ”œโ”€โ”€ css/                   # Stylesheets
โ”‚   โ”œโ”€โ”€ game.css          # Game-specific styles
โ”‚   โ”œโ”€โ”€ landing.css       # Landing page styles
โ”‚   โ””โ”€โ”€ style.css         # Base styles
โ”œโ”€โ”€ js/                    # JavaScript modules
โ”‚   โ”œโ”€โ”€ game/             # Core game logic
โ”‚   โ”‚   โ”œโ”€โ”€ model/        # Game object classes
โ”‚   โ”‚   โ”œโ”€โ”€ facade/       # Utility modules
โ”‚   โ”‚   โ””โ”€โ”€ parent/       # Base classes
โ”‚   โ”œโ”€โ”€ system/           # System modules
โ”‚   โ””โ”€โ”€ landing.js        # Landing page functionality
โ”œโ”€โ”€ index.html            # Landing page
โ”œโ”€โ”€ game.html             # Game page
โ””โ”€โ”€ auth.html             # Authentication page

๐Ÿ› ๏ธ Technical Architecture

Core Systems

  • Game Engine: Custom JavaScript game engine with entity-component architecture
  • Rendering: HTML5 Canvas with sprite-based graphics
  • Physics: Custom collision detection and gravity system
  • Audio: Web Audio API integration with volume controls
  • Animation: Frame-based sprite animation system

Key Classes

  • GAME: Main game controller and state management
  • Player: Player character with movement and combat abilities
  • Boss: Boss enemy with complex AI patterns
  • Crawlid/Boofly: Enemy classes with different behaviors
  • Camera: Dynamic camera system with smooth following
  • UI: User interface management
  • Audio: Audio system with background music and sound effects

๐ŸŽจ Assets

The game includes:

  • Character Sprites: Detailed animations for player, enemies, and bosses
  • Environment Art: Backgrounds, platforms, and environmental objects
  • Audio: High-quality sound effects and atmospheric music
  • UI Elements: Health bars, currency display, and menu graphics

๐Ÿ”ง Development

Adding New Features

  1. Create new model classes in js/game/model/
  2. Extend base classes from js/game/parent/
  3. Register new objects in the main game loop
  4. Add corresponding sprites to the assets folder

Performance Optimization

  • Sprite caching for improved performance
  • Efficient collision detection algorithms
  • Optimized rendering pipeline
  • Audio preloading and management

๐Ÿ› Known Issues

  • Some audio files may not load in certain browsers
  • Performance may vary on older devices
  • Fullscreen mode requires user interaction to activate

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.

Development Guidelines

  • Follow existing code style and structure
  • Test changes across different browsers
  • Ensure assets are properly optimized
  • Document new features and changes

๐Ÿ“„ License

This project is inspired by Hollow Knight by Team Cherry. This is a fan-made recreation for educational purposes.

๐Ÿ™ Acknowledgments

  • Team Cherry: Original creators of Hollow Knight
  • Christopher Larkin: Composer of the original soundtrack

๐Ÿ“ž Contact

Created by TinTin Winata as part of Web Design NAR 23-1 project.

Important Note: This project was initiated in 2022 and developed entirely without the use of any artificial intelligence tools or assistance. All code, game logic, and implementation was created through traditional programming methods and human creativity.


"Alongside Courage And Perseverance We Shape and Define Our Future" - JT 22-1

JeTe Knight - Inspired by Hollow Knight

About

๐ŸŽฎ A web-based implementation of Hollow Knight built with vanilla JavaScript and HTML5 Canvas. Features 2D platformer mechanics, boss battles, sprite animations, and atmospheric audio. Created in 2022 without AI assistance.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published