# Coding Conventions

**Analysis Date:** 2026-05-01

## Repository Nature

This is an **archival/preservation repository** for *Brand New Online* (BNO) — a 2008–2014 Game Maker 5.3a multiplayer game plus its abandoned 2014–2017 Unity port and a 2014–2016 Maya asset pipeline. There is **no active development**, no formal style guide, no linters, no formatters, and no editor configuration files. Source files reflect the conventions of their original authors at their respective points in time.

**No standard config files detected anywhere in the tree:**
- No `.editorconfig`, `.eslintrc*`, `.prettierrc*`, `.gitattributes`, `pyproject.toml`, `package.json`
- No `Makefile`, `Dockerfile`, `*.yml`, `*.yaml`
- No `.github/`, no `.gitlab-ci*`, no `azure-pipelines*`
- Only file at repo root besides directories: `.gitignore`

Conventions vary dramatically per subsystem. They are documented below as **observed**, not as **prescribed** — there is nothing to enforce.

## Subsystem 1: GameMaker Language (GML) Source — `legacy/source-archive/BNO/*.gml`

**Files in tree (extracted/loose):**
- `legacy/source-archive/BNO/mb_trise.gml`
- `legacy/source-archive/BNO/mb_tcollapse.gml`
- `legacy/source-archive/BNO/mb_rcollapse.gml`

(The vast majority of GML lives inside binary `.gmd` / `.gb1` / `.exe` files — see `decomp/wiki/03-gmd-format.md` and `decomp/wiki/15-extraction-pipeline.md` for the extraction pipeline. These three loose `.gml` files appear to be hand-extracted message-board scripts.)

**Naming patterns:**
- Script names use `snake_case` with a short namespace prefix: `mb_trise`, `mb_tcollapse`, `mb_rcollapse` (`mb_` = "message board"; `t` = topic, `r` = reply; verb after).
- Globals use dotted/bracketed access: `global.mb_total[1]`, `global.mb_topic[argument0,0]`, `global.mb_reply[argument0,mb]`.
- Local working variables are short and untyped: `mb`, `rq`, `f_topic[]`, `f_reply[]`.
- Script arguments are positional and untyped: `argument0`, `argument1` (GM 5.x has no named args).

**File header convention:**
```
#define <script_name>
//<one-line description>
//argument0 - <description>
//argument1 - <description>
```
Every script begins with `#define` matching the filename, followed by C-style `//` comment header documenting purpose and each argument. This is the only documentation discipline observed.

**Style:**
- Tabs/indentation: **none consistently applied** — bodies of `if` and `for` blocks are flush-left rather than indented (verified across all three `.gml` files).
- Brace style: K&R-ish (`{` on its own line after `if`/`for`).
- Statement terminators: semicolons present on most lines; some lines (e.g., inner-loop assignments in `mb_trise.gml` line 14) are missing terminating `;` — GM 5.x parser is lenient about this.
- Loop idiom: `for(mb = 0; mb < N; mb += 1)` (uses `+= 1` rather than `++`; `++` is not valid in GM 5.x — see `decomp/wiki/06-gml-syntax-5x.md`).
- One blank line between logical blocks; double blank lines between major sections.

**See also:** `decomp/wiki/06-gml-syntax-5x.md` for GM 5.x language quirks (no `++`/`--`, no `&&`/`||` short-circuit semantics, etc.) that constrain what idioms are even possible.

## Subsystem 2: Unity C# Scripts — `legacy/unity-project/Assets/**/*.cs`

**Files (11 total `.cs`):**
- `legacy/unity-project/Assets/_Scripts/SectorTrigger.cs`
- `legacy/unity-project/Assets/_Scripts/ShaderManager.cs`
- `legacy/unity-project/Assets/_Scripts/ShaderHeightControl.cs`
- `legacy/unity-project/Assets/_Scripts/SideTextureRotationTest.cs`
- `legacy/unity-project/Assets/_Scripts/TextureAnimator.cs`
- `legacy/unity-project/Assets/_Scripts/Networking/NetMenu.cs`
- `legacy/unity-project/Assets/_Scripts/Networking/SerializePlayer.cs`
- `legacy/unity-project/Assets/Editor/TileManager.cs`
- `legacy/unity-project/Assets/Player/Scripts/CameraClass.cs`
- `legacy/unity-project/Assets/Platforms/_Platform Scripts/ConveyorTile.cs`

**Unity version:** 5.3.4f1 (per `legacy/unity-project/ProjectSettings/ProjectVersion.txt`).

