Chris's 2021 Modding Guide P3 For AI War 2: Double Buffering Data

Опубликовано: 04 Июнь 2026
на канале: Arcen Games
36
1

00:00 Intro
00:26 Hey, regions really make code easier to see in an IDE.
01:00 const string versus readonly string. Pros and cons for practical use.
01:30 Looking at the two kinds of collections on Astro train BaseInfo, all filled via Stage2.
02:10 What readonly means when applied to a collection
02:25 How to do memory dumps, and why, and how to see if there's a leak of your collections.
03:10 Why the starting capacity of collections matters for performance, tradeoffs for larger or smaller. How this can also lead to cross-threading exceptions.
05:40 Seriously, who needs a double-buffered collection. It probably has no purpose, right?
08:50 How "flickering" lists causes AI problems and moronic decisions from otherwise perfect code. And how this is in our game in the past.
11:10 Details of how double buffering actually solves visual flicker and AI idiocy and cross-threading exceptions
12:00 Discussing how a "complete collection" is hard to fully conceptualize... and thus leads us to what a concurrent double buffered collection is for.
12:45 Attitude is lazy? Oh wait, it's about performance. Concurrence versus performance.
14:00 How much less efficient are the concurrent collections, and what features do they lack in exchange for their superpowers?
14:40 How to definitively decide on regular double-buffering, or concurrent double buffering.
15:15 Okay, so how do we use these things, now that we understand the theory behind them? And what's different about secondary features of them?
15:50 How to fill our collections, and the difference between Construction and Display
16:50 Understanding the power and danger of the rotating pool inside a double buffer
19:20 Finally starting to build the list now that we understand the intricacies of timing our Clears of the back buffer
21:05 The astro trains are actually a complex example, but still easy to follow: nested double buffers in double-buffered objects. Seriously, it's not as hard as it sounds at first, and the code is really readable.
22:50 Hey, sometimes you can solve a visual/AI flicker on a single variable without using an actual double buffer. You may have been doing it for years.
24:10 So why do the TrainsEnRoute for astro trains have to be concurrent, anyway? Let's actually see.
27:05 Concurrency as a way to keep code readable and avoid refactors, even at a slight performance cost. Worth it? YES. Here's the case for it.
27:42 But when designing a NEW faction, can you design to make that problem moot? Sometimes, yes. But when you can't, go for code clarity over performance in these areas.
29:38 For the love of everything, structure your code for readability. Slight performance gains in certain areas discussed here are not worth it when the code can't be maintained.
31:50 Looking at the double buffered arcen sparse lookup, which is more rarely used. These examples also apply to double buffered dictionaries, which are more common. Semantics and structure.
35:10 Why sorting a concurrent collection is out, and how to work around that if you need to.