initial commit

main
Nick Dumas 2 weeks ago
commit 942c249be3

@ -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)
}
}

@ -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
}

@ -0,0 +1,5 @@
module code.ndumas.com/ndumas/muddy
go 1.24.5
require github.com/mlange-42/ark v0.7.0

@ -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=
Loading…
Cancel
Save