특징
- 성능을 위해 설계되고 매우 최적화됨. 벤치마크를 참조하세요.
- 잘 문서화되고, 타입 안전한 API와 포괄적인 사용자 가이드.
- 1급 기능으로서의 엔티티 관계.
- 필터링 및 사용자 정의 이벤트 타입을 지원하는 확장 가능한 이벤트 시스템.
- 대량 조작을 위한 빠른 배치 작업.
- 시스템 없음. 쿼리만 있음. 자신의 구조체(또는 도구)를 사용하세요.
- ark-serde를 사용한 월드 직렬화 및 역직렬화.
- 제로 종속성, 100% 테스트 커버리지.
설치
Go 프로젝트에서 Ark를 사용하려면 다음을 실행하세요:
go get github.com/mlange-42/ark
사용법
아래는 모든 ECS 문서에 나오는 고전적인 위치/속도 예제입니다.
자세한 내용은 사용자 가이드, API 문서 및 예제를 참조하세요.
package mainimport (
"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
}
}
}
도구
- ark-serde는 Ark의 월드를 위한 JSON 직렬화 및 역직렬화를 제공합니다.
- ark-tools는 Ark를 위한 시스템, 스케줄러 및 기타 유용한 기능을 제공합니다.
- ark-pixel은 Pixel 게임 엔진을 통해 OpenGL 그래픽과 라이브 플롯을 제공합니다.
인용 방법
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 ---