Looking for tips on interactive dialogue

I am in the process of converting my game to Slick and taking the opportunity to improve some of the more painful parts.

One thing that was really tough was interactive dialogue. Basically where an NPC says something and the player has 3 phrases to choose from and then the NPC will reply based on which phrase the player chose.

How I do it currently is basically a List of HashMaps of HashMaps. In other words there is a list of all possible conversations:

Player and Bob
Player and Joe,
Player and Sally
… and so on.

The conversations are HashMaps where the player’s phrase is a key to pull out the response from the npc. And then the npc’s phrase is the key to pull out the possible phrases for the player to choose from and so on and so on.

I was able to build several interactions but it is really tough adding new conversations and keeping track of which response is the key for which options and such.

Does anyone have suggestions on improving this?

Thanks.

The term for this is dialog trees.

As the name suggests the underlying structure is (usually) a tree. XML/YAML/OGDL/JSON/whatever can be used to store them. Some people use yEd to build these trees.

Thanks. yED looks promising. I just downloaded it and think it will help me keep track of the dialogues, I had been maintianing them in text files and it was hard keep all the connections straight.