Add the concept of a player and the /register endpoint
This commit is contained in:
parent
8c4bf4f75f
commit
eccb726f74
11 changed files with 129 additions and 36 deletions
|
@ -1,5 +1,7 @@
|
|||
package rovegame
|
||||
|
||||
import "github.com/google/uuid"
|
||||
|
||||
// World describes a self contained universe and everything in it
|
||||
type World struct {
|
||||
instances []Instance
|
||||
|
@ -7,7 +9,7 @@ type World struct {
|
|||
|
||||
// Instance describes a single entity or instance of an entity in the world
|
||||
type Instance struct {
|
||||
id int
|
||||
id uuid.UUID
|
||||
}
|
||||
|
||||
// NewWorld creates a new world object
|
||||
|
@ -16,9 +18,8 @@ func NewWorld() *World {
|
|||
}
|
||||
|
||||
// Adds an instance to the game
|
||||
func (w *World) CreateInstance() int {
|
||||
// Simple ID to start with
|
||||
id := len(w.instances)
|
||||
func (w *World) CreateInstance() uuid.UUID {
|
||||
id := uuid.New()
|
||||
|
||||
// Initialise the instance
|
||||
instance := Instance{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue