RGO Demo#760
Draft
FakeByte wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ECS implementation, fully unit tested with RGO demo on how it is used.
The demo doesnt cache any data and runs multiple loops over data in multiple systems instead of combining systems to show how systems work together, its not meant to benchmark performance but usability.
Systems run in the following stages with stage 5 & 6 running 2 systems in parallel, while the other systems run alone in a stage but run multi threaded over the data:
flowchart TD classDef prov fill:#1f3a5f,stroke:#9ecbff,color:#eaf2ff; classDef pop fill:#3a2f1f,stroke:#ffce9e,color:#fff3e6; S1["Stage 1<br/>RgoComputePopulationTotalsSystem<br/><i>over provinces</i>"]:::prov S2["Stage 2<br/>RgoHireSystem<br/><i>over provinces</i>"]:::prov S3["Stage 3<br/>RgoProduceAndPlaceOrderSystem<br/><i>over provinces</i>"]:::prov S4["Stage 4<br/>RgoResolveSellOrderAndOwnerShareSystem<br/><i>over provinces</i>"]:::prov S5a["Stage 5a<br/>RgoComputeOwnerIncomeSystem<br/><i>over provinces</i>"]:::prov S5b["Stage 5b<br/>RgoComputeEmployeeIncomeSystem<br/><i>over provinces</i>"]:::prov S6a["Stage 6a<br/>ApplyEmployeeIncomeToPopsSystem<br/><i>over pops</i>"]:::pop S6b["Stage 6b<br/>ApplyOwnerIncomeToPopsSystem<br/><i>over pops</i>"]:::pop S7["Stage 7<br/>AggregatePopIncomeSystem<br/><i>over pops</i>"]:::pop S1 --> S2 --> S3 --> S4 S4 --> S5a S4 --> S5b S5b --> S6a S5a --> S6b S6a --> S7 S6b --> S7This chart shows which Systems read/write from which components and how the Systems interact with each other through components without having any dependencies on each other:
flowchart LR classDef sys fill:#243b53,stroke:#9ecbff,color:#eaf2ff; classDef prov fill:#102a43,stroke:#5b8fc9,color:#d6e6ff; classDef pop fill:#3a2f1f,stroke:#ffce9e,color:#fff3e6; classDef sing fill:#2b2b2b,stroke:#9e9e9e,color:#eee; %% Singletons REG["RgoProductionTypeRegistry"]:::sing PRICE["RgoMarketPriceTable"]:::sing RULES["RgoGameRules"]:::sing %% Systems S1["RgoComputePopulationTotalsSystem"]:::sys S2["RgoHireSystem"]:::sys S3["RgoProduceAndPlaceOrderSystem"]:::sys S4["RgoResolveSellOrderAndOwnerShareSystem"]:::sys S5a["RgoComputeOwnerIncomeSystem"]:::sys S5b["RgoComputeEmployeeIncomeSystem"]:::sys S6a["ApplyEmployeeIncomeToPopsSystem"]:::sys S6b["ApplyOwnerIncomeToPopsSystem"]:::sys S7["AggregatePopIncomeSystem"]:::sys %% Province components CACHE["ProvinceRgoCacheTotals"]:::prov HIRED["ProvinceRgoHired"]:::prov ORDER["ProvinceRgoSellOrder"]:::prov RESULT["ProvinceRgoResult"]:::prov OINC["ProvinceRgoOwnerIncome"]:::prov EINC["ProvinceRgoEmployeeIncome"]:::prov %% Pop components PWI["PopWorkerIncome"]:::pop POI["PopOwnerIncome"]:::pop PIT["PopIncomeTotals"]:::pop %% Stage 1 REG -.->|lookup| S1 S1 -->|writes| CACHE %% Stage 2 CACHE -->|reads| S2 REG -.->|lookup| S2 S2 -->|writes| HIRED %% Stage 3 HIRED -->|reads| S3 CACHE -->|reads| S3 REG -.->|lookup| S3 RULES -.->|lookup| S3 S3 -->|"writes output_quantity"| RESULT S3 -->|writes| ORDER %% Stage 4 ORDER -->|reads + clears| S4 PRICE -.->|lookup| S4 CACHE -->|reads| S4 S4 -->|"writes revenue, owner_share,<br/>total_minimum_wage"| RESULT S4 -->|"writes employee min wages"| HIRED %% Stage 5 RESULT -->|reads| S5a CACHE -->|reads| S5a REG -.->|lookup| S5a S5a -->|writes| OINC RESULT -->|reads| S5b HIRED -->|reads| S5b S5b -->|writes| EINC %% Stage 6 HIRED -.->|reads| S6a EINC -.->|reads| S6a S6a -->|writes| PWI RESULT -.->|reads| S6b CACHE -.->|reads| S6b REG -.->|lookup| S6b S6b -->|writes| POI %% Stage 7 PWI -->|reads| S7 POI -->|reads| S7 S7 -->|"writes total + cash"| PIT