Grocery Game

A grocery store simulation game

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.

Patreon PayPal Logo

New Shelf Types and Checkstands

I’ve expanded the game’s procedural generation primitives to generate:

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

  1. 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.

  2. Use a modern graphics stack

    OpenGL is dead[2]; long live Vulkan!

  3. 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:

Screenshot of Teraflop engine rendering a triangle

Next Steps

  1. Switch to the gfx D library, which implements a fuller Vulkan abstraction
  2. Re-Integrate Ultralight
  3. Back port the existing store floor space system, i.e. walls, doors, shelves, and checkstands
  4. Get back to fleshing out more game systems, starting with shoppers

Citations

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.

Patreon PayPal Logo

Feedback

What would you like to see in the game? Let me know your thoughts and suggestions!

Written on November 22, 2020