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.