Guid vs. Int

So I’m currently mucking about with creating a Deus Ex style dialog system. For those who may not be familiar with the Deus Ex dialog system, it works like this:

(It’s hard to catch the player making a choice in the conversation, but it’s there around the 20 second mark).

A conversation is usually started when a player walks up to another AI character and initiates a conversation. It then juggles between the player and the AI character, and often gives the player a set of choices of things to say which guide the conversation. Depending on what the player picks, the conversation plays out in different ways or various other scripted things happen.

What I’ve done so far is create a few classes to store the various parts of the conversation, quite similar to what tinyrocket has done here. One thing I noticed that tinyrocket has done is used Guids to keep track of individual pieces of the conversation. At first I was using integers, and was planning on assigning them when the individual nodes of the conversations were created. This has the disadvantage is that it is pretty easy to screw things up and give a conversation node an identical identifier, which would be a bad thing. Guids would prevent this problem, as it is possible to generate a unique identifier without knowing what other previous data there is. The disadvantage I am seeing with Guids is that they are much larger to work with. It’s a lot easier to say “Go to conversation node #27” as opposed to “Go to conversation node 21EC2020-3AEA-1069-A2DD-08002B30309D”. For this reason alone I am leaning toward using integers. I figure that if I code the supporting tools right, I shouldn’t have to worry about having duplicate integer ids.

One other thing that I have been thinking about is how to keep track of where the current conversation is. The other day I had a thought: create a GameScreen that is overlaid on top of whatever is already being displayed, and have it all serializable. The conversation GameScreen would keep track of what the current conversation is, and the whole conversation management system would keep track of which conversations have already been displayed and which ones are and are not visible or accessible.

I still need to do some more thinking/prototyping to see how it is all going to fit together, and I’m finding things at this stage quite interesting so hopefully I manage to produce some sort of working demo after a short while.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s