Skip to content

dot4msc/origin-ts

Repository files navigation

🚀 origin-ts Engine (v0.0.1)

origin-ts is a specialized, high-performance game engine built with TypeScript, designed exclusively for pixel art RPGs. It provides a professional-grade foundation for world-building, entity management, and cinematic storytelling.


✨ Core Features

🎮 Advanced ECS Architecture

  • Modular Entities: Use the Entity-Component-System pattern to build complex actors (Players, NPCs, Items) using reusable data components.
  • Decoupled Logic: Separate your game logic (Systems) from your data (Components) for maximum scalability.

🖥️ Pixel-Perfect Rendering

  • Integer Scaling: Automatic calculation of scaling factors to ensure your pixels stay crisp on any screen size.
  • Z-Depth Sorting: Automatic Y-coordinate sorting ensures players correctly walk behind/in-front of trees, buildings, and NPCs.

🛡️ World & Physics

  • Tiled Support: Direct integration with Tiled Map Editor (.tmj JSON).
  • Sliding Collisions: AABB bounding box physics that allow for smooth sliding along walls and diagonal movement.

💬 RPG Mechanics

  • Dialogue Engine: Cinematic typewriter effects, speaker portraits, and branching text management.
  • Event System: A Promise-based system for scripting cutscenes and map triggers.
  • Save System: Built-in persistence using localStorage.

🌓 Retro Shaders (CSS-Based)

  • CRT Scanlines: Subtile horizontal scanlines for that classic monitor feel.
  • Day/Night Cycles: Dynamic color grading for sunset and night-time aesthetics.
  • Vignette: Subtle edge-darkening to focus player attention.

📦 Installation

From NPM

npm install origin-ts

Local Installation (Same Machine)

Use this if you want to point directly to the origin-ts folder:

# Replace with your actual path to the origin-ts folder
npm install "/path/to/origin-ts"

Global Linking (Recommended for Dev)

Use this to make the engine accessible globally on your machine:

# In the origin-ts folder
npm link

# In your game project folder
npm link origin-ts

🚀 Quick Start

import { Engine, Display, World, AbstractEntityFactory, DefaultGameFactory } from 'origin-ts';

const display = new Display('app');
const world = new World();
const factory: AbstractEntityFactory = new DefaultGameFactory(world);

// Create a player actor using the Factory
factory.createPlayer({ spriteName: 'hero-sprite', x: 160, y: 90, speed: 100 });

// Start the engine
const engine = new Engine(
  (dt) => world.update(dt),
  (interpolation) => {
    display.clear('#000000');
    world.render(interpolation);
  }
);
engine.start();

📂 Project Architecture

src/
├── core/           # Main Loop, Input, Assets, Events, Persistence
├── rendering/      # Canvas (Display) & Sprite management
├── world/          # Tilemaps & Collision logic
├── entities/       # ECS Framework, Components, and Logic Systems
├── ui/             # Dialogue Manager & UI Elements
└── game/           # Gameplay implementation entry point

📜 License

This project is licensed under the MIT License with a Beerware Clause.

Permission is hereby granted... use it for whatever you want. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return. Cheers! 🍻

Created by Mariano Hurtado de Mendoza Carranza (@d0t4.music on IG/YT)

About

Structured chaos for tired creators: a high-fidelity TypeScript RPG engine with modular systems, arcade soul, and neon-dream energy. <3

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors