Skip to content

Instantly share code, notes, and snippets.

@Zarkonnen
Zarkonnen / catenary.cs
Created May 13, 2026 06:18
Catenary calculation functions in c#
// Function to calculate y-value of catenary curve at a particular x-value.
public static float CatenaryY(Vector2 start, Vector2 end, float length, float x) {
float h = end.X - start.X;
float v = end.Y - start.Y;
float a = FindA(h, v, length);
float p = (start.X + end.X - a * MathF.Log((length + v) / (length - v))) / 2;
float q = (start.Y + end.Y - length * (1 / MathF.Tanh(h / (2 * a)))) / 2;
return a * MathF.Cosh((x - p) / a) + q;
}
@Zarkonnen
Zarkonnen / spygame.md
Created May 6, 2026 15:26
Speculative design for a poker-like spy mechanic for A:CtS

Note that there is currently no plan to implement this, because it would be a lot of work on a minor game feature.

The spy game would replace the currently existing espionage system in A:CtS. The game is inspired by poker but isn't poker. During the spy game, normal world time is paused. The rest of the game is still accessible as always.

Setup

The spy game is played once every 1-2 years for groups of 2-6 players. The groups are chosen to be empires that are more involved with each other: adjacent, with diplomatic relations other than peace. A group size of 4-5 is preferred. If possible, human players are all put into the same game along with at least one non-human player.

Each player has an ante, a board, and a hand.

  • The ante contains the things that they are wagering on the game. It's visible to everyone.
  • The board are the cards they have played. By default, only the number of cards is visible.
@Zarkonnen
Zarkonnen / devnotes.md
Last active February 25, 2026 14:12
Airships Conquer The Skies Dev Notes

Installation

See readme in repo.

Overall Structure

  • Old-fashioned Java program using Java 7
  • Uses counter-based for loops in performance critical places because "for (x : y" style loops allocate garbage on the heap.
  • Relatively few dependencies, simple compilation
  • Gotcha Some of the tool python scripts for deployment have hardcoded paths that expect a specific file system structure, but you shouldn't need to deploy anything.
  • Data format is JSON.
  • In some places (game saves) a binary version of JSON is used instead, see JSONObject:1658.
@Zarkonnen
Zarkonnen / lostflotillamodding.md
Last active February 12, 2025 08:56
WIP Lost Flotilla Modding Documentation
7.1.2024 08:29:53 [Notification] Server logger started.
7.1.2024 08:29:53 [Notification] Game Version: v1.19.0-rc.6 (Unstable)
7.1.2024 08:29:53 [Event] Launching server...
7.1.2024 08:29:53 [Event] Server v1.19.0-rc.6, network v1.19.3, api v1.19.0
7.1.2024 08:29:53 [Notification] Entering runphase Initialization
7.1.2024 08:29:53 [Event] Loading configuration...
7.1.2024 08:29:53 [Notification] Entering runphase Configuration
7.1.2024 08:29:53 [Notification] Loading savegame
7.1.2024 08:29:53 [Notification] Loaded existing save game data. Playstyle: wildernesssurvival, Playstyle Lang code: preset-wildernesssurvival, WorldType: preset-wildernesssurvival
7.1.2024 08:29:53 [Notification] Savegame /home/zar/.config/VintagestoryData/Saves/peaceful village story rc.vcdbs loaded
7.1.2024 08:14:39 [Notification] Client logger started.
7.1.2024 08:14:39 [Notification] Game Version: v1.19.0-rc.6 (Unstable)
7.1.2024 08:14:40 [Notification] OpenAL Initialized. Available Mono/Stereo Sources: 255/1
7.1.2024 08:14:40 [Notification] Process path: /home/zar/ApplicationData/vintagestory/Vintagestory
7.1.2024 08:14:40 [Notification] Operating System: Linux (Linux Mint 21.1) [Kernel 5.15.0.88]
7.1.2024 08:14:40 [Notification] CPU Cores: 12
7.1.2024 08:14:40 [Notification] Available RAM: 15826 MB
7.1.2024 08:14:40 [Notification] Graphics Card Vendor: NVIDIA Corporation
7.1.2024 08:14:40 [Notification] Graphics Card Version: 3.3.0 NVIDIA 535.129.03
7.1.2024 08:14:40 [Notification] Graphics Card Renderer: NVIDIA GeForce RTX 2080 Super with Max-Q Design/PCIe/SSE2
@Zarkonnen
Zarkonnen / heromodding.md
Last active August 8, 2023 07:53
Hero Modding Documentation

The heroes introduced in the Heroes & Villains DLC can be modded, changing them or adding new ones.

You can download a simple example mod here, for you to study and modify. You can also look at the already existing heroes in data/crossplay/heroes/HeroType. You can probably figure things out just from that.

The rest of this post attempts to document everything exhaustively, so don't feel that you have to have read all of it to start modding heroes! Reading "Basic Hero Structure" and "Recruit Hooks" and then whatever you think you need should be enough to start.

You can find detailed documentation on how modding works here, but here's the short version: A mod is a folder containing an info.json file, a logo.png file, and a bunch of folders containing JSON files with the same structure as the data folder in the game. You will also need a strings/en.properties file for the text in your mod, and

@Zarkonnen
Zarkonnen / special_eras.md
Last active March 20, 2023 00:08
How to mod in new special eras

Special eras are one of the features that I introduced in the co-op and conquest update in August. These work by temporarily changing the rules of the game, and may also have a victory condition, where an empire can be rewarded for ending the era early.

Like pretty much everything in the game, these are data-driven, so you can add new ones by modding. Here's how.

(This post assumes that you know how Airships mods work. If you want an introduction to basic modding, check out this article first.)

Play in Airships progresses through a series of eras, which slowly change the game balance, decreasing the unrest from empire size, and increasing base research and the number of spies available. Each era has a chance to be a randomly chosen special era, which accumulates over time, so that while not every era is special, you will definitely get some special ones. You can see this information in

EMPIRE STATS EXPLANATION

These are per-empire values that are modified by an empire's bonuses. You can give an empire bonuses through heraldic charges, technology, city upgrades, special eras, monster nest rewards and expedition rewards.

This document is best read together with Airships Install Folder/data/EmpireStat/stats.json so you can see the concrete values used.

Calculations and Notes

Time

Time: 1 day = 400 milliseconds

@Zarkonnen
Zarkonnen / all-loadables.java
Last active May 5, 2022 09:26
Moddable data loading code from Airships
// Dump of the data loading code for the game for modders to pick apart.
// Code is for version 1.0.23.10
// See also:
// http://zarkonnen.com/airships/modding_guide
// http://zarkonnen.com/airships/modding_guide/crew_animation
// http://zarkonnen.com/airships/modding_guide/bonusable_values
// Documentation on what the weather/landscape stuff will look like after the landscape update
// https://gist.github.com/Zarkonnen/bf56b5c72b203767cac8ddc264781fc3
// Appearances are used all over the place