Page 1 of 1
Implementation of in-game cutscenes
Posted: Fri Nov 20, 2015 4:44 pm
by DRW
Is there a specific way to do in-game cutscenes and other stuff where the game pauses for the player, but where there's still stuff going on in the regular scene?
For example, when I reach the end of the level: The player character shall not be able to move, then the boss walks into the scene, then they have a little talk that you can advance with the A button and then the regular gameplay resumes.
Furthermore, when the boss is defeated, another short dialog appears. Then the player character walks off the screen automatically.
Is there any specific way to implement this in an easy way or is it a tedious bunch of manual if-checks that are processed every frame?
Code: Select all
if (status == NormalGameplay)
RegularStuff();
else if (status == beforeBoss)
{
if (boss.X > 200)
MovementBoss(Left);
else
{
if (currentDialog == NoDialog)
LoadNextDialog();
else if (ButtonPressed(ButtonA))
{
if (dialog == LastBossDialog)
status = normalGameplay;
else
LoadNextDialog();
}
}
}
else if (status == afterBoss)
{
/* More stuff about dialogs and automatic movements. */
}
Re: Implementation of in-game cutscenes
Posted: Fri Nov 20, 2015 6:09 pm
by never-obsolete
I've handled this with actor states and scripting, though that might be overkill if you only have a few events.
Re: Implementation of in-game cutscenes
Posted: Sat Nov 21, 2015 12:13 am
by tokumaru
You'd probably need a flag to allow/disallow user input, and a scripting system so characters can do stuff in a less hardcoded way. If the player has to do a lot of walking, jumping or things normally done through user input, the scripting system could support playback of logged input, so these actions make use of the actual physics engine, looking consistent with the rest of the game. Other useful commands you can have in the scripting language are the ability to summon text boxes and start arbitrary sprite animations, for behaviors not contemplated by the game engine.
Re: Implementation of in-game cutscenes
Posted: Sat Nov 21, 2015 4:50 am
by DRW
What would you say how complex such a scripting system is?
Re: Implementation of in-game cutscenes
Posted: Sat Nov 21, 2015 6:28 am
by tokumaru
Not very. Scripts can be simply a stream of commands + parameters. For example, byte $21 could mean "speak", and the parameter that follows could be a pointer to a string. Then, when you code the interpreter, you know you have to decode command $21 to read a string and display it in a text box. You'd have to code the actions anyway even without a scripting system, but with the system you assign codes to all the actions and parameterize them so they can be easily reused.
Re: Implementation of in-game cutscenes
Posted: Sat Nov 21, 2015 4:41 pm
by DRW
O.k., I'll try it.
Re: Implementation of in-game cutscenes
Posted: Mon Nov 23, 2015 1:52 am
by Vectrex2809
What I'd do would roughly look like this. At least if your game has a status bar. I recall Flintstones Surprise at Dinosaur Peak used this
Code: Select all
Force Pause game
Set cutsceneflag
End game engine
Pause:
If cutsceneflag = true then goto cutscene
End game engine
cutscene:
Change status bar CHR bank (w/CHR ROM)
Do cutscene
If text = endflag then goto end ; endflag is a special bit in the text that ends the cutscene
End game engine
End:
Resume game
End game engine
You need a sprite 0 or IRQ based status bar and CHR ROM to make this work but it's the easiest method I can think of
Re: Implementation of in-game cutscenes
Posted: Mon Nov 23, 2015 2:17 am
by DRW
Huh? I'm not sure whether I understood this correctly.
I'm not intending to do "Ninja Gaiden"-like cutscenes if that's what you mean. Doing them would be pretty easy. My original question was about doing "cutscenes" within the actual game scenery. I.e. you defeat an opponent and he's stunned and your character automatically walks towards him to knock him out. Or some boss character gives you a lecture, then flies away before you can defeat him for good.
That was my question: How to do this effectively without having to code every motion manually?
Re: Implementation of in-game cutscenes
Posted: Mon Nov 23, 2015 3:03 am
by Vectrex2809
DRW wrote:Huh? I'm not sure whether I understood this correctly.
I'm not intending to do "Ninja Gaiden"-like cutscenes if that's what you mean. Doing them would be pretty easy. My original question was about doing "cutscenes" within the actual game scenery. I.e. you defeat an opponent and he's stunned and your character automatically walks towards him to knock him out. Or some boss character gives you a lecture, then flies away before you can defeat him for good.
That was my question: How to do this effectively without having to code every motion manually?
You mean doing cutscenes where a little box pops up in the scenery like in Simon's Quest?
What I posted was about how to do the cutscenes in the status bar, like in the NES Flintstones games (
https://www.youtube.com/watch?v=bDQVdqet75s - 21:00 is a good example)
Re: Implementation of in-game cutscenes
Posted: Mon Nov 23, 2015 4:22 pm
by DRW
Vectrex2809 wrote:You mean doing cutscenes where a little box pops up in the scenery like in Simon's Quest?
No. I'll simply do this by using the status bar for my dialogs.
I'm talking about cutscenes that are done with the in-game graphics in the actual stage.
For example, you defeat an opponent in the normal game. The opponent is stunned. Now the player character walks towards the opponent (without player input) to give him the final blow. But when the player character arrives, the opponent hovers into the air, says some things and flies away.
Of course, I could save every x and y position and every meta sprite index for every character in every frame of this scene. But this would be a bit too much.
I'm still not sure how exactly I will do this. How well a scripting language will work here. I'll have to test it out.
Re: Implementation of in-game cutscenes
Posted: Mon Nov 23, 2015 5:28 pm
by tepples
What I hacked together during the final crunch of Haunted: Halloween '85 was a system where each animation consists of one or more keyframes. Each keyframe consists of a duration in frames and zero or more actors, each stored as a tuple of (X, Y, X velocity, Y velocity, metasprite ID).