Skip to content

Commit 3195a3c

Browse files
author
Stephen Gutekanst
committed
cleanup
Signed-off-by: Stephen Gutekanst <[email protected]>
1 parent 68688ca commit 3195a3c

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

content/2022/lets-build-ecs-part-1.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ In this article, we'll mostly go over the problem space, data oriented design, t
2626
- [Sparse data storage](#sparse-data-storage)
2727
- [Comptime sparse data](#comptime-sparse-data)
2828
- [Runtime sparse data](#runtime-sparse-data)
29-
- [Avoiding Unity software patents & improving performance while doing it](#avoiding-unity-software-patents--improving-performance-while-doing-it)
29+
- [Improving performance](#improving-performance)
3030
- [Archetype storage](#archetype-storage)
3131
- [Comptime archetype storage](#comptime-archetype-storage)
3232
- [Runtime archetype storage](#runtime-archetype-storage)
@@ -189,7 +189,7 @@ Now we've got a mapping of player Entity IDs -> their nicknames and weapons. We
189189

190190
I call this type of data _runtime sparse data_.
191191

192-
### Avoiding Unity software patents & improving performance while doing it
192+
### Improving performance
193193

194194
Consider our player storage as it stands right now:
195195

@@ -205,9 +205,7 @@ const Player = struct {
205205
var players: ArrayList(Player) = .{}; // all players
206206
```
207207

208-
In a perfect world, software patents wouldn't exist. But, in our world, however, Unity makes 20 claims in their software patent covering ECS, including all code we've written above to this point. Luckily, [as the Bevy authors suggest here](https://www.reddit.com/r/rust/comments/pjtpkj/unity_files_patent_for_ecs_in_game_engines_that/hbzaz61/) entity component systems which store components in separate arrays are not affected by this (this is not legal advice)
209-
210-
Additionally, because of the way structs get laid out in memory with padding, our players array above would end up having a larger memory footprint than needed. So we actually benefit from using a separate array for every type of data (thanks, Unity!):
208+
Because of the way structs get laid out in memory with padding, our players array above would end up having a larger memory footprint than needed. So we actually benefit from using a separate array for every type of data (thanks, Unity!):
211209

212210
```zig
213211
var player_names: ArrayList([]const u8) = .{};
@@ -290,9 +288,8 @@ We now start to see _some_ of the things our ECS architecture should solve:
290288

291289
Additionally, these are the design principles I've come up with:
292290

293-
* Clean-room implementation (I've not read any other ECS implementation code.)
291+
* Clean-room implementation (I've not read any other ECS implementation code), just working from first-principles as an engineer
294292
* Solve the problems ECS solves, in a way that is natural to Zig and leverages Zig comptime.
295-
* Avoid patent infringement upon Unity ECS patent claims.
296293
* Fast. Optimal for CPU caches, multi-threaded, leverage comptime as much as is reasonable.
297294
* Simple. Small API footprint, should be natural and fun - not like you're writing boilerplate.
298295
* Enable other libraries to provide tracing, editors, visualizers, profilers, etc.

0 commit comments

Comments
 (0)