**Indentation:** Tabs (verified). 4-column visual width.

**Brace style:** Allman (opening brace on its own line) for class/method declarations:
```csharp
public class PlayerControl : MonoBehaviour
{
    void Start ()
    {
```
Some single-statement `if`/`else` bodies omit braces entirely (e.g., `PlayerControl.cs` lines 48-58, `NetMenu.cs` lines 38-42). Mixed; not consistent file-to-file.

**Naming:**
- Classes / public methods: `PascalCase` (`PlayerControl`, `NetMenu`, `OnConnectedToServer`, `ToggleShaders`).
- Public fields: `camelCase` (`gameCam`, `connectionIP`, `portNumber`, `pName`, `_force`, `_speed`).
- Private fields: `camelCase` with occasional `snake_case` for grouped state (`run_doubleTapInterval`, `run_tapTime`, `run_toggle`).
- Constants: `SCREAMING_SNAKE_CASE` declared as `private const float WALKSPEED = 3.0f, RUNSPEED = 7.0f, STEPHEIGHT = 0.25f, PHEIGHT = 2f;` (multiple per declaration line — see `PlayerControl.cs:18`).
- Editor-only flags: `SCREAMING_SNAKE_CASE` static fields (`DEBUG_MSGS`, `REP_PREFAB_NAMES` — see `TileManager.cs:9-15`).
- Underscore-prefixed public fields seen in newer files (`ConveyorTile.cs:6-7`: `_force`, `_speed`) — Unity inspector serialization convention.
- Boolean/flag locals frequently `UPPERCASE` single-words (`LEFT, RIGHT, UP, DOWN` — `PlayerControl.cs:10`).

**Using directives:**
Standard order: `UnityEngine` first, conditional `UnityEditor` wrapped in `#if UNITY_EDITOR`, then `System.Collections`, then other `System.*` / `UnityEngine.*` namespaces:
```csharp
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
using System.Collections;
```
Newer files add `using UnityEngine.Networking;` (`SerializePlayer.cs:3` — UNET era).

**Comments:**
- `// Use this for initialization` and `// Update is called once per frame` boilerplate left in from Unity's default MonoBehaviour template (almost every script — `PlayerControl.cs:30,40`, `SectorTrigger.cs:7,14`, `ShaderManager.cs`, `TextureAnimator.cs:25,40`).
- Inline commentary frequent and informal — explanations of math/intent (e.g., `TextureAnimator.cs:101-105` walks through floor-vs-round reasoning).
- Commented-out dead code is **not removed** (`PlayerControl.cs:35,68`, `SerializePlayer.cs:8-9,16,26-28`, `NetMenu.cs:35-36`).
- No XML doc comments (`///`) anywhere.

**Attributes:**
- `[ExecuteInEditMode]` on shader/animation managers (`ShaderManager.cs:7`, `TextureAnimator.cs:7`, `TileManager.cs:5`).
- `[RequireComponent(typeof(...))]` on player (`PlayerControl.cs:5`).
- `[MenuItem("[Custom]/...")]` for editor tooling (`TileManager.cs:36`).

**Architecture notes:**
- One MonoBehaviour per file; filename = class name.
- Heavy reliance on public fields for inspector exposure (no `[SerializeField] private`).
- Stringly-typed component lookups: `(CharacterController)gameObject.GetComponent("CharacterController")` (`PlayerControl.cs:33`) — type-string variant rather than generic `GetComponent<T>()`.
- Magic strings for input axes: `Input.GetButton("Run/Walk")`, `Input.GetButton("Chat")` (`PlayerControl.cs:46,66`).

**Notable artifact:** `legacy/unity-project/Assets/_Scripts/NuBNO np++ Session` is an **empty Notepad++ session file directory** (no `.cs` content) — evidence of the abandoned editor session that ended dev in May 2017.

**Project files:** Multiple `Assembly-CSharp*.csproj` and `.sln` files in `legacy/unity-project/`, many with `(BNO Successor's conflicted copy YYYY-MM-DD).csproj` suffixes — Dropbox sync conflict residue, never cleaned up.

## Subsystem 3: ShaderLab — `legacy/unity-project/Assets/_Shaders/*.shader`

**Files (7):** `HeightColor.shader`, `HeightPlayer.shader`, `HeightTest.shader`, `Outline.shader`, `UnlitAlphaWithFade.shader`, `deepTile_glass_custom.shader`, `testShader.shader`.

