Convert Atlas to infinite lazy growth

The atlas will now expand as needed for any query, but only initialise the chunk tile memory when requested

	While this may still be a pre-mature optimisation, it does simplify some code and ensures that our memory footprint stays small, for the most part
This commit is contained in:
Marc Di Luzio 2020-06-27 14:48:21 +01:00
parent 2556c0d049
commit b116cdf291
6 changed files with 186 additions and 337 deletions

View file

@ -83,6 +83,7 @@ func NewServer(opts ...ServerOption) *Server {
address: "",
persistence: EphemeralData,
schedule: cron.New(),
world: game.NewWorld(16),
}
// Apply all options
@ -90,9 +91,6 @@ func NewServer(opts ...ServerOption) *Server {
o(s)
}
// Start small, we can grow the world later
s.world = game.NewWorld(4, 8)
return s
}
@ -114,11 +112,6 @@ func (s *Server) Initialise(fillWorld bool) (err error) {
}
s.accountant = accounts.NewAccountantClient(s.clientConn)
// Spawn a border on the default world
if err := s.world.SpawnWorld(fillWorld); err != nil {
return err
}
// Load the world file
if err := s.LoadWorld(); err != nil {
return err