Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(1 edit)

That'd be great ! 

Otherwise, once the level is generated, Can I have a way to know what tile was used in a specific position ? (x=1 y=3 for example)

That way, I could write a tool that use the output of Edgar to place the 3D model somewhat "on-top" of the generated 2D level.

All I'd have to do is provide a basic 2D tilemap, and depending on the level I want to generate, provide differents 3D prefab.

That way It'd be forward compatible ?


Edit : while rereading your answer, it seems we are on the same page. If I got it right, I only proposed to still use a 2D tilemap to let Edgar "do his thing", then output via a custom post-processing logic. Am I understanding it correctly ?

Yeah, that should be possible, too.

The generator doesn't use any special data structure to store the generated level. Everything is done with built-in Unity tilemaps (https://docs.unity3d.com/Manual/class-Tilemap.html).  So if you get the instance of the Tilemap class, you can call the GetTile method to see which tile is used in a specific position. 

Example usage:
1. Define room templates as usual using 2d tilemaps
2. Let the generator create a 2d level
3. Create a post-processing script that gets access to the output tilemaps of the generator
4. Go through individual tiles in the output tilemaps and spawn corresponding 3d tiles
5. Do some cleanup (hide original 2d level, etc.)

This approach would be very close to the normal approach, just enhanced with a custom post-processing logic. One theoretical problem with this approach is its performance. The generator will compute things that are meant for 2d levels and you would then discard them and replace them with a 3d level. You should definitely avoid doing one thing - recomputing 2d colliders for the output tilemaps (assuming that you don't want them).  This is probably the most computationally demanding step. To avoid doing that, make sure that when creating room templates, you don't use any tilemap layer with colliders (https://ondrejnepozitek.github.io/Edgar-Unity/docs/basics/room-templates#designi...). Also, custom tilemap layers handlers might be useful (https://ondrejnepozitek.github.io/Edgar-Unity/docs/guides/room-template-customiz...).

Thank you for the thorough answer.

So, I bought it, I'll try to test this solution in a few days, i'll be sure to come back to you with my findings :)

Let me know if you have any problems or questions!

(1 edit) (+1)

I do actually ! 
I worked my way into the tilemap > 3D models on a grid.

What I don't seem to grasp is : how do I get the tilemap from Edgar ? 

I know it will be obvious when you'll say it, but, can you give me some pointers ? 

Thanks !

EDIT : nevermind, I found it !

I thought that, as var tilemaps = level.GetSharedTilemaps() gave me a list of six, it wasn't that. 

But the six elements are the layers used in the room templates, duh.

Will report back when I have a complete working solution.