You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package gameServer
|
|
|
|
|
|
|
|
import (
|
|
|
|
"daydev.org/shipsgs/internal/config"
|
|
|
|
"daydev.org/shipsgs/internal/player"
|
|
|
|
"daydev.org/shipsgs/internal/utils"
|
|
|
|
)
|
|
|
|
|
|
|
|
type GameServer struct {
|
|
|
|
Logger *utils.Logger
|
|
|
|
Config *config.S_Config
|
|
|
|
|
|
|
|
maxLobbies int
|
|
|
|
currentLobbies int
|
|
|
|
|
|
|
|
maxPlayers int
|
|
|
|
currentPlayers int
|
|
|
|
|
|
|
|
// Channel to register players and their connection
|
|
|
|
join chan *player.Player
|
|
|
|
|
|
|
|
// Storing connected Players
|
|
|
|
playerConns map[*player.Player]bool
|
|
|
|
|
|
|
|
// Channel to un register players
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *GameServer) Init(logger *utils.Logger, config *config.S_Config) {
|
|
|
|
m.Logger = logger
|
|
|
|
m.Config = config
|
|
|
|
|
|
|
|
m.maxLobbies = m.Config.MaxLobbies
|
|
|
|
m.maxPlayers = m.Config.MaxPlayers
|
|
|
|
|
|
|
|
m.currentLobbies = 0
|
|
|
|
m.currentPlayers = 0
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *GameServer) Update() {
|
|
|
|
//p := <-m.join
|
|
|
|
|
|
|
|
// If room doesnt exist, spawn it, name it
|
|
|
|
//Add a player to a room
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *GameServer) Scheduled1S() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *GameServer) Scheduled10S() {
|
|
|
|
|
|
|
|
}
|