How to handle Dialogue Text for NPC and Quest [Java]

Started by
1 comment, last by Nicholas Kong 10 years, 3 months ago

Code is in Java. The project is a small scale single player role playing game for PC.

How to handle Dialogue Text for NPC and Quest? Are dialogue for NPC and Quest handled differently?

At the moment, this is how it is currently handled. Text is passed through as a parameter during the creation of NPC and Soldier object.

For map screen 0 of the game (0 being the first map of the game)


public Screen0(double x, double y) {
super(x, y);
// TODO Auto-generated constructor stub
anim = new Animation(animations); 
String text = "My cat is in danger! Please I need your help!";
soldier = new NPC(new Soldier(getWidth() - (getWidth() * .66)  , (getHeight() - (getHeight() * 1.2))  ),text);
}

Screen 1(1 is the second map of the game)


public Screen1(double x, double y) {
super(x, y);
// TODO Auto-generated constructor stub
anim = new Animation(animations); 
String text = "I'm in need of limber. ";
soldier = new NPC(new Soldier(getWidth() - (getWidth() * 1.5)  , (getHeight() - (getHeight() * 1.2))  ), text);
}
Advertisement

Dialogues and quests are not the same. Although quests are often given in the course of a conversation, but they may also come from reading bulletins in a town, or materialize as sub-quest when executing a main quest, or … whatever. As such, a quest is a job to be done, has a current state, has conditions which denotes its success (goal of the quest), perhaps also conditions denoting its final fail, defines a reward, and perhaps other things that doesn't came to my mind at the moment. On the other hand a dialogue is a piece of conversation, may transport just facts which must be known by the player, or is simply garnishment for the game, perhaps some needless gossip. Conversation needs to be tracked, too, and hence also has a kind of state.

Thinking that dialog and/or quests are just text is wrong. Text is an auxiliary form of expression for both, nothing less but also nothing more.

BTW: Maps should be data, perhaps each one owned by an instance of Map, but not own derived classes! The same is true for dialogue and quests and anything else that counts to the assets of the game.

Thanks for the reply.

This topic is closed to new replies.

Advertisement