Nick Chavez

Extending Metal-cpp to Other Apple Frameworks

Source Code on GitHub Back for the release of iOS 15, Apple released Metal-cpp, a C++ binding primarly for the Metal framework, but also for some select symbols in Foundation and QuartzCore frequently used in conjunction with Metal. Thus, instead of writing the following non-ARC Obj-C: - (void)gameLoop { @autoreleasepool { MTLTextureDescriptor *textureDesc = [[[MTLTextureDescriptor alloc] init] autorelease]; textureDesc.pixelFormat = MTLPixelFormatRGBA8Unorm_sRGB; NSLog(@"width: %d", textureDesc.width); } } you can write the following C++:...

AppleGfxBase

Source Code on GitHub Platform Shell One of the first things that ends up being written for a game is all the shell and platform logic: bringing up a window, routing input, constructing the game loop, starting threads, and setting up the graphics API. Since this code tends to be boilerplate-y and game developers tend to target multiple platforms, this is usually delegated to or abstracted away by libraries like SDL and GLFW....

Compiling Metal Shaders

Source Code on GitHub If you’re using Xcode for managing your iOS/tvOS/macOS project, compiling Metal source code into shader libraries and bundling them into your app is taken care of by the IDE (mostly) automatically. However, when doing cross-platform development and Apple platforms are merely one of many possible targets, build generators or systems like Bazel or CMake are much more attractive – especially since you can generate Xcode projects when you really need to anyway, for debugging (natively with CMake and using Tulsi with Bazel)....

Blue Marble Explorer

Source Code on GitHub Overview I built an exploration simulation game, where you travel over the Earth’s seas, discovering cities across continents, islands, and coasts. For the game logic and graphics, I used C++14, Panda3D, GLSL, and Compute Shaders. For the visual assets, I used NASA’s Visible Earth satellite imagery, GEBCO’s bathymetry data, and a modded Cannon Boat from Mario Party 64. My inspiration for this project came off the heels of my last project, which rendered terrain for a strategy game....

Hex Strategy Map: Design

< High Level Approach For a while now, I’ve been interested in figuring out how the gorgeous maps in Civilization 6 are put together and rendered: “Indian Subcontinent” Civ 6 Map Mod As you can see, the map is based on a hex-grid, which is most apparent when inspecting city borders, river intersections, and feature placement. However, it strikes a good balance between being readable game UI and natural looking terrain....

Hex Strategy Map: Render

Continuing where part 1 left off, this article discusses the implementation of the scene’s rendering effects. The high level overview is best described as a pipeline, since most rendering stages depend upon completion of the previous stage: Note the sections in orange, which are the rendering stages running on the GPU (in compute shaders), which need to run in strict order since there are resource dependencies between them (texture and vertex data)....

Procedural Planet Generation

I’ve experimented before with procgen with standard rectangular heightmaps, but was interested in applying the concept to a sphere, like a planet. The advantages of using a spherical representation are: Eliminating distortions due to rectangular projections (e.g. Mercator) Sure, at the end of the day it’s viewed on a rectangular screen, but think of the view as Google Earth rather than Google Maps. This also makes game logic like pathfinding for shipping lanes and flights more realistic, as great circles are chosen that may go through the Arctic....

Client-side Prediction Multiplayer

I recently read two excellent and fascinating articles on client-server architectures for multiplayer games by Yahn W. Bernier and Gabriel Gambetta. I was also simultaneously learning how to use Godot/GDScript, and had a cool idea for a co-op racing game, where teams of 2 players compete, one driving, and one shooting, attacking the other vehicle. I pounced on the opportunity and implemented: Client-side Prediction Server Reconciliation Entity Interpolation This protects the game integrity from cheating players, but still allows for non-cheating players to get instant feedback on their inputs, and smooth (but delayed) visuals for other players’ inputs....

Jukeboxx iOS V3

An iOS app for streaming and downloading your own self-hosted music library! This is the iOS companion to the Jukeboxx Web App and the successor to Jukeboxx iOS V2. Jukeboxx iOS V3 The same backend used in the Jukeboxx Web App is used here, mostly Backblaze – a robust and low-cost cloud storage provider – for hosting a streamable copy of your music collection. See the Motivation section for details on backend architecture and motivation, which is generally the same as the web app’s....

Jukeboxx Web

A self-hosted web player for your own music library! Sync your music to cloud storage and stream it from any browser. Live Demo ↗ Username: friend@demo.com Password: password All songs in the demo are actually just Siesta from the Free Music Archive. Jukeboxx Web V3 A revamped version of Jukeboxx Web V1 that uses Backblaze – a robust and low-cost cloud storage provider – for hosting a streamable copy of your music collection....