-
This might sound dumb but can i run ebiten without creating a window and having it call the draw function? Something like in unity with the -nographics flag? I want to keep the logic you guys made for the game loop, how it is called and when and i don't want to re-create this part for the server. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
That's a lot of overhead to maintain an infinite for loop. Since it's server side and you don't want any window logic. package main
import (
"log"
"time"
)
const target_tps = 50
func main() {
ticker := time.NewTicker(time.Second / target_tps)
for {
<-ticker.C
update()
}
}
func update() {
log.Println("update")
} |
Beta Was this translation helpful? Give feedback.
-
something akin to this? // client.go
//go:build client
func (g *Game) Draw(screen *ebiten.Image) {
// ...
}
func main() {
ebiten.Run(&Game{})
} // server.go
//go:build server
func (g *Game) Draw(screen *ebiten.Image) {}
func main() {
g := &Game{}
for _ := range time.Tick(time.Second/60) {
g.Update()
}
} or does ebiten require graphics even if Run is not called..? |
Beta Was this translation helpful? Give feedback.
That's a lot of overhead to maintain an infinite for loop. Since it's server side and you don't want any window logic.