Composition Over Configuration in Compass

The individual generators in compass (the arroyos and rivers, the caverns and meanders) are the fun part to show off, but they aren’t what makes the library usable. The part I’m actually proud of is the composition layer that sits on top, and it owes a lot to the runtime pipeline patterns I wrote about a while ago. Shapes times features Every room is described as a shape combined with a feature. There are 24 shapes: squares and circles, but also blobs, crystalline caverns, crescents, capsules, and a handful of hallway types. There are 18 features: pillars, islands, stepping stones, pools, moats, chasms, rubble, and four kinds of river. Any shape can pair with any feature, which is 432 distinct room configurations before you’ve placed a single one. A feature is just two functions: an initialize step that works out the geometry (the meandering river feature, for example, generates a sine-wave centerline and expands around it), and a content step that decides the terrain type for each tile inside the shape. Keeping those two responsibilities separate is what lets the same river feature drop into a square room or an L-shaped hallway without caring which it landed in. ...

October 13, 2024 · 3 min

Caverns, Automata and the Meander Revisited

Back in 2015 I tackled automata generated caverns for a 7DRL, and in 2018 I wrote up the meander algorithm for rivers. Both made it into compass and both got a little sharper along the way, so I wanted to revisit them with the actual implementations in hand. Caverns The cavern generator is Conway’s Game of Life pointed at a terrain problem. It’s almost embarrassing how little code it takes. Clone the map and randomly seed roughly 55% of it as floor. Run a single Game of Life pass over the Moore neighborhood (the 8 surrounding cells). An empty cell is born as floor with 5 or more floor neighbors, and an existing floor cell survives with 4 or more. clipOrphaned keeps only the largest connected blob so you don’t get a dozen disconnected pockets. Build walls around everything walkable and force the map border to wall so the cave is sealed. One pass is enough. The birth and survival thresholds are doing the smoothing that I used to iterate several times to get, and the result is the lumpy organic cave you’d expect. ...

June 9, 2024 · 2 min

Carving Terrain Like Water

A few years back I wrote a handful of posts about faking water on top-down maps: generating 2d rivers, cliffs, and an exhumed river channel. Those one-off experiments eventually grew into a proper map library I’ve been maintaining called compass. Revisiting them now is fun because real-world geology already solved the “make it look natural” problem ages ago. I just borrow the names and loosely approximate the process. Here are three of the fluvial generators and how they actually work. ...

February 18, 2024 · 3 min

Atomic Design System In Context

Brad Frost created a design system for thinking about developing for the web as a front-end specialist. Atomic Design System is essentially boiled down into 5 separate categories: Atoms (Elements) - These are the smallest functional elements of a page, such as text labels, buttons, inputs or other HTML elements that can’t further be broken down. Molecules (Components) - Simple compositions or groups of atoms that comprise a single unit. This may be an input box with a search button next to it and a label above it. Within Brad’s book he mentions these should follow the “S” in “SOLID” from Robert C. Martin’s Principles of Object Oriented Design which stands for Single Responsibility Principle. By this Brad implies that the molecule must only do one specific thing, not necessarily that it has only one reason to change. Brad refers to molecules near the end as “simple, functional, reusable components.” Organisms (Widgets) - Comprised of potentially multiple molecules or atoms and molecules in conjunction to form a cohesive purpose. Here Brad specifically refers to organisms as “components” numerous times as well. In comparison, these may be more sophisticated components compared to molecules. Templates - Templates are simply a collection of elements, components and widgets that when together build an entire page and lays it out without actual data. You can think of these as a Class in object oriented design. Pages - Pages are instanced Templates, or Templates with actual data. The actual benefit of the design system is in it’s name. Atomic Design System helps by putting an emphasis on breaking things down into their most atomic units and creating categories of complexity that are well-named to be able to refer to them. ...

August 15, 2023 · 3 min

Pihole On-top of UDM Pro

Here are some concise steps on how to step-by-step block ads on your network with pihole’s DNS-level ad blocker. Enabling SSH on UDM Pro Go to 192.168.1.1 or wherever you’re hosting your UDM Pro Within “settings” cog, click on “system” tab Click “enabled” on SSH near the bottom Leverage “change password” button if you don’t remember it Log Into SSH & Get Unifi-OS Scripts Open Terminal and ssh [email protected] -o HostKeyAlgorithms=+ssh-rsa Jump into Unifi shell with unifi-os shell Download package curl -L https://udm-boot.boostchicken.dev -o udm-boot.deb Install package dpkg -i udm-boot.deb Enable boot script with systemctl enable udm-boot Leave Unifi shell but stay within ssh with exit Create Network Within UDM Web GUI Create a pihole network with the following settings: ...

December 19, 2022 · 3 min

Announcing Credential Broker

tl;dr: The utility is open-source, you can download, contribute or learn more on github here. A credential broker service stores all sensitive information and has a command-line client which can act as a streaming pre-hook to initialize environment variables upon an application at runtime that does not store anything to disk. The broker service itself stores everything in encrypted format with the broker client having a key to unlock the data, provided the user is authenticated and has been authorized for the data requested. The server mimics an SSH authentication using Diffie-Hellman to establish encryption of traffic, performing a challenge to validate a user owns the private OpenPGP key to their account and a 2FA request at a configurable time period to ensure the user hasn’t been compromised. SSL should be configured on the server to help prevent man-in the middle. ...

April 7, 2021 · 3 min

Kepler452b Released

Kepler452b is available for Windows, Linux & MacOS. Enjoy a roguelike with one of 8 classes, 5 unique worlds, beautiful graphics by Oryx, music by Scott Buckley & Sergey Cheremisinov, 28 unique enemies, 101 supervisors to modify your gameplay, a story and much more! Whether you prefer to sneak around and backstab with the assassin, use a flamethrower as a pyrotechnic or grapple enemies to you and poison them, there’s bound to be a play style you will enjoy! ...

August 4, 2020 · 1 min

XMLHttpRequest Security

It’s possible to intercept, adjust and otherwise tamper with a XHR request with javascript in the browser. The most common way of doing this is simply making a pointer reference to the original XMLHttpRequest.prototype.send function, overwriting that function with a new one that does the tampering and then calls the original send function once finished. Here’s an example: const XHR = XMLHttpRequest, XHRopen = XHR.prototype.open; XHR.prototype.open = function() { onFinish(); XHRopen.apply(this, arguments); }; Identifying Tampering It’s very straight forward to identify tampering of the function. Simply ensure that the XMLHttpRequest.prototype.open.toString() === 'function send() { [native code] }'; evaluates to true. The function should always be native code if it wasn’t corrupted or tampered with. ...

June 2, 2020 · 2 min

Kepler452b Coming 2020

August 4th, 2020 Update: v1.0.0 Release Official release page is here. You can submit bugs or request features here. Downloads & Links Update, November 2026: the desktop downloads are retired. Kepler452b is being rebuilt to play in the browser at kepler452b.twinspear.com. Screenshots ...

December 3, 2019 · 2 min

Building a Modern Roguelike in 2019

At numerous times I’ve created demos trying to figure out how to merge a traditional roguelike into a FPS without sacrificing it’s roots. Here’s an article I made in 2017. Unlike many others I don’t feel like just random maps makes a roguelike, I’ve even gone so far as saying no FPS is a roguelike. In this experiment I’ve tried to merge those ascii characters into the map itself and dropped the textures. The code can be executed and ran or viewed in its entirety on Github here. ...

November 13, 2019 · 1 min