I want to generate missions out of more or less predefined smaller chunks. Example mission structure:
Mission type: Rescue
- Travel through forest
- Gather intel
- Choice:
- Sneak into castle (if it fails, switch to fight)
- Fight your way into castle
- Use clever disguise (if entry method available for castle and it was discovered in 2)
- Rescue princess
The travel block is generic and could be applied to a number of different landscapes, giving different random encounters or events. Same goes for other types of blocks, the castle could be replaced with another building/location, the princess could be someone else etc.
As the example hints I want to do some more advanced things than just randomly link up a few mission chunks:
- Show expected mission layout to the player before accepting it
- Have optional blocks or choice between different blocks
- Change mission layout during the mission: "the princess is in another castle" = add one more travel block and one enter + rescue block
- Be able to increase variety later by adding additional objects like more location types
- Be able to inject special story blocks into the dynamic missions that will always happen eventually
Part of the strategy element in the game is choosing which missions you accept so a lot of them will be discarded and there must be enough variation to make this choice meaningful. You might be badly equipped for forest encounters, but well equipped for sneaking into castles. And rescuing a princess is high-reward so the mission could be worth taking - this is the kind of decision I want the player to make.
I could probably just code this together in a way that works for now, randomizing a mission type, starting with the end block and work backwards from there to the start block. There will be some dependencies, like available location types depending on terrain type or available block types depending on the overall mission type. This seems like the hard part, figuring out what needs to depend on what and where to start from.
Other dependencies that come into play are:
- Some missions types not becoming available until later in the story, easy to handle
- Overworld location does not have much effect on the abstract "map" generated by a mission, except that some terrain types will be more common depending on where you are
- Player may have access to various means of transport that will impact mainly the travel blocks
- Factions exist and are somewhat tied to terrain, like elves in forest
- If game world has a war between two faction I may want to spawn more combat missions against one or both of them depending on player allegiance
So do I generate elven enemies because I generated forest terrain first or do I change around my mission generation logic to look at target factions before terrain? (just an example of the kind of compromise I need to deal with).
Another model I considered but is not very keen on is having predefined fixed templates of missions to fill with blocks of appropriate types. I feel this could have me doing too much work the RNG could do for me instead and I might also have to consider template to mission type relationships.
My question is basically: Is there a strategy that would help me achieve this kind of mission generation in a relatively clean and maintainable way? A similar situation from your game that you can share lessons learned from?
Maybe there is not a perfect solution, but there are likely more or less good ways the problem can be approached in.
Game is a turn-based RPG/strategy game with OO design, but I don't think the details have a major impact for the concept I ask about. My object relationships are not set in stone yet. I think the dynamic mission-generation is a key factor in the game and if I find a good way to deal with that I may very well adapt other parts to work well with that model.