I've been working on a pretty standard role-playing game for quite a while now. It's coming along nicely, but I still don't have a good solution for a major part of the game: handling large amounts of character dialogue and scripted cutscenes.

The simplest (and least-ideal) solution would be to simply make a new class for each cutscene that contains info on where the camera needs to be looking, who needs to say what, etc etc. This doesn't seem like a very good approach to me.

Another idea would be to have a bunch of XML (or something like XML) files that contain the data.

So, my question to anyone who has tackled this issue in the past: how did you do it? If you haven't done this before, what would you do in this situation?

Take a pencil and paper and write down all kinds of elements a cutscene could be made of, like text block, camera movement, sound, sprites, etc.Create classes for each type and a common super type or interface.Identify attributes of each element like text, screen positions, start time, end time, duration, sound name, event listeners for starting and stopping, etc.

Put a cutscene class together, give it a list of elements (of the element base class), a play method, timer. The cutscene does not know individual element classes.Think of the environment that cutscene elements need to know to be properly run. Pass it as parameter into the play methods.Add a timer or event listeners to step from element to element.

Then, after it works, you could think of how to compose, load and save cutscenes. But that is a different task, do not mix it up.

Games like TA:Kingdoms, if i recall correctly, used something like a custom INI file for scripted scenes and events. Xml is the rage now I suppose, but dude(?) is right. I would handle breaking up the elements and methods first, then worry about storage.

Please keep us posted as well, I am honestly a little curious myself, as I will eventually need to do something similar.

If the cut scene needs to be exact, like a movie, I'd just look into YUNPM and try to make a full movie cut scene using the normal video tools.

If it is one of those interactive cut scenes, then I'd handle it the way movie scripts are handled in code. I'd write all the dialogue for the cut scene in one XML file stating the characters as the tags. Then, I'd add the cues and camera positions to the specific points in the file where characters need to move, and the camera angle needs to change. Kind of like this code snippet...

1 2 3 4 5

<Barbera> "You can't let that kind of thing get to you!" </Barbera><Cathymovex=17movey=18></Cathy><Barberamovex=13movey=14> "He doesn't know anything..." </Barbera><Cameramovex=18movey=19movez=9rotate=0.15></Camera><CathyrotateHead=0.15> "I know he seems inconsiderate sometimes, but I can sense a change in him." </Cathy>

Disclaimer: This is a mock up example. It hasn't really been tested so don't ask what the numbers mean

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org