anedumgottil / VR-Mazmorra

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

Convert map.txt to generate GridSpace combos instead of individual Tile/Blocks #17

Open apodgo2 opened 6 years ago

apodgo2 commented 6 years ago

Right now the map.txt generates Blocks and only Blocks according to Block ID's. This is nice and all, but it doesn't work for when we get Tiles in the game so we'll need a different flatfile format to hold those. Instead of tracking them per-block in this file I figure I'll just hardcode (for now) some block and tile combinations in the new MapGenerator. This way - in the future - MapLoader can read the new maps.txt format, figure out what kind of map it wants, tell MapGenerator to say, generate a corridor or something, then MapGenerator will go through and figure out the proper type of Block/Tile combo to create the GridSpaces to do so.

This means we can store the new maps as a matrix that directly corresponds to the GridSpace grid, as ID's that reference individual GridSpaces. And just let the MapGenerator figure out the rest. Which greatly simplifies the map storage/generation from flatfile.

It still might be nice to store the different types of GridSpaces as we currently have them as GridSpace types, so perhaps just rename the current map format into gridtypes.txt or something and refactor the MapLoader classes accordingly.

Please read the comments below for more information and also associated ticket

apodgo2 commented 6 years ago

Just gonna hardcode this for now... going to also disable the map loading in MapLoader (which might require some work to preserve the Block auto-generation we rely on right now, since we don't load Block prefabs yet) and just wing it until this is absolutely necessary

apodgo2 commented 6 years ago

From #25 :

I would like the map.txt file to be changed to a blockgridspaces.txt file, which will reflect it's existence as a list of types of GridSpaces made from Blocks. The file would then be loaded in and indexed, and instead of serially loading the GridSpaces into the world as we do now, the MapGenerator could then use said indices to build the map in parts (rooms, corridors, etc). We call it blockgridspaces instead of just GridSpaces since we will also have a tilegridspaces.txt which will have a list of indices for the arrangement of tile prefabs. Creation of GridSpaces would be easier with some sort of external tool, perhaps we should open a ticket for that. For now you can just write them with the text file and keys provided.

apodgo2 commented 6 years ago

Once the MapLoader pulls in the prefabs of Tiles/Blocks, attaches them to a Tile/Block object, and then configures GridSpaces out of said GridObjects according to blockgridspaces.txt and tilegridspaces.txt the MapLoader should then store these GridSpaces by index in an object pool : see #24

apodgo2 commented 6 years ago

Commit e8c18d897752605d524bd3a61cd2f819c9773ea9 has completely moved the MapGenerator over to the new XML defined GridSpace configuration IDs. It's only a trivial matter to make this work for Block based ConfigIDs as well, but I'm not prioritizing this because it's not extremely necessary right now.

So this is basically complete. Just needs to migrate map.txt to a blockgridspace.xml file.