NPC dialogues : file or script?

Started by
9 comments, last by AndreaTucci 11 years, 8 months ago

[quote name='AndreaTux' timestamp='1344287105' post='4966811']
I would like to see an example in which writing a script is required (in lua for example), because I didn't found anything on the web..Most of examples I've read are writable in a simple XML format file! So when is suggested using scripting language? Ok, when the behaviour isn't static like NPC dialogue, but I can't figure that kind of situation!


You could store flags and/or condition keys with the XML file, so that certain dialog node is only produced if the attached flag/condition is true. You can also store "magic" attributes to do hardcoded actions, such as "Open Store" or "Give Key to Dungeon". You can insert special embedded strings into the dialog to control things such as "Pause Here" or "Ask for yes/no".

At some point, however, you will realize that you are basically re-inventing a scripting language, as the list of attributes and magic keys and embedded codes grows. Animations, taking player items, healing the player, etc. You may find that your design has become brittle, in that you now have to go back to the source code to change & add dialog logic, do a full re-compile etc to test.

At his point, it may be worth looking into leveraging full scripting, where all of the dialog logic is isolated into seperate scripts. These scripts can be modified (sometimes during runtime!) during testing & debugging without having to change the main source code.

The tradeoff is the complexity of adding the scripting support, which isn't exactly trivial.

If you haven't already, plan out exactly what the extant of and logic of your dialog will be. From your OP, if that is the extent of your dialog system, then it looks like you can just implement [Condition Flag][Dialog Node] nodes in a data file and call it day.
[/quote]

Thank you, now it's clear!
@Firestryke31 it seems interesting, but I think doing controls and logic operations in java with an XML class handler is quick and easier!
AndreaTux~

This topic is closed to new replies.

Advertisement