Editor - Handling dialogues and scenes

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
megalukes
Citizen
Posts: 94
Joined: Fri Jun 27, 2014 11:29 pm
Location: Brazil

Editor - Handling dialogues and scenes

Post by megalukes »

So, I've been developing an event editor for my game. It's an action game like Zelda meets Portal. I'm using Tiled to generate the maps, but since Tiled just do map stuff, I decided to develop my own editor that will handle objects and events.

During the process I realized how easy is to make a simple platformer instead of a simple action RPG. You need to handle dialogues, movement, event sequences. It's hell. I mean, this current project is not that big, but I'm having a lot of trouble already.

Did you guys ever tried to develop your own object/event editor? Or maybe what kind of tools do you use in your action/rpg games? I believe this is and interesting subject to discuss about.

Some screens below. Since it's not for general use it may look a little bit confusing because it has only what it needs to have.
editor 1.png
editor 1.png (26.44 KiB) Viewed 3899 times
editor 2.png
editor 2.png (48.58 KiB) Viewed 3899 times
editor 3.png
editor 3.png (42.08 KiB) Viewed 3899 times
User avatar
artofwork
Citizen
Posts: 91
Joined: Mon Sep 15, 2014 1:17 am
Location: East Coast USA

Re: Editor - Handling dialogues and scenes

Post by artofwork »

I built a map editor its not as pretty as your event editor tho :p
Muris
Party member
Posts: 131
Joined: Fri May 23, 2014 9:18 am

Re: Editor - Handling dialogues and scenes

Post by Muris »

I figured I'd open some conversation with some random things that I have been thinking on how I would approach this scripting thing. It might be terrible idea but oh wells.

I have tried to do some dialogue editors a couple of time, but usually they have become pretty bad. I would assume that lua would be a language where handling scripts would be almost easier to use just plain lua. Also I once thought that best way to handle a dialogue would be using xml, until I realised that with lua you can pretty much just write it plain and simple. Sometimes I just find that doing things simple aka writing plain lua does more than trying to over-engineer things. For example lets just say...

Code: Select all

-- scripts.lua
local texts = require( "lang/".. GLOBALS.language .. "/texts.lua" )

function script01_intro()
   setBG(intro1)
   printScrollingText(texts.intro.main1)
   fadeOut(10)
   fadeIn( 5, setBG(intro2) )
   fadeOut(10)
   showDialog( { text = texts.intro.convo1, face = "happyFace", character = hero } )
   showDialog( { text = texts.intro.convo2, face = "surprisedFace", character = heroine } )
end

function script108_oldMan()
   if( GLOBALS.state.hasDrink )
      showDialog( { text = texts.oldMan.hasDrink1, face = "happyFace", character = GLOBALS.characters.merlin } )
      GLOBALS.characters.merlin.name = getNameInput()
      party:addMember( GLOBALS.characters.merlin ) -- shows box: "Merlin joins the party!
      showDialog( { text = texts.oldMan.hasDrink2, face = "happyFace", character = GLOBALS.characters.merlin } )
      GLOBALS.state.merlinFound = true
   else -- no drink found
      showDialog( { text = texts.oldMan.noDrink, face = "sadFace", character = GLOBALS.characters.merlin } )
   end
end

function script204_guard()
   if showChoises( question, { texts.guard.choice1, texts.guard.choice2, texts.guard.choice3 }, true --[[ shuffle answers ]] ) == texts.guard.choice3 then
      showDialog( { text = texts.oldMan.rightAnswer, face = "amazedFace", character = GLOBALS.characters.guard } )
      script205_thePubIntro()      
   else
      showDialog( { text = texts.oldMan.wrongAnswer, face = "angryFace", character = GLOBALS.characters.guard } )
   end
end
-- lang/en/texts.lua
return  {
   intro = { 
      main1 = "Since the beginning of times there has always been a fight between the angels and the devils. Many have forgotten all these battles that once plagued the people of Randonia. People have now gotten used to the peace the Randonia has, although there might be some small skirmishes between the different nations, there has yet been anything measuring the rampage from the battle between the gods......",

      convo1 = "Hey %%HERO%%, wake up!",
      convo2 = "Yawn... Huh... its you %%HEROINE%%. I just had a dream about you and it was the most bizarre one I've had. All those good and evil fighting."
   }
   oldMan = {
      noDrink = "Aww, I really need some drink in here, but I lost all my money...",
      hasDrink1 = "Oohhhh! You're offering that for me? My name is:", 
      hasDrink2 = "%%MERLIN%%. You look like some good lads there, if you follow me I'll show you something that you might consider interesting!"
   }
   guard = {
      question = "Say the password!",
      choise1 = "What password?",
      choise2 = "Bird",
      choise3 = "password?",
      rightAnswer = "Hah you knew the 'password', come on in!",
      wrongAnswer = "Get out of here, you don't know the password!"
   }
}
As seen I am not the best coder out there, and spent 30 or so mins writing something that probably does not work, but that would probably be roughly the way I would now do dialogues/scenes if I were to make something. Most of the time went to actually coming up some random dialogue.

Altho arguelably setting all faces, characters etc manually might be a lot more time consuming in the end, but generally I still feel that making a full fledged scripting engine doesn't really save that much time unless the project is HUGE! Not to mention that scripting has its advantages in terms of conditional branching.

What comes hard is about actually testing how the state of the game works. Can some state be bypassed by doing something or like skipping part of the game by abusing some glitch. For that I have thought that building some sort of graph on conversations and states would probably be almost a must have feature especially if there is tons of brancing in the conversations. I think I remember reading somewhere that doing internet pages is a fast way to prototype dialogs, and how well they actually go/work. It also makes possible to have separate choices.