**Naming:** Mixed `PascalCase` and `camelCase_snake_descriptor` (`HeightColor` vs `deepTile_glass_custom` vs `testShader`). Shader internal name uses path notation: `Shader "Custom/HeightColor"` (`HeightColor.shader:1`).

**Style:** Standard ShaderLab — tab indented, K&R braces. Custom lighting model `LightingNoLighting` defined inline inside CGPROGRAM block. `uniform`s declared with default-initializer (`uniform int _ApplyShader = 0;` — `HeightColor.shader:32`). Commented-out experimental lines (`//Ztest Always`, `//uniform float3 _CamVec;`) preserved.

## Subsystem 4: Maya / MEL — `legacy/maya-project/`

**File:** `legacy/maya-project/workspace.mel` (Maya 2015 project definition).

This is auto-generated by Maya; it is a flat list of `workspace -fr "<key>" "<path>";` directives — not hand-authored. No conventions to derive.

**Other Maya assets:** `legacy/maya-project/scenes/`, `images/`, `sourceimages/` — binary `.ma`/`.mb` scenes and images, not analyzable as source. The `scenes/export_to_unity/` subdirectory is the documented hand-off pipeline to the Unity port (per `legacy/README.md:104-105`).

## Subsystem 5: Server Files — `legacy/servers/**`, `legacy/open-source-release/**`

These directories contain **compiled binaries only** (`.exe`, `.dll`, `.gmd`, `.gb1`) plus runtime data files (`.bno`, `.bnb`, `.txt`, `MB_News`, `UserData/`). No source code is present at the source level — all GML logic is embedded in `.gmd` payloads appended to GameMaker's Delphi runner stub. To inspect source, run the extraction pipeline documented in `decomp/wiki/15-extraction-pipeline.md`.

**Plain-text admin/config files** (`legacy/open-source-release/,ServerCommands.txt`, `Ctrl+O Codes.txt`, `localList.txt`, `remoteList.txt`, `Settings.bno`, `MSettings.bno`) appear to use ad-hoc line-oriented formats — no standard parser, no schema.

**Filenames** routinely contain spaces, parentheses, version suffixes (`5-4a`, `5-2 DEBUG`, `5-6 TSide Revamp`), comma-prefixed sort hacks (`,ServerCommands.txt`, `,2021_Note_About_Sources.txt` — leading comma sorts to top in Windows Explorer), and long-form descriptive names. Versioning is **filename-based**, not VCS-based (per `legacy/README.md:109`).

## Subsystem 6: Documentation — `decomp/wiki/`, `legacy/README.md`

**Markdown files:**
- `decomp/GameMaker 5.3a Reverse Engineering Pipeline.md` (long-form research report)
- `decomp/wiki/00-overview.md` … `16-bno-bnb-notes.md` plus `README.md`, `glossary.md`, `quick-reference.md`
- `legacy/README.md`

**Conventions observed in `decomp/wiki/`:**
- Numeric `NN-kebab-case-topic.md` naming with zero-padded prefixes for ordering (`00-overview.md` through `16-bno-bnb-notes.md`).
- README.md serves as a task-based jump table (per `decomp/wiki/README.md:5-19`).
- Heavy use of inline code spans for filenames, paths, and identifiers.
- Tables for at-a-glance reference (task → file lookup, version history).
- Backlinks to source files use relative paths (`../GameMaker 5.3a Reverse Engineering Pipeline.md`).

**`legacy/README.md` conventions:**
- ATX-style headers (`#`, `##`).
- Tabular provenance ("what came from where") and version history.
- Verbatim block-quotes for original creator notes.
- Path examples in fenced code blocks (no language tag).

## Cross-Cutting Observations

**Encoding / line endings:** Not enforced (no `.gitattributes`, no `.editorconfig`). Unity-generated `.meta` files and Windows-origin source files likely contain CRLF; markdown likely LF. Mixing not actively managed.

**Internationalization:** None. All strings are English; some assets (Master 5-2J / Client 5-2J) carry a `J` suffix that may indicate a Japanese-targeted variant — meaning unverified.

**Comments-as-history:** Across both GML and C#, the dominant documentation pattern is informal inline `//` commentary explaining intent at the point of code, plus occasional commented-out experimental code left in place. Treat code comments as the primary specification.

**Authorial voice:** Single-developer project throughout its life. No code review artifacts, no PR conventions, no commit-message style (no git history exists per `legacy/README.md:109`).

---

*Convention analysis: 2026-05-01*
