Skip to content

A browser-based RPG written in Typescript that runs as a native computer app.

Notifications You must be signed in to change notification settings

stickyfingies/grove

Repository files navigation

The Grove

Play Online | Docs

This game is my longest-ever hobby project. Concieved way back in 2017 as a Skyrim-like browser RPG, the game is now a tech sandbox for trying new web technologies and applying them in a game context.

I encourage you to explore the Software Architecture, and then familiarize yourself with the Technologies used. The Instructions can help you build the game on your PC.

This document is a config file. Links annotated with ⚙️ will affect system behavior based on their text.

Software Architecture

  • ECS: All game objects ("entities") and their behaviors are logically represented using the ECS paradigm. Yeah, the game runs on Javascript and the performance benefits of this are negligable. On the flip side, building this system has taught me a lot about cache locality and some of the architectural benefits of composition-over-inheritance.
  • Graphics: This game uses Three.js to both order game objects into a heirarchical scene graph (main thread), and then draw those objects (render thread). Every frame, the main thread computes individual object transforms, and communicates them to the render thread using shared memory, which uses WebGL to draw the objects.
  • Physics: Similarly to the renderer, a WASM copy of the Bullet physics engine sits on its own thread and churns out object transforms to the main thread using shared memory. All memory is write-once read-many, so data races shouldn't (!!!) occur. I really don't know if offloading major systems like this increases performance by any considerable margin; but again, it was fun for a learning excersize.
  • Engine: This package wraps together the ECS world, graphics sub-engine, and physics sub-engine, and gets them all talking to eachother. It also includes utilities for logging, asset loading (glTF), scene setup, and more.
  • Grove: This is where all the actualy game code lives. Every entity behavior is represented as a GameScript, and so we can use GameScripts to decide what actually happens in the sumulation. There are GameScripts for the player, for the camera, for enemies and health bars, and basically everything which exists in the world.

Technologies

Click any of the fancy badges to open that technology's website.

Website Description Install
Node.js "Cross-platform JavaScript runtime environment."
Yarn "A package manager that doubles as project manager."
TypeScript "TypeScript is JavaScript with syntax for types."
Three.js Spatial math and 3D rendering on the GPU via WebGL.
Vite A build tool that powerfully combines all our source files.
Electron "Enables web developers to make desktop applications."

Instructions

Note This section requires a basic familiarity with computer terminal emulator programs, like cmd.exe on Windows.

(1) — Prerequisites

All of the development tools use a JavaScript engine called Node, and its package manager, npm. Together, these tools allow developers to organize, test, and distribute their software projects.

  1. Install Node.js from the website.

My code uses Yarn, an alternative package manager with cool features for managing large projects. The following command will enable Yarn on your machine.

$ corepack enable  # gain access to Yarn

To demonstrate the power of these package managers, we can install all the rest of the software tools you'll use with one fell swoop:

$ yarn install     # install *literally* everything else

(2) — Running / Editing the Game

Running the following command starts the game in development mode.

$ yarn dev  # launch Vite dev server and serve electron app

The game's source code files are found in grove/src/game/, and you can change them to see the game update in real-time.

The Grove uses the Vite build tool, which supports hot module reloading. This means any changes you make to the code will automatically transfer to the electron app - no refresh required.


(3) — Building

Run the following command to bundle the entire game up into a package. The resulting binaries + distributables will go in the game/⚙️ directory.

$ yarn build    # bundle source files

License

  • The Grove is copyright 2022 by Hybrid Alpaca Game Studios. All images¹, story, and game are copyright of Hybrid Alapca Game Studios. Copying or redistributing this game or content without the consent of Hybrid Alpaca Game Studios is illegal and unlawful.

  • ¹ Most images are not owned by Hybrid Alpaca Game Studios.

Credits

3D Models

KayKit : Adventurers Character Pack (1.0)
Created/distributed by Kay Lousberg (www.kaylousberg.com)
Creation date: 15/07/2023 09:00

People

  • Seth Traman: Lead Developer, CEO Hybrid Alapca Game Studios
  • Nate Goldsborough: Developer, Marketing, General Maintenance, CEO Artifex Inc.
  • Casimir Kash: Developer, Graphics, Beta Testing
  • Hunter Sokolis: Developer, Graphics, Humor Support
  • Gavin Montheye: PR
  • KJ Avakian: Developer
  • Jasper Burns: Storyline
  • William VanDerLaan: Beta Testing, Logos