Also I think do agree that rpgs are probably a lot more work than a platformer is, but I kind of feel that platformers have a different kind of problems. Like in rpgs you might completely ignore any sort of requirement for physics, depending the game youre making, but the level design in platformers just becomes so much more important than in rpgs (atleast that is what I feel). On the otherhand platformers might not need to have a super complex/interesting plot for it to work, which imo is the main thing usually in rpgs.
User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: Editor - Handling dialogues and scenes

Post by josefnpat »

I'm currently working on Starfire Lords: Genesis, and for the alpha, there is a full "cutscene" engine which has a generator that uses the cutscene api:

Code: Select all

story.names = {
  low_gardo = "Delif Hokkenfurer, Low Gardo Executive",
}

Code: Select all

  self:genCutscene({
    { story.names.low_gardo, "gardo_neutral", "Welcome peasant. We are low on pilots, and you have been drafted into the service of the Gardo Corporation." },
    { story.names.low_gardo, "gardo_anger", "The mining colony on Din is behind on their quota. Take this shipment of slaves to them." },
    { story.names.low_gardo, "gardo_anger", "The costs of this are enormous, but I will not lose weight over it. You are not permitted to kill any of the slaves." },
    { story.names.low_gardo, "gardo_happiness", "That is our place, remember that." }
  })
And here's some sample output for other levels:
Image

While this is a but more simplistic, I believe it does apply to the discussion. Instead of building a module for everything under the sun (e.g. noDrink, hasDrink, script01_man, etc) it just handles the current levels' discussion. If that doesn't fit the need, the module can be expanded (as it has!)

What I have found is that building tools to help you move along is a great way to speed up production, but the amount of effort that goes into creating a system should take less time than it should to actually implement the data required for the game.

I also did an experiment in a Ludum Dare where I created more complex "conversation" and interaction system.

Here is the game: http://missingsentinelsoftware.com/game ... ve-crawler

And here is a sample of the code:

Code: Select all

events:add(
  function() end,--start
  function() end,--finish
  "You encounter a family who is willing to bathe you.",--text
  {
    {text="Take a bath (50g)",exec=function()
      if player._gold >= 50 then
        player._gold = player._gold - 50
        events:force(
          function() end,
          function()
            global_random_step = global_random_step + 2
          end,
          "The family directs you to their watering hole, and lets you bathe there."
        )
      else
        events:force(
          function() end,
          function() end,
          "You do not have enough money. The family refuses to speak anymore."
        )
      end
    end},
    {text="Continue on.",exec=function() end},
  },--choices
  nil,--img
  nil,--timeout
  "good",--polarity
  20--count
)
More examples here:

https://github.com/josefnpat/LD29/blob/ ... s_good.lua
https://github.com/josefnpat/LD29/blob/ ... rs_bad.lua
Missing Sentinel Software | Twitter

FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
Muris
Party member
Posts: 131
Joined: Fri May 23, 2014 9:18 am

Re: Editor - Handling dialogues and scenes

Post by Muris »

From the pictures on above post, I somehow thought of Star Control 2.

I thought about different languages with the noDrink, hasDrink type of approach on the topic of doing dialogs. I figured it would be easier to just create the variables from the beginning, and if there would be need to translate stuffs later on, one would only have to translate the strings in the language file, instead of having to do heavy tweaking to the code. Also if you do it from the get go, it shouldn't take more than a few seconds to add a variable versus having to change every single line of string on a finished product and then making sure that something didn't go wrong during the process of translation. I think this is the normal way for doing multiple language suport, but I could be wrong.

I did some more thinking and since what I wrote was just bare bone idea of how I would implement the thing, I came to realise that sometimes you'd probably prefer to have multiple scripts running simultaneously, so there probably needs to be some sort of mechanism / command to tell the script engine that the following lines of code are running parallel, where as normal execution would be to wait until the last command has been executed.

Also putting some more thought the functions the scripts call would have to probably as on the post above throw the function of executed code into a queue of some sort. Then just have updates happen from there, maybe put tables when having to do parallel system.
User avatar
SiENcE
Party member
Posts: 810
Joined: Thu Jul 24, 2008 2:25 pm
Location: Berlin/Germany
Contact:

Re: Editor - Handling dialogues and scenes

Post by SiENcE »

I choosed a node based system. A while back i was searching for an Node Based Editor to write dialogues. Some commercial Tool are Articydraft and Chatmapper. But you need a lot of time to understand them and thier exported files are big and full of unnessesary things.

So I found Twine. Twine is a free, opensource, small, cross-platform Tool and you can export into a txt file and try the dialogue by generating an javascript/html file. Very easy to use (I recommed version 1.4.2 !).

I wrote a little parser to read the file and used the build-in keywords and CODEs for my needs to define what images to and lua functions to execute when a node is reached.

Here is a sample of a starting Node.

Code: Select all

:: Start
//image IMAGE_A_0001.png//

{n}Text Dialogue.
//condition { check = function(value)
					print('partymembers', value.count)
					return value.count == 3
				end
				}
//

//color {229, 220, 180, 255}//
[["Choice 1"|Link1.1]]

//color {229, 220, 180, 255}//
[["Lets Exit this dialogue!"]]
Second node.

Code: Select all

:: Link1.1
//image IMAGE_A_0002.png//

{h}"Bla bla bla"
{n}Bla bla bla 2

[[Continue.]]
To display this parsed text I modified richtext. {n} and {h} are markups you can define in richtext to use a special font, or color or image, or ... for the followup text.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 5 guests