All contributions

OpenRA/OpenRA

OpenRA

An open source real-time strategy engine for classic Westwood games such as Command & Conquer: Red Alert, written in C# with SDL and OpenGL.

Language
C#
GitHub stars
17,827
Merged changes
1
Project site
openra.net

What we changed

The map editor keeps the order in which players are defined, so after generating a map, pasting and undoing it saves Multi0 before Multi1.

What this work shows

  • .NET collections: OrderedDictionary
  • Saving maps to MiniYaml
  • A game engine map editor
  • NUnit tests
What was broken

Multi1 saved before Multi0

MapPlayers kept players in a plain Dictionary. When spawn points change, the editor removes and re-adds the players, so after generating a map, pasting or undoing, the map file got Multi1 before Multi0.

How we fixed it

An OrderedDictionary for map players

MapPlayers.Players is now an OrderedDictionary, which keeps insertion order, and the player sync loop in EditorActorLayer iterates over a copy of the list. A new test removes and re-adds players, and in the Red Alert editor we checked generating, spawn points, undo, copy-paste and reloading the map.

#22627

Merged change 1

  1. #22627 Preserve player definition order in MapPlayers Merged 11 October 2026

What it taught us

A plain dictionary does not promise any order and can change it after items are removed and added back. When the order ends up in a file, it takes a structure that keeps it, and we check a game change by hand in the editor too, not only with a test.

More about this technology: C# and .NET

Other projects we write code for

Describe your project.

A free quote comes back within an hour during working hours.