BenPyton/ProceduralDungeon

set rooms and objectives.

Closed this issue · 3 comments

hello, new to the plugin but so far its great ! but I cant wrap my mind around how I would add something like a door that requires keys. and guaranteeing there's a room, or maybe even multiple rooms that spawns with an item I can collect in order to open the locked door. or similar objectives like such. perhaps I have a quest that needs to guarantee a certain room spawn in the dungeon.

Hi @GamesAndBacon

I would add something like a door that requires keys. and guaranteeing there's a room

EDIT: my comment here is only if you want to check a valid path between the player and the key, without being blocked by the locked room. If you don't have this requirement then see my next comment below instead.

Sadly, there is currently no way in pure blueprint to do it...
You have to modify the C++ code of the plugin in order to do what you want.

I have planned in a future release to add this kind of feature in blueprint too.

The ADungeonGenerator cpp class contains a graph of the rooms (URoom classes that are not accessible via blueprint).
Thus, it is possible to do what you want by using some A* algorithm (there is actually in DungeonGenerator.cpp file a function called TraverseRooms which is close to do a general A*, it is just missing some little changes to be able to discard early the room nodes).

So, I will add this feature in a near future, but you could do it yourself now in cpp only if you want.

Best.

@GamesAndBacon

I have a quest that needs to guarantee a certain room spawn in the dungeon.

This can be done easily with the plugin.
You just have to add the room spawn in your generation rules (in the ChooseNextRoom function) if the player has the quest active.
And you check in the IsValidDungeon function if both the player has the quest and the room is spawned in the dungeon, else you return false to regenerate a dungeon.

Feature added in the plugin version 3.0.0