mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-04-18 18:26:42 +00:00
1. Database is now iteratively updated, rather than dropped and recreated every time the universe is saved. 2. A single connection to the database is opened at server creation time, and used throughout. 3. Worlds, users and server information are now stored with appropriate IDs, so that they can be suitably updated. The world ID can be computed from world coordinates alone. 4. After saving, a world is unloaded from memory if it doesn't contain any updatable objects, and if all of its neighbours are either: (i) uncharted; (ii) not loaded in memory; (iii) without any updatable objects. This ensures that world unloading/reloading cannot be spammed by a single bot repeatedly transitioning in/out of an otherwise empty world. 5. The instance method GameUniverse.getWorld(int,int,boolean) first checks the world with given coordinates is in memory, then tries to load it from database, and only then creates a new one (if required by the boolean flag). 6. Worlds are now stored in a Hashtable indexed by world ID, for faster retrieval.