Unity, Godot, or my own engine... Note

Unity, Godot, or my own engine? Why my card games are plain TypeScript" published: false tags: gamedev, reactnative, typescript, showdev

The author decided to build a card game app, Decks, by creating a custom engine rather than using a pre-made game engine like Unity or Godot. This approach was chosen because the goal was to host many card games on a single platform, achieved by defining games as JSON documents interpreted by a central engine. A prototype in Godot proved too heavy and slow, and the author found that card game rendering is fundamentally simple and doesn't require a complex 3D engine. The core of the project, the game rules, needed to be easily testable and independent of the rendering system.The chosen stack consists of a pure TypeScript game-core package, design tokens, and a mobile app built with Expo, React Native, and React Native Skia. A key advantage is the zero-dependency game-core, allowing it to run in both Node.js and on mobile devices, facilitating extensive testing and reproducible bug fixes through seeds. Rules are defined as data, enabling flexibility and supporting features like hints and AI bots without relying on eval. The use of TypeScript across the entire project streamlines development and testing.Native UI elements handled by React Native provide accessibility and responsiveness, while the card table itself is rendered using Skia. Card faces are dynamically generated, contributing to a small app size. However, building a custom engine comes with significant costs, including the responsibility for hit testing, frame rate optimization, and managing native dependencies. Generality in the rule language can also lead to verbose data definitions. Despite the challenges, especially in handling touch gestures and performance, the author found the custom engine approach ultimately rewarding for its flexibility and extensibility. The plan moving forward includes adding two-player games and more solitaire variations.