commit 942c249be359651cf9227bd3b7bc6bfa18da2f3b Author: Nick Dumas Date: Sat Jan 17 15:20:38 2026 -0500 initial commit diff --git a/cmd/cli/guest/main.go b/cmd/cli/guest/main.go new file mode 100644 index 0000000..fe3c42c --- /dev/null +++ b/cmd/cli/guest/main.go @@ -0,0 +1,43 @@ +package main + +import ( + "fmt" + + "github.com/mlange-42/ark/ecs" + + "code.ndumas.com/ndumas/muddy" +) + +func main() { + world := ecs.NewWorld() + + locationMapper := ecs.NewMap3[muddy.ID, muddy.Location, muddy.Observable](world) + + z := 0 + for i := range 10 { + for j := range 10 { + _ = locationMapper.NewEntity( + &muddy.ID{ID: int64(z)}, + &muddy.Location{ + World: 0, + Exits: make([]int64, 0), + }, + &muddy.Observable{ + Name: fmt.Sprintf("Room (%d,%d)", i, j), + }, + ) + z++ + } + } + + locationFilter := ecs.NewFilter3[muddy.ID, muddy.Location, muddy.Observable](world) + + query := locationFilter.Query() + for query.Next() { + id, loc, obsv := query.Get() + fmt.Println("====") + fmt.Printf("%#v\n", id) + fmt.Printf("%#v\n", loc) + fmt.Printf("%#v\n", obsv) + } +} diff --git a/components.go b/components.go new file mode 100644 index 0000000..0af35dc --- /dev/null +++ b/components.go @@ -0,0 +1,15 @@ +package muddy + +type ID struct { + ID int64 +} + +type Location struct { + World int64 + Exits []int64 +} + +type Observable struct { + Name string + Description string +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..9324db1 --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module code.ndumas.com/ndumas/muddy + +go 1.24.5 + +require github.com/mlange-42/ark v0.7.0 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..914e546 --- /dev/null +++ b/go.sum @@ -0,0 +1,2 @@ +github.com/mlange-42/ark v0.7.0 h1:cLEqhJhZaZayi35eY/cE7VQg7GonK+s1qbsSKdtcjrs= +github.com/mlange-42/ark v0.7.0/go.mod h1:gkS9cuklENPTmSjL2z4DcJgJsIVqF1yNwFlx48Hz/Sw=