rrbox / ecs-swift

Entity Component System for swift
MIT License
3 stars 0 forks source link

非同期処理の活用 #40

Open rrbox opened 7 months ago

rrbox commented 7 months ago

Update, Event の実行を並列処理で行う提案です。

rrbox commented 7 months ago

システムの実行は withThrowingTaskGroup(of:returning:body:) で並列化できます。

rrbox commented 7 months ago

WorldStorageRef, Query, Commands, Resource などは actor にして隔離することを検討したいです。

API が以下のように変更され, システムおよび system parameter の操作全てが async になります。

func system(query: Query<SomeComponent>, commands: Commands) async {
    await query.update { _, value in

    }

    await commands.spawn()
        .addComponent(SomeComponent)
}
rrbox commented 7 months ago

Graphic のデータ反映は MainActor を使う必要がありそうです。

rrbox commented 5 months ago

API が大きく変更されることが確定しているため、即採用とはいかないと思います。

rrbox commented 5 months ago

59