|
|
|
@ -15,24 +15,24 @@ import (
|
|
|
|
|
// ways (json POSTed to server, config file, constants) and are typically owned
|
|
|
|
|
// by a Controller.
|
|
|
|
|
type Config struct {
|
|
|
|
|
Tick int `json:"tick"` // ms
|
|
|
|
|
Timescale float32 `json:"timescale"`
|
|
|
|
|
Delta float32 `json:"delta"`
|
|
|
|
|
Width int `json:"width"`
|
|
|
|
|
Height int `json:"height"`
|
|
|
|
|
Obstacles int `json:"obstacles"`
|
|
|
|
|
MaxPoints int `json:"max_points"`
|
|
|
|
|
Mode string `json:"mode"`
|
|
|
|
|
Tick int `json:"tick"` // ms
|
|
|
|
|
Timescale float32 `json:"timescale"`
|
|
|
|
|
Delta float32 `json:"delta"`
|
|
|
|
|
Width int `json:"width"`
|
|
|
|
|
Height int `json:"height"`
|
|
|
|
|
ObstacleCount int `json:"obstacle_count"`
|
|
|
|
|
MaxPoints int `json:"max_points"`
|
|
|
|
|
Mode string `json:"mode"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
TICK = 60 // ms, this is how often physics is updated
|
|
|
|
|
TIMESCALE = 1.0 // this tweaks the temporal duration of a TICK
|
|
|
|
|
WIDTH = 800
|
|
|
|
|
HEIGHT = 550
|
|
|
|
|
OBSTACLES = 10
|
|
|
|
|
MAX_POINTS = 500 // allowing for 50 pts in every category
|
|
|
|
|
DEFAULT_MODE = "deathmatch"
|
|
|
|
|
TICK = 60 // ms, this is how often physics is updated
|
|
|
|
|
TIMESCALE = 1.0 // this tweaks the temporal duration of a TICK
|
|
|
|
|
WIDTH = 800
|
|
|
|
|
HEIGHT = 550
|
|
|
|
|
OBSTACLE_COUNT = 5
|
|
|
|
|
MAX_POINTS = 500 // allowing for 50 pts in every category
|
|
|
|
|
DEFAULT_MODE = "deathmatch"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// LoadConfig takes the location of a json file that contains values desired to
|
|
|
|
@ -41,13 +41,13 @@ const (
|
|
|
|
|
// followed by constants defined above.
|
|
|
|
|
func LoadConfig(filename string) (Config, error) {
|
|
|
|
|
c := Config{
|
|
|
|
|
Tick: TICK,
|
|
|
|
|
Timescale: TIMESCALE,
|
|
|
|
|
Width: WIDTH,
|
|
|
|
|
Height: HEIGHT,
|
|
|
|
|
Obstacles: OBSTACLES,
|
|
|
|
|
MaxPoints: MAX_POINTS,
|
|
|
|
|
Mode: DEFAULT_MODE,
|
|
|
|
|
Tick: TICK,
|
|
|
|
|
Timescale: TIMESCALE,
|
|
|
|
|
Width: WIDTH,
|
|
|
|
|
Height: HEIGHT,
|
|
|
|
|
ObstacleCount: OBSTACLE_COUNT,
|
|
|
|
|
MaxPoints: MAX_POINTS,
|
|
|
|
|
Mode: DEFAULT_MODE,
|
|
|
|
|
}
|
|
|
|
|
u, err := user.Current()
|
|
|
|
|
if err != nil {
|
|
|
|
|