Easy to Learn
Designed with beginners in mind. Start creating games with just a few lines of code.
Lightweight
Minimal footprint with powerful features. No dependencies required.
2D Game Focused
Built specifically for 2D games with physics, collisions, and sprite management.
Extensible
Extend functionality with performance extensions and custom components.
About TCJSgame
Latest Version: 3.0 | Release Date: September 3, 2025
TCJSgame is a lightweight JavaScript game engine for creating 2D games directly in the browser. It uses a canvas-based rendering system and provides essential classes for Display, Components, Camera, Sound, Sprites, and TileMaps.
History & Development
TCJSgame was created by Owolabi Kehinde as a learning project that evolved into a full-featured game engine. Starting as Jgame in 2023, it became TCgame in 2024, and was rebranded to TCJSgame in 2025.
Version 3 introduces improved movement utilities, angle-based motion, TileMap rendering, a camera system, and a more robust Component class.
TCJSgame Playground
Experiment with TCJSgame directly in your browser using the official playground. Test code, create prototypes, and see results in real-time!
The playground supports both V3 and V2 of the TCJSgame engine with an intuitive interface for rapid development.
Quick Start
Get started with TCJSgame in minutes. Here's a simple example to create a basic game scene:
const display = new Display();
display.start(800, 600);
// Create a player component
const player = new Component(50, 50, "blue", 100, 100, "rectangle");
player.speedX = 5;
// Add to display
display.add(player);
// Game loop
function update() {
// Move player with arrow keys
if (state.key("ArrowRight")) player.x += player.speedX;
if (state.key("ArrowLeft")) player.x -= player.speedX;
}
Tutorials & Examples
Learn TCJSgame with step-by-step tutorials and examples:
Terra Codes
Terra Codes is a software company focused on creating tools for developers, designers, and computer enthusiasts.
About Terra Codes
Founded by a Nigerian teenager at age 16, Terra Codes aims to gather developers and create innovative software solutions.
Dino Game Tutorial
Build a Chrome Dino-style game with TCJSgame V2. This step-by-step tutorial covers:
- Setting up the game display
- Creating player and obstacles
- Implementing physics and collisions
- Adding score tracking
View Code Snippet
const dino = new Component(37.5, 75, "img/dino.png", 0, display.canvas.height - 100, "image");
dino.physics = true;
dino.gravity = 1;
display.add(dino);
// Jump function
function jump() {
if (dino.y >= display.canvas.height - dino.height) {
dino.gravity = -8;
setTimeout(() => { dino.gravity = 1; }, 180);
}
}
Dino Game - Complete Tutorial
HTML File (index.html)
Create the main HTML file with game controls and layout:
JavaScript Game Code (dino.js)
Create the game logic in a separate JavaScript file:
Project File Structure
Organize your files like this:
Enhanced Game Features
Here are some improvements you can add to your game:
🎯 What You'll Learn
🏗️ Component Creation
Creating game objects with images and physics
⚡ Physics System
Using gravity and physics for realistic movement
🎮 Input Handling
Keyboard controls and button interactions
💥 Collision Detection
Using crashWith() for game logic
📊 Data Persistence
Saving highscores with localStorage
🔄 Game Loop
Using the update() function effectively
📱 Mobile Support
Touch-friendly button controls
🎯 Progressive Difficulty
Increasing challenge over time
🖼️ Required Assets
Create an img/ folder with these images:
- dino.png - Player character (37.5 × 75 pixels)
- obt.png - Cactus obstacle (18.75 × 37.5 pixels)
Tip: You can use colored rectangles while testing: "green" instead of "img/dino.png"
🚀 Quick Start
- Download TCJSgame V2 from the Download page
- Create the three files:
index.html,dino.js, andimg/folder - Copy the code above into your files
- Open
index.htmlin your browser - Press Spacebar or click the Jump button to play!
TCJSgame Extensions
Extend TCJSgame's capabilities with powerful official extensions. These add-ons provide specialized functionality for performance, text rendering, and advanced game features.
🚀 Performance Extensions
Optimize your games for better frame rates and smoother gameplay.
Patched Performance Extension
PerformanceComplete performance overhaul with advanced optimization features.
- Replaces game loop with requestAnimationFrame
- Viewport culling for better rendering
- Component caching system
- Delta time integration
- Real-time FPS monitoring
Installation:
Usage:
speed.js
PerformanceLightweight game loop optimization for consistent 60 FPS.
- Optimized game loop timing
- Frame rate stabilization
- Minimal performance overhead
- Easy integration
Installation:
tcjsgame-perf.js
PerformanceGeneral performance optimization with essential features.
- requestAnimationFrame integration
- Delta time support
- Basic caching system
- Viewport culling
Installation:
📝 Text & UI Extensions
Enhanced text rendering and user interface components.
Tctxt Extension
TextAdvanced text rendering with background, stroke, and alignment options.
- Custom font styling
- Background padding
- Text stroke/outline effects
- Advanced alignment options
- Dynamic text updates
Installation:
Usage:
🎵 Audio Extensions
Enhanced audio capabilities and sound management.
Advanced Audio
AudioExtended audio features with spatial audio and effects.
- Audio spatialization
- Volume fading
- Audio pooling
- Cross-browser compatibility
Installation:
📥 Installation Guide
1. Download Extension
Get the extension file from the official repository or download link.
2. Include in HTML
Add the extension script after the main TCJSgame engine:
3. Initialize in Code
Use the extension features in your game code as shown in the examples.
📊 Extension Comparison
| Extension | Type | Size | Browser Support | Difficulty |
|---|---|---|---|---|
| Patched Performance | Performance | ~8KB | All modern browsers | Beginner |
| speed.js | Performance | ~3KB | All modern browsers | Beginner |
| Tctxt | Text Rendering | ~5KB | All modern browsers | Beginner |