Compare commits
No commits in common. "0e509ad7528bbf62eef956b297d2ca31b7d6cc13" and "944c33ce3b468b9512272e795abdf2eb55b8c281" have entirely different histories.
0e509ad752
...
944c33ce3b
2
.gitignore
vendored
2
.gitignore
vendored
@ -11,5 +11,3 @@ goonscape.exe
|
|||||||
# OS files
|
# OS files
|
||||||
.DS_Store
|
.DS_Store
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
|
||||||
resources/models/old_and_test/
|
|
@ -5,74 +5,21 @@ import (
|
|||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "github.com/gen2brain/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Helper function to load animations for a model
|
|
||||||
func loadModelAnimations(animPaths map[string]string) (types.AnimationSet, error) {
|
|
||||||
var animSet types.AnimationSet
|
|
||||||
|
|
||||||
// Load idle animations if specified
|
|
||||||
if idlePath, ok := animPaths["idle"]; ok {
|
|
||||||
idleAnims := rl.LoadModelAnimations(idlePath)
|
|
||||||
if len(idleAnims) > 0 {
|
|
||||||
animSet.Idle = idleAnims
|
|
||||||
rl.TraceLog(rl.LogInfo, "Loaded idle animation: %s (%d frames, %f seconds)",
|
|
||||||
idlePath, idleAnims[0].FrameCount, float32(idleAnims[0].FrameCount)/60.0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load walk animations if specified
|
|
||||||
if walkPath, ok := animPaths["walk"]; ok {
|
|
||||||
walkAnims := rl.LoadModelAnimations(walkPath)
|
|
||||||
if len(walkAnims) > 0 {
|
|
||||||
animSet.Walk = walkAnims
|
|
||||||
rl.TraceLog(rl.LogInfo, "Loaded walk animation: %s (%d frames, %f seconds)",
|
|
||||||
walkPath, walkAnims[0].FrameCount, float32(walkAnims[0].FrameCount)/60.0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return animSet, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func LoadModels() ([]types.ModelAsset, error) {
|
func LoadModels() ([]types.ModelAsset, error) {
|
||||||
// Goonion model and animations
|
goonerModel := rl.LoadModel("resources/models/goonion.obj")
|
||||||
goonerModel := rl.LoadModel("resources/models/biped/Animation_Unsteady_Walk_withSkin.glb")
|
goonerTexture := rl.LoadTexture("resources/models/goonion.png")
|
||||||
goonerAnims, _ := loadModelAnimations(map[string]string{"idle": "resources/models/biped/Animation_Idle_withSkin.glb", "walk": "resources/models/biped/Animation_Unsteady_Walk_withSkin.glb"})
|
rl.SetMaterialTexture(goonerModel.Materials, rl.MapDiffuse, goonerTexture)
|
||||||
|
|
||||||
// Apply transformations
|
|
||||||
transform := rl.MatrixIdentity()
|
|
||||||
transform = rl.MatrixMultiply(transform, rl.MatrixRotateY(180*rl.Deg2rad))
|
|
||||||
transform = rl.MatrixMultiply(transform, rl.MatrixRotateX(-90*rl.Deg2rad))
|
|
||||||
transform = rl.MatrixMultiply(transform, rl.MatrixScale(1.0, 1.0, 1.0))
|
|
||||||
goonerModel.Transform = transform
|
|
||||||
|
|
||||||
// Coomer model (ready for animations)
|
|
||||||
coomerModel := rl.LoadModel("resources/models/coomer.obj")
|
coomerModel := rl.LoadModel("resources/models/coomer.obj")
|
||||||
coomerTexture := rl.LoadTexture("resources/models/coomer.png")
|
coomerTexture := rl.LoadTexture("resources/models/coomer.png")
|
||||||
rl.SetMaterialTexture(coomerModel.Materials, rl.MapDiffuse, coomerTexture)
|
rl.SetMaterialTexture(coomerModel.Materials, rl.MapDiffuse, coomerTexture)
|
||||||
// When you have animations, add them like:
|
|
||||||
// coomerAnims, _ := loadModelAnimations("resources/models/coomer.glb",
|
|
||||||
// map[string]string{
|
|
||||||
// "idle": "resources/models/coomer_idle.glb",
|
|
||||||
// "walk": "resources/models/coomer_walk.glb",
|
|
||||||
// })
|
|
||||||
|
|
||||||
// Shreke model (ready for animations)
|
|
||||||
shrekeModel := rl.LoadModel("resources/models/shreke.obj")
|
shrekeModel := rl.LoadModel("resources/models/shreke.obj")
|
||||||
shrekeTexture := rl.LoadTexture("resources/models/shreke.png")
|
shrekeTexture := rl.LoadTexture("resources/models/shreke.png")
|
||||||
rl.SetMaterialTexture(shrekeModel.Materials, rl.MapDiffuse, shrekeTexture)
|
rl.SetMaterialTexture(shrekeModel.Materials, rl.MapDiffuse, shrekeTexture)
|
||||||
// When you have animations, add them like:
|
|
||||||
// shrekeAnims, _ := loadModelAnimations("resources/models/shreke.glb",
|
|
||||||
// map[string]string{
|
|
||||||
// "idle": "resources/models/shreke_idle.glb",
|
|
||||||
// "walk": "resources/models/shreke_walk.glb",
|
|
||||||
// })
|
|
||||||
|
|
||||||
return []types.ModelAsset{
|
return []types.ModelAsset{
|
||||||
{
|
{Model: goonerModel, Texture: goonerTexture},
|
||||||
Model: goonerModel,
|
|
||||||
Animation: append(goonerAnims.Idle, goonerAnims.Walk...), // For compatibility
|
|
||||||
AnimFrames: int32(len(goonerAnims.Idle) + len(goonerAnims.Walk)),
|
|
||||||
Animations: goonerAnims,
|
|
||||||
},
|
|
||||||
{Model: coomerModel, Texture: coomerTexture},
|
{Model: coomerModel, Texture: coomerTexture},
|
||||||
{Model: shrekeModel, Texture: shrekeTexture},
|
{Model: shrekeModel, Texture: shrekeTexture},
|
||||||
}, nil
|
}, nil
|
||||||
@ -84,11 +31,6 @@ func LoadMusic(filename string) (rl.Music, error) {
|
|||||||
|
|
||||||
func UnloadModels(models []types.ModelAsset) {
|
func UnloadModels(models []types.ModelAsset) {
|
||||||
for _, model := range models {
|
for _, model := range models {
|
||||||
if model.Animation != nil {
|
|
||||||
for i := int32(0); i < model.AnimFrames; i++ {
|
|
||||||
rl.UnloadModelAnimation(model.Animation[i])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
rl.UnloadModel(model.Model)
|
rl.UnloadModel(model.Model)
|
||||||
rl.UnloadTexture(model.Texture)
|
rl.UnloadTexture(model.Texture)
|
||||||
}
|
}
|
||||||
|
2287
frames.txt
2287
frames.txt
File diff suppressed because it is too large
Load Diff
39
game/game.go
39
game/game.go
@ -68,14 +68,17 @@ func (g *Game) Update(deltaTime float32) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Assign model based on player ID
|
||||||
|
modelIndex := int(playerID) % len(g.Models)
|
||||||
g.Player = &types.Player{
|
g.Player = &types.Player{
|
||||||
Speed: 50.0,
|
Speed: 50.0,
|
||||||
TargetPath: []types.Tile{},
|
TargetPath: []types.Tile{},
|
||||||
UserData: g,
|
UserData: g,
|
||||||
QuitDone: make(chan struct{}),
|
QuitDone: make(chan struct{}),
|
||||||
ID: playerID,
|
ID: playerID,
|
||||||
|
Model: g.Models[modelIndex].Model,
|
||||||
|
Texture: g.Models[modelIndex].Texture,
|
||||||
}
|
}
|
||||||
g.AssignModelToPlayer(g.Player)
|
|
||||||
|
|
||||||
go network.HandleServerCommunication(conn, playerID, g.Player, g.OtherPlayers, g.QuitChan)
|
go network.HandleServerCommunication(conn, playerID, g.Player, g.OtherPlayers, g.QuitChan)
|
||||||
g.isLoggedIn = true
|
g.isLoggedIn = true
|
||||||
@ -160,26 +163,8 @@ func (g *Game) DrawPlayer(player *types.Player, model rl.Model) {
|
|||||||
Z: player.PosActual.Z,
|
Z: player.PosActual.Z,
|
||||||
}
|
}
|
||||||
|
|
||||||
if player.ID%int32(len(g.Models)) == 0 {
|
|
||||||
modelAsset := g.Models[0]
|
|
||||||
|
|
||||||
// Check if model has animations
|
|
||||||
if modelAsset.Animations.Idle != nil || modelAsset.Animations.Walk != nil {
|
|
||||||
if player.IsMoving && len(modelAsset.Animations.Walk) > 0 {
|
|
||||||
anim := modelAsset.Animations.Walk[0] // Use first walk animation
|
|
||||||
player.AnimationFrame = player.AnimationFrame % anim.FrameCount
|
|
||||||
rl.UpdateModelAnimation(model, anim, player.AnimationFrame)
|
|
||||||
} else if len(modelAsset.Animations.Idle) > 0 {
|
|
||||||
anim := modelAsset.Animations.Idle[0] // Use first idle animation
|
|
||||||
player.AnimationFrame = player.AnimationFrame % anim.FrameCount
|
|
||||||
rl.UpdateModelAnimation(model, anim, player.AnimationFrame)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rl.DrawModel(model, playerPos, 16, rl.White)
|
rl.DrawModel(model, playerPos, 16, rl.White)
|
||||||
|
|
||||||
// Draw floating messages and path indicators
|
|
||||||
if player.FloatingMessage != nil {
|
if player.FloatingMessage != nil {
|
||||||
screenPos := rl.GetWorldToScreen(rl.Vector3{
|
screenPos := rl.GetWorldToScreen(rl.Vector3{
|
||||||
X: playerPos.X,
|
X: playerPos.X,
|
||||||
@ -222,9 +207,12 @@ func (g *Game) Render() {
|
|||||||
rl.BeginMode3D(g.Camera)
|
rl.BeginMode3D(g.Camera)
|
||||||
g.DrawMap()
|
g.DrawMap()
|
||||||
g.DrawPlayer(g.Player, g.Player.Model)
|
g.DrawPlayer(g.Player, g.Player.Model)
|
||||||
for _, other := range g.OtherPlayers {
|
for id, other := range g.OtherPlayers {
|
||||||
if other.Model.Meshes == nil {
|
if other.Model.Meshes == nil {
|
||||||
g.AssignModelToPlayer(other)
|
// Assign model based on player ID for consistency
|
||||||
|
modelIndex := int(id) % len(g.Models)
|
||||||
|
other.Model = g.Models[modelIndex].Model
|
||||||
|
other.Texture = g.Models[modelIndex].Texture
|
||||||
}
|
}
|
||||||
g.DrawPlayer(other, other.Model)
|
g.DrawPlayer(other, other.Model)
|
||||||
}
|
}
|
||||||
@ -364,12 +352,3 @@ func (g *Game) Shutdown() {
|
|||||||
func (g *Game) HandleServerMessages(messages []*pb.ChatMessage) {
|
func (g *Game) HandleServerMessages(messages []*pb.ChatMessage) {
|
||||||
g.Chat.HandleServerMessages(messages)
|
g.Chat.HandleServerMessages(messages)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Game) AssignModelToPlayer(player *types.Player) {
|
|
||||||
modelIndex := int(player.ID) % len(g.Models)
|
|
||||||
modelAsset := g.Models[modelIndex]
|
|
||||||
|
|
||||||
// Just use the original model - don't try to copy it
|
|
||||||
player.Model = modelAsset.Model
|
|
||||||
player.Texture = modelAsset.Texture
|
|
||||||
}
|
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
245
segfault.txt
245
segfault.txt
@ -1,245 +0,0 @@
|
|||||||
INFO: Initializing raylib 5.5
|
|
||||||
INFO: Platform backend: DESKTOP (GLFW)
|
|
||||||
INFO: Supported raylib modules:
|
|
||||||
INFO: > rcore:..... loaded (mandatory)
|
|
||||||
INFO: > rlgl:...... loaded (mandatory)
|
|
||||||
INFO: > rshapes:... loaded (optional)
|
|
||||||
INFO: > rtextures:. loaded (optional)
|
|
||||||
INFO: > rtext:..... loaded (optional)
|
|
||||||
INFO: > rmodels:... loaded (optional)
|
|
||||||
INFO: > raudio:.... loaded (optional)
|
|
||||||
INFO: DISPLAY: Device initialized successfully
|
|
||||||
INFO: > Display size: 1920 x 1080
|
|
||||||
INFO: > Screen size: 1024 x 768
|
|
||||||
INFO: > Render size: 1024 x 768
|
|
||||||
INFO: > Viewport offsets: 0, 0
|
|
||||||
INFO: GLAD: OpenGL extensions loaded successfully
|
|
||||||
INFO: GL: Supported extensions count: 390
|
|
||||||
INFO: GL: OpenGL device information:
|
|
||||||
INFO: > Vendor: NVIDIA Corporation
|
|
||||||
INFO: > Renderer: NVIDIA GeForce GTX 1070/PCIe/SSE2
|
|
||||||
INFO: > Version: 3.3.0 NVIDIA 565.77
|
|
||||||
INFO: > GLSL: 3.30 NVIDIA via Cg compiler
|
|
||||||
INFO: GL: VAO extension detected, VAO functions loaded successfully
|
|
||||||
INFO: GL: NPOT textures extension detected, full NPOT textures supported
|
|
||||||
INFO: GL: DXT compressed textures supported
|
|
||||||
INFO: GL: ETC2/EAC compressed textures supported
|
|
||||||
INFO: PLATFORM: DESKTOP (GLFW - X11): Initialized successfully
|
|
||||||
INFO: TEXTURE: [ID 1] Texture loaded successfully (1x1 | R8G8B8A8 | 1 mipmaps)
|
|
||||||
INFO: TEXTURE: [ID 1] Default texture loaded successfully
|
|
||||||
INFO: SHADER: [ID 1] Vertex shader compiled successfully
|
|
||||||
INFO: SHADER: [ID 2] Fragment shader compiled successfully
|
|
||||||
INFO: SHADER: [ID 3] Program shader loaded successfully
|
|
||||||
INFO: SHADER: [ID 3] Default shader loaded successfully
|
|
||||||
INFO: RLGL: Render batch vertex buffers loaded successfully in RAM (CPU)
|
|
||||||
INFO: RLGL: Render batch vertex buffers loaded successfully in VRAM (GPU)
|
|
||||||
INFO: RLGL: Default OpenGL state initialized successfully
|
|
||||||
INFO: TEXTURE: [ID 2] Texture loaded successfully (128x128 | GRAY_ALPHA | 1 mipmaps)
|
|
||||||
INFO: FONT: Default font loaded successfully (224 glyphs)
|
|
||||||
INFO: SYSTEM: Working Directory: /home/bd/Projects/go/goonscape
|
|
||||||
INFO: AUDIO: Device initialized successfully
|
|
||||||
INFO: > Backend: miniaudio | PulseAudio
|
|
||||||
INFO: > Format: 32-bit IEEE Floating Point -> 32-bit Signed Integer
|
|
||||||
INFO: > Channels: 2 -> 2
|
|
||||||
INFO: > Sample rate: 48000 -> 48000
|
|
||||||
INFO: > Periods size: 3600
|
|
||||||
INFO: TIMER: Target time per frame: 16.667 milliseconds
|
|
||||||
INFO: FILEIO: [resources/models/goonion.obj] Text file loaded successfully
|
|
||||||
INFO: FILEIO: [goonion.png] File loaded successfully
|
|
||||||
INFO: IMAGE: Data loaded successfully (2048x2048 | R8G8B8 | 1 mipmaps)
|
|
||||||
INFO: TEXTURE: [ID 3] Texture loaded successfully (2048x2048 | R8G8B8 | 1 mipmaps)
|
|
||||||
INFO: VAO: [ID 2] Mesh uploaded successfully to VRAM (GPU)
|
|
||||||
WARNING: VAO: [ID 2] Trying to re-load an already loaded mesh
|
|
||||||
INFO: FILEIO: [resources/models/goonion.png] File loaded successfully
|
|
||||||
INFO: IMAGE: Data loaded successfully (2048x2048 | R8G8B8 | 1 mipmaps)
|
|
||||||
INFO: TEXTURE: [ID 4] Texture loaded successfully (2048x2048 | R8G8B8 | 1 mipmaps)
|
|
||||||
INFO: FILEIO: [resources/models/biped/Animation_Unsteady_Walk_withSkin.glb] File loaded successfully
|
|
||||||
INFO: MODEL: [resources/models/biped/Animation_Unsteady_Walk_withSkin.glb] Loaded animation: Armature|Unsteady_Walk|baselayer (177 frames, 3.000000s)
|
|
||||||
INFO: FILEIO: [resources/models/coomer.obj] Text file loaded successfully
|
|
||||||
INFO: FILEIO: [coomer.png] File loaded successfully
|
|
||||||
INFO: IMAGE: Data loaded successfully (2048x2048 | R8G8B8 | 1 mipmaps)
|
|
||||||
INFO: TEXTURE: [ID 5] Texture loaded successfully (2048x2048 | R8G8B8 | 1 mipmaps)
|
|
||||||
INFO: VAO: [ID 3] Mesh uploaded successfully to VRAM (GPU)
|
|
||||||
WARNING: VAO: [ID 3] Trying to re-load an already loaded mesh
|
|
||||||
INFO: FILEIO: [resources/models/coomer.png] File loaded successfully
|
|
||||||
INFO: IMAGE: Data loaded successfully (2048x2048 | R8G8B8 | 1 mipmaps)
|
|
||||||
INFO: TEXTURE: [ID 6] Texture loaded successfully (2048x2048 | R8G8B8 | 1 mipmaps)
|
|
||||||
INFO: FILEIO: [resources/models/shreke.obj] Text file loaded successfully
|
|
||||||
INFO: FILEIO: [shreke.png] File loaded successfully
|
|
||||||
INFO: IMAGE: Data loaded successfully (2048x2048 | R8G8B8 | 1 mipmaps)
|
|
||||||
INFO: TEXTURE: [ID 7] Texture loaded successfully (2048x2048 | R8G8B8 | 1 mipmaps)
|
|
||||||
INFO: VAO: [ID 4] Mesh uploaded successfully to VRAM (GPU)
|
|
||||||
WARNING: VAO: [ID 4] Trying to re-load an already loaded mesh
|
|
||||||
INFO: FILEIO: [resources/models/shreke.png] File loaded successfully
|
|
||||||
INFO: IMAGE: Data loaded successfully (2048x2048 | R8G8B8 | 1 mipmaps)
|
|
||||||
INFO: TEXTURE: [ID 8] Texture loaded successfully (2048x2048 | R8G8B8 | 1 mipmaps)
|
|
||||||
INFO: STREAM: Initialized successfully (48000 Hz, 32 bit, Stereo)
|
|
||||||
INFO: FILEIO: [resources/audio/GoonScape2.mp3] Music file loaded successfully
|
|
||||||
INFO: > Sample rate: 48000 Hz
|
|
||||||
INFO: > Sample size: 32 bits
|
|
||||||
INFO: > Channels: 2 (Stereo)
|
|
||||||
INFO: > Total frames: 3487104
|
|
||||||
2025/01/20 12:28:12 Connected to server. Authenticating...
|
|
||||||
2025/01/20 12:28:12 Successfully authenticated with player ID: 6
|
|
||||||
Clicked: 2, 1
|
|
||||||
Path found: [{5 1 1 true} {4 1 5 true} {3 1 4 true} {2 1 3 true}]
|
|
||||||
SIGSEGV: segmentation violation
|
|
||||||
PC=0x69da90 m=0 sigcode=1 addr=0x0
|
|
||||||
signal arrived during cgo execution
|
|
||||||
|
|
||||||
goroutine 1 gp=0xc0000061c0 m=0 mp=0x991ca0 [syscall, locked to thread]:
|
|
||||||
runtime.cgocall(0x5ef7f0, 0xc00002b858)
|
|
||||||
/usr/lib/go/src/runtime/cgocall.go:167 +0x4b fp=0xc00002b830 sp=0xc00002b7f8 pc=0x46a0ab
|
|
||||||
github.com/gen2brain/raylib-go/raylib._Cfunc_UpdateModelAnimation({{0x3f800000, 0x0, 0x0, 0x0, 0x0, 0x3f800000, 0x0, 0x0, 0x0, 0x0, ...}, ...}, ...)
|
|
||||||
_cgo_gotypes.go:7298 +0x45 fp=0xc00002b858 sp=0xc00002b830 pc=0x4db8c5
|
|
||||||
github.com/gen2brain/raylib-go/raylib.UpdateModelAnimation.func1(0x47731a?, 0x1000000?, 0x0)
|
|
||||||
/home/bd/.cache/go/mod/github.com/gen2brain/raylib-go/raylib@v0.0.0-20250109172833-6dbba4f81a9b/rmodels.go:613 +0x1a5 fp=0xc00002ba80 sp=0xc00002b858 pc=0x4dd265
|
|
||||||
github.com/gen2brain/raylib-go/raylib.UpdateModelAnimation({{0x3f800000, 0x0, 0x0, 0x0, 0x0, 0x3f800000, 0x0, 0x0, 0x0, 0x0, ...}, ...}, ...)
|
|
||||||
/home/bd/.cache/go/mod/github.com/gen2brain/raylib-go/raylib@v0.0.0-20250109172833-6dbba4f81a9b/rmodels.go:613 +0x25 fp=0xc00002baa8 sp=0xc00002ba80 pc=0x4dd085
|
|
||||||
gitea.boner.be/bdnugget/goonscape/game.(*Game).DrawPlayer(0xc0001a4000, 0xc0001de160, {{0x3f800000, 0x0, 0x0, 0x0, 0x0, 0x3f800000, 0x0, 0x0, ...}, ...})
|
|
||||||
/home/bd/Projects/go/goonscape/game/game.go:172 +0x2d5 fp=0xc00002bc58 sp=0xc00002baa8 pc=0x5c5c95
|
|
||||||
gitea.boner.be/bdnugget/goonscape/game.(*Game).Render(0xc0001a4000)
|
|
||||||
/home/bd/Projects/go/goonscape/game/game.go:221 +0x147 fp=0xc00002be00 sp=0xc00002bc58 pc=0x5c61e7
|
|
||||||
main.main()
|
|
||||||
/home/bd/Projects/go/goonscape/main.go:55 +0x4ac fp=0xc00002bf50 sp=0xc00002be00 pc=0x5c924c
|
|
||||||
runtime.main()
|
|
||||||
/usr/lib/go/src/runtime/proc.go:272 +0x28b fp=0xc00002bfe0 sp=0xc00002bf50 pc=0x43c42b
|
|
||||||
runtime.goexit({})
|
|
||||||
/usr/lib/go/src/runtime/asm_amd64.s:1700 +0x1 fp=0xc00002bfe8 sp=0xc00002bfe0 pc=0x4776c1
|
|
||||||
|
|
||||||
goroutine 2 gp=0xc000006c40 m=nil [force gc (idle)]:
|
|
||||||
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
|
|
||||||
/usr/lib/go/src/runtime/proc.go:424 +0xce fp=0xc000054fa8 sp=0xc000054f88 pc=0x46ff0e
|
|
||||||
runtime.goparkunlock(...)
|
|
||||||
/usr/lib/go/src/runtime/proc.go:430
|
|
||||||
runtime.forcegchelper()
|
|
||||||
/usr/lib/go/src/runtime/proc.go:337 +0xb3 fp=0xc000054fe0 sp=0xc000054fa8 pc=0x43c773
|
|
||||||
runtime.goexit({})
|
|
||||||
/usr/lib/go/src/runtime/asm_amd64.s:1700 +0x1 fp=0xc000054fe8 sp=0xc000054fe0 pc=0x4776c1
|
|
||||||
created by runtime.init.7 in goroutine 1
|
|
||||||
/usr/lib/go/src/runtime/proc.go:325 +0x1a
|
|
||||||
|
|
||||||
goroutine 3 gp=0xc000007180 m=nil [GC sweep wait]:
|
|
||||||
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
|
|
||||||
/usr/lib/go/src/runtime/proc.go:424 +0xce fp=0xc000055780 sp=0xc000055760 pc=0x46ff0e
|
|
||||||
runtime.goparkunlock(...)
|
|
||||||
/usr/lib/go/src/runtime/proc.go:430
|
|
||||||
runtime.bgsweep(0xc00007e000)
|
|
||||||
/usr/lib/go/src/runtime/mgcsweep.go:277 +0x94 fp=0xc0000557c8 sp=0xc000055780 pc=0x427394
|
|
||||||
runtime.gcenable.gowrap1()
|
|
||||||
/usr/lib/go/src/runtime/mgc.go:204 +0x25 fp=0xc0000557e0 sp=0xc0000557c8 pc=0x41baa5
|
|
||||||
runtime.goexit({})
|
|
||||||
/usr/lib/go/src/runtime/asm_amd64.s:1700 +0x1 fp=0xc0000557e8 sp=0xc0000557e0 pc=0x4776c1
|
|
||||||
created by runtime.gcenable in goroutine 1
|
|
||||||
/usr/lib/go/src/runtime/mgc.go:204 +0x66
|
|
||||||
|
|
||||||
goroutine 4 gp=0xc000007340 m=nil [GC scavenge wait]:
|
|
||||||
runtime.gopark(0xc00007e000?, 0x7b0098?, 0x1?, 0x0?, 0xc000007340?)
|
|
||||||
/usr/lib/go/src/runtime/proc.go:424 +0xce fp=0xc000055f78 sp=0xc000055f58 pc=0x46ff0e
|
|
||||||
runtime.goparkunlock(...)
|
|
||||||
/usr/lib/go/src/runtime/proc.go:430
|
|
||||||
runtime.(*scavengerState).park(0x990ee0)
|
|
||||||
/usr/lib/go/src/runtime/mgcscavenge.go:425 +0x49 fp=0xc000055fa8 sp=0xc000055f78 pc=0x424dc9
|
|
||||||
runtime.bgscavenge(0xc00007e000)
|
|
||||||
/usr/lib/go/src/runtime/mgcscavenge.go:653 +0x3c fp=0xc000055fc8 sp=0xc000055fa8 pc=0x42533c
|
|
||||||
runtime.gcenable.gowrap2()
|
|
||||||
/usr/lib/go/src/runtime/mgc.go:205 +0x25 fp=0xc000055fe0 sp=0xc000055fc8 pc=0x41ba45
|
|
||||||
runtime.goexit({})
|
|
||||||
/usr/lib/go/src/runtime/asm_amd64.s:1700 +0x1 fp=0xc000055fe8 sp=0xc000055fe0 pc=0x4776c1
|
|
||||||
created by runtime.gcenable in goroutine 1
|
|
||||||
/usr/lib/go/src/runtime/mgc.go:205 +0xa5
|
|
||||||
|
|
||||||
goroutine 5 gp=0xc000007c00 m=nil [finalizer wait]:
|
|
||||||
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
|
|
||||||
/usr/lib/go/src/runtime/proc.go:424 +0xce fp=0xc000056620 sp=0xc000056600 pc=0x46ff0e
|
|
||||||
runtime.runfinq()
|
|
||||||
/usr/lib/go/src/runtime/mfinal.go:193 +0x107 fp=0xc0000567e0 sp=0xc000056620 pc=0x41ab27
|
|
||||||
runtime.goexit({})
|
|
||||||
/usr/lib/go/src/runtime/asm_amd64.s:1700 +0x1 fp=0xc0000567e8 sp=0xc0000567e0 pc=0x4776c1
|
|
||||||
created by runtime.createfing in goroutine 1
|
|
||||||
/usr/lib/go/src/runtime/mfinal.go:163 +0x3d
|
|
||||||
|
|
||||||
goroutine 6 gp=0xc000007dc0 m=nil [chan receive]:
|
|
||||||
runtime.gopark(0x6f63a0?, 0x0?, 0x48?, 0x69?, 0x986948?)
|
|
||||||
/usr/lib/go/src/runtime/proc.go:424 +0xce fp=0xc000054718 sp=0xc0000546f8 pc=0x46ff0e
|
|
||||||
runtime.chanrecv(0xc00008a0e0, 0x0, 0x1)
|
|
||||||
/usr/lib/go/src/runtime/chan.go:639 +0x41c fp=0xc000054790 sp=0xc000054718 pc=0x40bb1c
|
|
||||||
runtime.chanrecv1(0x43c5c0?, 0xc000054776?)
|
|
||||||
/usr/lib/go/src/runtime/chan.go:489 +0x12 fp=0xc0000547b8 sp=0xc000054790 pc=0x40b6f2
|
|
||||||
runtime.unique_runtime_registerUniqueMapCleanup.func1(...)
|
|
||||||
/usr/lib/go/src/runtime/mgc.go:1781
|
|
||||||
runtime.unique_runtime_registerUniqueMapCleanup.gowrap1()
|
|
||||||
/usr/lib/go/src/runtime/mgc.go:1784 +0x2f fp=0xc0000547e0 sp=0xc0000547b8 pc=0x41eacf
|
|
||||||
runtime.goexit({})
|
|
||||||
/usr/lib/go/src/runtime/asm_amd64.s:1700 +0x1 fp=0xc0000547e8 sp=0xc0000547e0 pc=0x4776c1
|
|
||||||
created by unique.runtime_registerUniqueMapCleanup in goroutine 1
|
|
||||||
/usr/lib/go/src/runtime/mgc.go:1779 +0x96
|
|
||||||
|
|
||||||
goroutine 20 gp=0xc0001b8000 m=nil [IO wait]:
|
|
||||||
runtime.gopark(0xc0000bdad0?, 0x55fcb8?, 0x8?, 0xaa?, 0xb?)
|
|
||||||
/usr/lib/go/src/runtime/proc.go:424 +0xce fp=0xc0000bda68 sp=0xc0000bda48 pc=0x46ff0e
|
|
||||||
runtime.netpollblock(0x4b0778?, 0x408f46?, 0x0?)
|
|
||||||
/usr/lib/go/src/runtime/netpoll.go:575 +0xf7 fp=0xc0000bdaa0 sp=0xc0000bda68 pc=0x434fd7
|
|
||||||
internal/poll.runtime_pollWait(0x7094ad4a5680, 0x72)
|
|
||||||
/usr/lib/go/src/runtime/netpoll.go:351 +0x85 fp=0xc0000bdac0 sp=0xc0000bdaa0 pc=0x46f205
|
|
||||||
internal/poll.(*pollDesc).wait(0xc0001e2080?, 0xc0000d2000?, 0x0)
|
|
||||||
/usr/lib/go/src/internal/poll/fd_poll_runtime.go:84 +0x27 fp=0xc0000bdae8 sp=0xc0000bdac0 pc=0x4bf127
|
|
||||||
internal/poll.(*pollDesc).waitRead(...)
|
|
||||||
/usr/lib/go/src/internal/poll/fd_poll_runtime.go:89
|
|
||||||
internal/poll.(*FD).Read(0xc0001e2080, {0xc0000d2000, 0x1000, 0x1000})
|
|
||||||
/usr/lib/go/src/internal/poll/fd_unix.go:165 +0x27a fp=0xc0000bdb80 sp=0xc0000bdae8 pc=0x4bfa5a
|
|
||||||
net.(*netFD).Read(0xc0001e2080, {0xc0000d2000?, 0xc0000961e0?, 0x2710?})
|
|
||||||
/usr/lib/go/src/net/fd_posix.go:55 +0x25 fp=0xc0000bdbc8 sp=0xc0000bdb80 pc=0x5ae0c5
|
|
||||||
net.(*conn).Read(0xc0001b4030, {0xc0000d2000?, 0x10000000006?, 0xc0001a7b00?})
|
|
||||||
/usr/lib/go/src/net/net.go:189 +0x45 fp=0xc0000bdc10 sp=0xc0000bdbc8 pc=0x5b6345
|
|
||||||
net.(*TCPConn).Read(0x7094f4718a68?, {0xc0000d2000?, 0xedf202a1b?, 0x990e60?})
|
|
||||||
<autogenerated>:1 +0x25 fp=0xc0000bdc40 sp=0xc0000bdc10 pc=0x5c0c05
|
|
||||||
bufio.(*Reader).Read(0xc0000802a0, {0xc0001a7b0c, 0x4, 0x471809?})
|
|
||||||
/usr/lib/go/src/bufio/bufio.go:241 +0x197 fp=0xc0000bdc78 sp=0xc0000bdc40 pc=0x4d93b7
|
|
||||||
io.ReadAtLeast({0x7b2640, 0xc0000802a0}, {0xc0001a7b0c, 0x4, 0x4}, 0x4)
|
|
||||||
/usr/lib/go/src/io/io.go:335 +0x90 fp=0xc0000bdcc0 sp=0xc0000bdc78 pc=0x4aaa10
|
|
||||||
io.ReadFull(...)
|
|
||||||
/usr/lib/go/src/io/io.go:354
|
|
||||||
gitea.boner.be/bdnugget/goonscape/network.HandleServerCommunication({0x7b4bb8, 0xc0001b4030}, 0x6, 0xc0001de160, 0xc000194000, 0xc0001a0000)
|
|
||||||
/home/bd/Projects/go/goonscape/network/network.go:166 +0x412 fp=0xc0000bdfa0 sp=0xc0000bdcc0 pc=0x5c27b2
|
|
||||||
gitea.boner.be/bdnugget/goonscape/game.(*Game).Update.gowrap1()
|
|
||||||
/home/bd/Projects/go/goonscape/game/game.go:80 +0x33 fp=0xc0000bdfe0 sp=0xc0000bdfa0 pc=0x5c57d3
|
|
||||||
runtime.goexit({})
|
|
||||||
/usr/lib/go/src/runtime/asm_amd64.s:1700 +0x1 fp=0xc0000bdfe8 sp=0xc0000bdfe0 pc=0x4776c1
|
|
||||||
created by gitea.boner.be/bdnugget/goonscape/game.(*Game).Update in goroutine 1
|
|
||||||
/home/bd/Projects/go/goonscape/game/game.go:80 +0x45e
|
|
||||||
|
|
||||||
goroutine 7 gp=0xc0000c6380 m=nil [select]:
|
|
||||||
runtime.gopark(0xc000050f80?, 0x2?, 0x0?, 0x0?, 0xc000050f10?)
|
|
||||||
/usr/lib/go/src/runtime/proc.go:424 +0xce fp=0xc000050db0 sp=0xc000050d90 pc=0x46ff0e
|
|
||||||
runtime.selectgo(0xc000050f80, 0xc000050f0c, 0x0?, 0x0, 0x0?, 0x1)
|
|
||||||
/usr/lib/go/src/runtime/select.go:335 +0x7a5 fp=0xc000050ed8 sp=0xc000050db0 pc=0x44e2a5
|
|
||||||
gitea.boner.be/bdnugget/goonscape/network.HandleServerCommunication.func1()
|
|
||||||
/home/bd/Projects/go/goonscape/network/network.go:108 +0xb2 fp=0xc000050fe0 sp=0xc000050ed8 pc=0x5c3492
|
|
||||||
runtime.goexit({})
|
|
||||||
/usr/lib/go/src/runtime/asm_amd64.s:1700 +0x1 fp=0xc000050fe8 sp=0xc000050fe0 pc=0x4776c1
|
|
||||||
created by gitea.boner.be/bdnugget/goonscape/network.HandleServerCommunication in goroutine 20
|
|
||||||
/home/bd/Projects/go/goonscape/network/network.go:106 +0x3bd
|
|
||||||
|
|
||||||
rax 0x0
|
|
||||||
rbx 0x0
|
|
||||||
rcx 0x0
|
|
||||||
rdx 0x0
|
|
||||||
rdi 0x13ee9800
|
|
||||||
rsi 0xb1
|
|
||||||
rbp 0x13bd6580
|
|
||||||
rsp 0x7ffc9d661890
|
|
||||||
r8 0x140baba0
|
|
||||||
r9 0x0
|
|
||||||
r10 0x0
|
|
||||||
r11 0x0
|
|
||||||
r12 0x13bd1f20
|
|
||||||
r13 0x744e4
|
|
||||||
r14 0x4d898
|
|
||||||
r15 0x26c4c
|
|
||||||
rip 0x69da90
|
|
||||||
rflags 0x10246
|
|
||||||
cs 0x33
|
|
||||||
fs 0x0
|
|
||||||
gs 0x0
|
|
||||||
exit status 2
|
|
@ -19,33 +19,6 @@ func (p *Player) MoveTowards(target Tile, deltaTime float32, mapGrid [][]Tile) {
|
|||||||
|
|
||||||
direction := rl.Vector3Subtract(targetPos, p.PosActual)
|
direction := rl.Vector3Subtract(targetPos, p.PosActual)
|
||||||
distance := rl.Vector3Length(direction)
|
distance := rl.Vector3Length(direction)
|
||||||
|
|
||||||
if distance > 1.0 {
|
|
||||||
wasMoving := p.IsMoving
|
|
||||||
p.IsMoving = true
|
|
||||||
|
|
||||||
if !wasMoving {
|
|
||||||
p.AnimationFrame = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
oldFrame := p.AnimationFrame
|
|
||||||
p.AnimationFrame += int32(deltaTime * 60)
|
|
||||||
rl.TraceLog(rl.LogInfo, "Walk frame update: %d -> %d (delta: %f)",
|
|
||||||
oldFrame, p.AnimationFrame, deltaTime)
|
|
||||||
} else {
|
|
||||||
wasMoving := p.IsMoving
|
|
||||||
p.IsMoving = false
|
|
||||||
|
|
||||||
if wasMoving {
|
|
||||||
p.AnimationFrame = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
oldFrame := p.AnimationFrame
|
|
||||||
p.AnimationFrame += int32(deltaTime * 60)
|
|
||||||
rl.TraceLog(rl.LogInfo, "Idle frame update: %d -> %d (delta: %f)",
|
|
||||||
oldFrame, p.AnimationFrame, deltaTime)
|
|
||||||
}
|
|
||||||
|
|
||||||
if distance > 0 {
|
if distance > 0 {
|
||||||
direction = rl.Vector3Scale(direction, p.Speed*deltaTime/distance)
|
direction = rl.Vector3Scale(direction, p.Speed*deltaTime/distance)
|
||||||
}
|
}
|
||||||
@ -71,9 +44,6 @@ func NewPlayer(state *pb.PlayerState) *Player {
|
|||||||
PosTile: Tile{X: int(state.X), Y: int(state.Y)},
|
PosTile: Tile{X: int(state.X), Y: int(state.Y)},
|
||||||
Speed: 50.0,
|
Speed: 50.0,
|
||||||
ID: state.PlayerId,
|
ID: state.PlayerId,
|
||||||
IsMoving: false,
|
|
||||||
AnimationFrame: 0,
|
|
||||||
LastAnimUpdate: time.Now(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,29 +26,15 @@ type Player struct {
|
|||||||
ID int32
|
ID int32
|
||||||
CurrentTick int64
|
CurrentTick int64
|
||||||
LastUpdateTime time.Time
|
LastUpdateTime time.Time
|
||||||
LastAnimUpdate time.Time
|
|
||||||
InterpolationProgress float32
|
InterpolationProgress float32
|
||||||
UserData interface{}
|
UserData interface{}
|
||||||
FloatingMessage *FloatingMessage
|
FloatingMessage *FloatingMessage
|
||||||
QuitDone chan struct{}
|
QuitDone chan struct{}
|
||||||
AnimationFrame int32
|
|
||||||
IsMoving bool
|
|
||||||
}
|
|
||||||
|
|
||||||
type AnimationSet struct {
|
|
||||||
Idle []rl.ModelAnimation
|
|
||||||
Walk []rl.ModelAnimation
|
|
||||||
// Can add more animation types later like:
|
|
||||||
// Attack []ModelAnimation
|
|
||||||
// Jump []ModelAnimation
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ModelAsset struct {
|
type ModelAsset struct {
|
||||||
Model rl.Model
|
Model rl.Model
|
||||||
Texture rl.Texture2D
|
Texture rl.Texture2D
|
||||||
Animation []rl.ModelAnimation // Keep this for compatibility
|
|
||||||
AnimFrames int32 // Keep this for compatibility
|
|
||||||
Animations AnimationSet // New field for organized animations
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ChatMessage struct {
|
type ChatMessage struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user