Shelves, Checkstands, and Game Engines, oh my!
It’s taken a bit longer than planned to get around to writing this blog post. Fret not, because I’ve spent a good chunk of time expanding the set of shelf archetypes and building a new game engine for Grocery Game’s foundation.
If you’d like to play the game:
Subscribers of $5 or more on Patreon and other donors will also receive access to an Alpha version of the game.
New Shelf Types and Checkstands
I’ve expanded the game’s procedural generation primitives to generate:
- New Shelf Archetypes
- Refrigerators
- End Cap displays
- Checkstands
Already these few shelf types add better visual variety to the game, which was lacking given just the wooden shelves.
Game Engines
Though raylib has served me well so far, I’ve hit a wall using its simple, albeit limited, abstraction. For example, I spent more time than I’d have liked trying to integrate the ambient shader I teased in the last post.
Considerations
Requirements
-
Continue to use D lang
I still feel very productive with the D language and don’t think I’ll stray again, despite my inclination to experiment in yet more languages.
-
Use a modern graphics stack
-
Use GLFW for window management
Raylib uses this library under-the-hood. Given Grocery Game’s HTML UI and the CSS cursor property, the UI should change the window’s cursor. However, Raylib didn’t support that until I contributed a pull request.
WebGPU
As an unabashed bleeding-edge apologist, I first investigated wgpu-native, even going so far as to write an idiomatic D wrapper for the library.
wgpu-native is a Rust implementation of the up-and-coming WebGPU specification web platform standard with a bright future. Mozilla and Google are developing an interoperable C header for their different implementations, wgpu and Dawn. wgpu is built on gfx-rs, a graphics-backend-agnostic library supporting Vulkan.
However, wgpu is still a bit too green at the moment. For example, I encountered issues setting up a swap chain.
Vulkan
Eventually, in an effort to KISS the problem away, I decided just to use Vulkan directly given its solidly widening support.[3]
Introducing Teraflop
Teraflop is a new[1] game engine being developed in tandem with Grocery Game.
Features
- ECS
- Built-in Game Loop
- Multiple Windows
Teraflop’s ECS implementation inspired by Bevy ECS and entt.
Implementing Teraflop
Vulkan has a notoriously steep learning curve. It took days of work following the Vulkan Tutorial[4] implementing primitives with the ErupteD library to get a triangle rendered.
Time-to-Triangle: The time required to code graphical systems at a level the hardware’s capable of, essentially analogous to how long it takes to create the base for games that match the hardware’s graphical power.
Mark Cerny, PS4 Lead Architect. Engadget, Cerny: PS4’s ‘time-to-triangle’ to rival PS1
Eventually, there were fruits of my labor:
Next Steps
- Switch to the gfx D library, which implements a fuller Vulkan abstraction
- Re-Integrate Ultralight
- Back port the existing store floor space system, i.e. walls, doors, shelves, and checkstands
- Get back to fleshing out more game systems, starting with shoppers
Citations
- 1: Chance Snow, Teraflop’s original C# implementation
- 2: Apple, macOS Mojave 10.14 Release Notes, Open GL and Open CL Deprecations
- 3: Sascha Willems, Vulkan Hardware Database
- 4: Alexander Overvoorde, Vulkan Tutorial
Alpha Access
Subscribers of $5 or more on Patreon and other donors will receive access to an Alpha version of the game for play testing.
Feedback
What would you like to see in the game? Let me know your thoughts and suggestions!