Web Analytics

ark

⭐ 222 stars Korean 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. & 기여자들 (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 ---