---
title: "OpenRA: player order in the map editor in C# | VulCode"
description: "A fix to OpenRA, the real-time strategy engine in C#: the map editor keeps the order of map players after generating a map, pasting and undoing changes."
url: "https://vulcode.com/en/opensource/contributions/openra"
lang: "en"
---

[All contributions](https://vulcode.com/en/opensource/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.

[See the repository](https://github.com/OpenRA/OpenRA) [All contributions](https://vulcode.com/en/opensource/contributions)

- **Language**: C#
- **GitHub stars**: 17,827
- **Merged changes**: 1
- **Project site**: [openra.net](https://www.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](https://github.com/OpenRA/OpenRA/pull/22627)

## Merged change 1

- [#22627 Preserve player definition order in MapPlayers Merged 11 October 2026](https://github.com/OpenRA/OpenRA/pull/22627)

## 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](https://vulcode.com/en/technologies/csharp-and-dotnet)

## Other projects we write code for

- [**ILSpy** C# · 27,138 stars An open source .NET decompiler that turns compiled assemblies back into readable C# code. It is used to inspect libraries whose source code is not at hand.](https://vulcode.com/en/opensource/contributions/ilspy)

- [**Polly** C# · 14,255 stars A .NET library for handling transient faults: retries, circuit breakers, timeouts and fallback. Its Simmy module injects faults on purpose to test how an application copes with them.](https://vulcode.com/en/opensource/contributions/polly)

- [**FluentValidation** C# · 9,780 stars A popular .NET library for writing strongly typed validation rules in a fluent style, such as RuleFor(...).InclusiveBetween(...).](https://vulcode.com/en/opensource/contributions/fluentvalidation)

- [**Serilog** C# · 8,064 stars A structured logging library for .NET. It records events from message templates, with named properties rather than plain text.](https://vulcode.com/en/opensource/contributions/serilog)

- [**NLog** C# · 6,547 stars A flexible structured logging library for many .NET platforms, configured through layouts, filters and targets.](https://vulcode.com/en/opensource/contributions/nlog)

- [**Markdig** C# · 5,359 stars A fast CommonMark-compliant Markdown processor for .NET, with extensions such as tables, definition lists and automatic heading identifiers.](https://vulcode.com/en/opensource/contributions/markdig)

## Describe your project.

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

### Rather skip the form?

Ask in the chat or write to us directly.

Open the chat

- **Email**: [hello@vulcode.com](mailto:hello@vulcode.com)
- **Phone**: [+48 576 043 920](tel:+48576043920)
- **Discord**: [discord.gg/vulcode](https://discord.gg/vulcode)
