Skip to content

RGO Demo#760

Draft
FakeByte wants to merge 1 commit into
masterfrom
ecs-proposal
Draft

RGO Demo#760
FakeByte wants to merge 1 commit into
masterfrom
ecs-proposal

Conversation

@FakeByte
Copy link
Copy Markdown
Contributor

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 --> S7
Loading

This 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
Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant