samoen / samsgame Goto Github PK
View Code? Open in Web Editor NEWReal time PVP in a big world
Real time PVP in a big world
If you try to run client from an incorrect directory, you get a panic (SIGSEGV), because the various images in gamecore/weaponRenderSystem.go cannot be found and are thus initialized to nil
.
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x565cab]
goroutine 9 [running]:
github.com/hajimehoshi/ebiten.(*Image).isDisposed(...)
/home/makoto/go/pkg/mod/github.com/hajimehoshi/[email protected]/image.go:57
github.com/hajimehoshi/ebiten.(*Image).DrawImage(0xc000028c80, 0x0, 0xc0001dba18, 0xc000302380, 0x4423d0)
/home/makoto/go/pkg/mod/github.com/hajimehoshi/[email protected]/image.go:135 +0x4b
mahgame/gamecore.drawBackground(0xc000028c80)
/home/makoto/Documents/samsgame/gamecore/weaponRenderSystem.go:110 +0x1d4
mahgame/gamecore.(*SamGame).Draw(0xb4cd70, 0xc000028c80)
/home/makoto/Documents/samsgame/gamecore/entities.go:93 +0x32
github.com/hajimehoshi/ebiten.(*imageDumperGameWithDraw).Draw(0xc00007fa10, 0xc000028c80)
/home/makoto/go/pkg/mod/github.com/hajimehoshi/[email protected]/run.go:230 +0x70
github.com/hajimehoshi/ebiten.(*uiContext).update(0xb008e0, 0xc0001b4420, 0x0, 0x0)
/home/makoto/go/pkg/mod/github.com/hajimehoshi/[email protected]/uicontext.go:274 +0x255
github.com/hajimehoshi/ebiten.(*uiContext).Update(0xb008e0, 0xc0001b4420, 0x876d20, 0xb008e0)
/home/makoto/go/pkg/mod/github.com/hajimehoshi/[email protected]/uicontext.go:239 +0xb4
github.com/hajimehoshi/ebiten/internal/uidriver/glfw.(*UserInterface).update(0xac24e0, 0x876d20, 0xb008e0, 0x415e6c, 0xb4ccd0)
/home/makoto/go/pkg/mod/github.com/hajimehoshi/[email protected]/internal/uidriver/glfw/ui.go:810 +0x2dc
github.com/hajimehoshi/ebiten/internal/uidriver/glfw.(*UserInterface).loop(0xac24e0, 0x876d20, 0xb008e0, 0x0, 0x0)
/home/makoto/go/pkg/mod/github.com/hajimehoshi/[email protected]/internal/uidriver/glfw/ui.go:856 +0xe5
github.com/hajimehoshi/ebiten/internal/uidriver/glfw.(*UserInterface).run(0xac24e0, 0x876d20, 0xb008e0, 0x0, 0x0)
/home/makoto/go/pkg/mod/github.com/hajimehoshi/[email protected]/internal/uidriver/glfw/ui.go:728 +0x2fe
github.com/hajimehoshi/ebiten/internal/uidriver/glfw.(*UserInterface).Run.func1(0xc000012e20, 0xc00006a720, 0xac24e0, 0x876d20, 0xb008e0)
/home/makoto/go/pkg/mod/github.com/hajimehoshi/[email protected]/internal/uidriver/glfw/ui.go:565 +0x85
created by github.com/hajimehoshi/ebiten/internal/uidriver/glfw.(*UserInterface).Run
/home/makoto/go/pkg/mod/github.com/hajimehoshi/[email protected]/internal/uidriver/glfw/ui.go:562 +0x181
exit status 2
Because of this, I propose that we make a type Assets struct{}
and a func NewAssets(assetsDir string) (*Assets, error)
. This way, we can avoid making globals, and ensure that we are handling errors correctly.
I would like to create a PR for this, but I wanted to get your opinions on this.
Should I go to /server and go run .
, then cd to /client and go run .
?
go version
go version go1.11.6 linux/amd64
go run .
package mahgame: unknown import path "mahgame": cannot find module providing package mahgame
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.