• 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
stein102

Quest scripting for 2D RPG

4 posts in this topic

Hey there, I've been working on a 2D RPG using Java and the LibGDX framework. I have a working quest system right now using XML for quest data but it seems to be fairly inflexible and I want to have more flexibility in my game. I've seen a lot about using scripting langauges such as lua or Python for quest scripting. So I have a few questions.

 

1) How should one scructure a script that describes a quest? For example say you need to collect 10 of some Item and return to a specific NPC to complete the quest. After completion you get some reward.

 

2) What are the pros/cons of using LuaJ/Jython? I'm not familiar with either language so I have no bias towards either of them.

 

3) How difficult would it be for a script to interact with a java object, call Java methods, etc?

 

Any suggestions or links to references would be greatly apprecated.

Thanks.

0

Share this post


Link to post
Share on other sites

Silly question, but if a libGDX project is compiled to Java, or Android *.apk, or html 5 Javascript, or robovm Java for iOS, then trying to call an embedded scripting language isn't going to work, right?  I would think trying to integrate a scripting language would be more trouble than it is worth.

Edited by Glass_Knife
-1

Share this post


Link to post
Share on other sites

Typically you want to keep things as data-driven as possible. That is, use an actual scripting language very sparingly. A quest can be comprised of a series of steps, with each step having some requirements to complete, and then a reward. More complex games might need more intricacy here, but the gist remains the same. You might allow calling out to a script here or there for some pieces of this, but again, do so as rarely as possible.

The advantage of being data-driven is that you can build a nice GUI for churning out quests. You can also write tools that analyze quests to ensure they're completable, tell you an estimate of the difficulty/reward ratio, and so on. Roughly something like:
 

<quest name="Save the Place">
  <stage id="get_key" name="Get the Key">
    <requirements>
      <talk npc="gatekeeper" />
    </requirements>
    <results>
      <acquire item="red_key" />
      <experience amount="100" />
    </results>
  </stage>
  <stage id="enter" name="Enter the Place">
    <prerequisite>
      <complete stage="get_key" />
    </prerequisite>
    <requirements>
      <arrive area="the_place" />
      <unlock door="gate" />
    </requirements>
    <results>
      <experience amount="100" />
    </results>
  </stage>
  <stage id="cleanse" name="Kill the Dudes">
    <prerequisite>
      <complete stage="enter" />
    </prerequisite>
    <requirements>
      <kill enemy="dude" number="10" area="the_place" />
    </requirements>
    <results>
      <experience amount="500" />
    </results>
  </stage>
  <stage name="Report Success">
    <prerequisite>
      <complete stage="cleanse" />
    </prerequisite>
    <requirements>
      <talk npc="gatekeeper" />
    </requirements>
    <results>
      <experience amount="2000" />
      <acquire item="cool_sword" />
    </results>
  </stage>
</quest>
There'd likely be a bit more to it in a real example. You can allow scripting to offer new types of prerequisites, requirements, or results, but that script should be separated from the data; the script is an implementation detail of how quests work, not a fundemantal piece of logic to the quest itself. The data still defines the outline of what goes on.

You can allow stages to be optional, allow both OR and AND requirements (so you either need to do A or B, not both), integrate more tightly with your dialog system, control spawning/instancing, and so on.

The system allows both easy editing in a GUI, should you choose to build one, and naturally maps to in-game displays. The game might have some little quest marker on the screen (or in the game journal) that looks something like:
 
(X) Get the Key
(X) Enter the Place
( ) Kill the Dudes (4/10)
Stages could also set item id's as quest items (so an item is a quest item only while the quest is active), set a target location/enemy for directional indicators, etc. All data-driven with not a single extra line of code needing to be written for each quest.

 

 

Okay, I see what you're saying. I'll stick with XML in that case.

 

So what I could do after that is parse the XML and create an instance of Quest for each quest. Additionally I could create a list or even a stack of Stages that get added to the quest. Sound decent?

 

But yes, I was actually playing on building a GUI for editing the quests :)

 

Thanks for the suggestions.

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