Reorganize code

This commit is contained in:
2025-01-13 11:10:48 +01:00
parent 0a58e0453a
commit 91cdbab54a
16 changed files with 480 additions and 424 deletions

48
types/types.go Normal file
View File

@ -0,0 +1,48 @@
package types
import (
"sync"
"time"
pb "gitea.boner.be/bdnugget/goonserver/actions"
rl "github.com/gen2brain/raylib-go/raylib"
)
type Tile struct {
X, Y int
Height float32
Walkable bool
}
type Player struct {
sync.Mutex
PosActual rl.Vector3
PosTile Tile
TargetPath []Tile
ActionQueue []*pb.Action
Speed float32
Model rl.Model
Texture rl.Texture2D
ID int32
CurrentTick int64
LastUpdateTime time.Time
InterpolationProgress float32
}
type ModelAsset struct {
Model rl.Model
Texture rl.Texture2D
}
const (
MapWidth = 50
MapHeight = 50
TileSize = 32
TileHeight = 2.0
// RuneScape-style tick rate (600ms)
ServerTickRate = 600 * time.Millisecond
ClientTickRate = 50 * time.Millisecond
MaxTickDesync = 5
ServerAddr = "localhost:6969"
)