Menu

1 / 2

Why I Built a High-Performance 2D/2.5D Engine in TypeScript (and Why I Ditched OOP)

DEV Community·Misha Mitiev·6 months ago
#klaPjrfz
#gamedev#performance#showdev#typescript#loom
Reading 0:00
15s threshold

Hi everyone! 👋

I’m Misha Mitiev, a solo developer. I’ve spent the last several months in the trenches of browser performance, and I joined this community to share the progress of Loom Engine (v1.7.6).

Loom is a 2D/2.5D game engine built from scratch in TypeScript. It was born out of a specific need: I needed a deterministic, browser-first simulation engine to power TheWorldTable.ai.

I quickly realized that traditional Object-Oriented Programming (OOP) in JavaScript wasn't going to cut it for the scale I wanted. Here is a look at the architecture choices that make Loom Engine tick.

The Architecture: ECS + SoA

Most engines use "Game Objects." Loom uses an Entity Component System (ECS) with a Structure-of-Arrays (SoA) memory layout.

If you aren't familiar with the term, instead of having an array of "Player" objects, Loom stores data in flat TypedArrays.

The Problem: Traditional objects are scattered across the heap, making the CPU work harder to find them (Cache Misses).

The Loom Solution: By using…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.