kyroschow / BasementsandAndroids

1 stars 0 forks source link

Changing the database and server architecture #6

Closed kyroschow closed 6 years ago

kyroschow commented 6 years ago

New plan: GameState on the server, JSONObject in the client. This is much more efficient, and plus we only have to store json strings in the database. Also, when we render the game we just need to read off the JSONObject. There's no point in serializing and de-serializing @hedgey579. We don't even need Klaxon. Refer to https://github.com/TheCompSciNoob/BasementsandAndroids/issues/3 for details.

alexanderberry commented 6 years ago

Noted. We can use delegated properties to "eagerly" load textures and the like that are not transmitted over the server like so:

// Eagerly loading an asset:
val wrapper = load<Texture>("test.png")
wrapper.finishLoading()
val texture = wrapper.asset

// Delegate field:
class Test(assetManager: AssetManager) {
  val texture by assetManager.load<Texture>("test.png")
  // Type of texture property is Texture.
}

(see https://github.com/libktx/ktx/tree/master/assets for more information on that)

We could also use an AssetStorage and just do it all with coroutines. Will do more research on this once I implement the game state.