Web Analytics

ark

⭐ 222 stars Japanese by mlange-42

Ark Logo

Test status codecov Go Report Card User Guide Go Reference GitHub DOI:10.5281/zenodo.14994239 MIT license Apache 2.0 license Mentioned in Awesome Go

Arkは、Go向けのアーキタイプベースのエンティティコンポーネントシステム (ECS)です。

——

特徴   •   インストール   •   使い方   •   ツール

特徴

インストール

GoプロジェクトでArkを使用するには、次のコマンドを実行します:

go get github.com/mlange-42/ark

使用法

以下は、すべてのECSドキュメントで示されている古典的な位置/速度の例です。

詳細については、ユーザーガイドAPIドキュメント、およびを参照してください。

package main

import ( "math/rand/v2" "github.com/mlange-42/ark/ecs" )

// Position component type Position struct { X, Y float64 }

// Velocity component type Velocity struct { DX, DY float64 }

func main() { // Create a new World world := ecs.NewWorld()

// Create a component mapper // Save mappers permanently and re-use them for best performance mapper := ecs.NewMap2Position, Velocity

// Create entities with components for range 1000 { _ = mapper.NewEntity( &Position{X: rand.Float64() 100, Y: rand.Float64() 100}, &Velocity{DX: rand.NormFloat64(), DY: rand.NormFloat64()}, ) }

// Create a filter // Save filters permanently and re-use them for best performance filter := ecs.NewFilter2Position, Velocity

// Time loop for range 5000 { // Get a fresh query and iterate it query := filter.Query() for query.Next() { // Component access through the Query pos, vel := query.Get() // Update component fields pos.X += vel.DX pos.Y += vel.DY } } }

ツール

引用方法

Lange, M. & contributors (2025): Ark – Go のためのアーキタイプベースのエンティティコンポーネントシステム。DOI: 10.5281/zenodo.14994239、GitHub リポジトリ: https://github.com/mlange-42/ark

ライセンス

Ark とそのすべてのソースおよびドキュメントは、MIT ライセンスApache 2.0 ライセンス のいずれかのオプションで配布されます。

--- Tranlated By Open Ai Tx | Last indexed: 2026-03-03 ---