anedumgottil / VR-Mazmorra

Procedurally generated VR Dungeon
Apache License 2.0
1 stars 0 forks source link

MapLoader should pool all prefabs and generated objects #24

Open apodgo2 opened 6 years ago

apodgo2 commented 6 years ago

MapLoader is the authoritative source for all GameObjects loaded into the world, and it takes care of loading all of the pre-generated GameObjects from disk at the start of the game. So it'll need to pool these so we can print off instances. We already sort of do this with List's, but it can be done in a better way (perhaps using the Object Pooling asset we currently have called LeanPool) and it needs to preserve the indices of these pooled objects between launches (for example, a Tile with index 5 should always have index 5 on every launch, ideally regardless of it's actual filename, but failing that, regardless of the ordering of the files in the Assets folder)

It should take care of pooling the entities using the same system, and categorize all of these so we can easily spawn them with the MapGenerator.

Similar to Issue #23 but larger scope.

We need the MapLoader to search for all assets we have as .prefab files and drag them in, and then pool them so that we can create instances from them at runtime, instead of having to arrange our GameObjects in the scene using the Unity Editor. For now, the arrangement of objects in the scene is created by the MapGenerator, which just has a few functions to generate certain areas of the map automatically.

apodgo2 commented 6 years ago

Not really noticing a ton of performance issues, Unity seems to be instancing things really intelligently, so this is being pushed to the back burner until I can find a good reason not to use the simple "Lists of parent object templates in the MapLoader" setup we currently have going.