• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
AndreaTucci

NPC dialogues : file or script?

10 posts in this topic

I'm developing an action rpg with some friends. I would like to know the differences and pros/cons of making NPC's dialogue using a file in xml format instead of using a script. I see that script method is often used by game developers for NPC's text, but is it better then a xml file? We've thought that a xml file with tags like [text1] [text2] etc is perfect for NPC's text and also for possible quests to give the player. So what are the differences between this two methods? Is a script suitable for this aim? Thanks
0

Share this post


Link to post
Share on other sites
What do you define as a "script" in this case? I don't really see any difference between what you're calling a script and an XML description of a conversation tree, except possibly formatting and markup. Use whatever you prefer.
1

Share this post


Link to post
Share on other sites
Depends. If the dialogue is determined upon some previous logic or if the dialogue results in some arbitrary logic, then you would probably need to call some code within your project. Thus a script would probably be better.
On the other hand, if the dialogue is premeditated and always the same depending on some set actions, then a static file would be better.

But as ApochPiQ mentioned, the way you mention "script" is a bit different than what I'm thinking of. When I think of scripting, I think of LUA being integrated with a C++ project for example. A script would of course work, but in your case, I believe a standard XML file will suffice. Edited by french_hustler
1

Share this post


Link to post
Share on other sites
Yes, i mean Lua scripting for example (integrating with java/c++). The dialogue is always the same, the only "logic" operation is for the quests that NPC could give to the player: npc have to know all the completed quests for choosing which quest he can offer to the player! Edited by AndreaTux
0

Share this post


Link to post
Share on other sites
[quote name='AndreaTux' timestamp='1344281171' post='4966769']
Yes, i mean Lua scripting for example (integrating with java/c++). The dialogue is always the same, the only "logic" operation is for the quests that NPC could give to the player: npc have to know all the completed quests for choosing which quest he can offer to the player!
[/quote]

It could still be done without a script but it will greatly diminish flexibility. It'll also make it much harder to expand of tweak in the future. But if the behavior is set (which it looks like it is at the moment), I would do it the easy way first, and that would be with a static file, handling the set logic in code.
1

Share this post


Link to post
Share on other sites
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!
0

Share this post


Link to post
Share on other sites
[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!
[/quote]

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.
2

Share this post


Link to post
Share on other sites
What about a little of both? XML stores the actual strings and gives them names (i.e. <string id="hello">Hello, <var ref="playerName" />!</string>) and a scripting language allows you to conditionally display the strings by ID and change player state based on the selected responses and other conditions.
0

Share this post


Link to post
Share on other sites
[quote name='laztrezort' timestamp='1344288358' post='4966822']
[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!
[/quote]

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!
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0