User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12

Thread: What's the best way to do scripted scenes?

  1. #1
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,245
    Mentioned
    87 Post(s)
    Tagged
    0 Thread(s)

    What's the best way to do scripted scenes?

    How do you guys manage scripted scenes in your games? I mean in-game situations where movement is temporarily taken away from the player (or not) while certain events take place on screen (eg. a couple of npcs walk into frame, interact for a bit with themselves and the player, then walk off.)

    I think the code for this sort of thing could get messy really fast, once you have to move NPC A to here then wait for 3 seconds then walk slowly to there, while NPC B must start off here, then ease in and out to there then wait for NPC A to arrive then play animation X then collide with object Y then pan camera left.... Etc.

    How best to manage this process, in an unconfusing and easy to tweak way? List of parameters in an ini file? Timeline object? And would you organise the action by NPC? Or by 'story beats' of a central timeline?

    I've had a preliminary go at this and am struggling to get my head around it. Help appreciated. Thanks!

  2. #2
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)
    elvisish's Avatar
    Join Date
    Oct 2014
    Posts
    652
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    I'd just use groups and turn them on and off, treating them like little state machines. That way, each group runs it's own separate process at that time without any care for what the previous and future groups do, so you don't really have to worry about a bunch of values and flag to determine if something should be happening or not, it just goes into it's own group.

  3. #3
    Clicker Fusion 2.5Fusion 2.5 Mac
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    zip2kx's Avatar
    Join Date
    Jun 2015
    Posts
    781
    Mentioned
    17 Post(s)
    Tagged
    0 Thread(s)
    I use a timeline of sorts, but it's not visual but values.
    I have an object I call values_cutscene and in it I have a value called "Timer" and another called "countdown". Every frame I add 1 to Countdown and when Countdown is 60 (which is my fps) I reset it to 0 and add 1 to Timer.

    I then use Timer to trigger different things such as

    Timer equal to 120
    ->Make String_whatever visible
    ->set character X pos

    etc

  4. #4
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Posts
    1,305
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    I think scripted events can be seen as an extension of normal NPC conversations (which you will find discussed elsewhere).

    Personally, I'd use XML or something similar.
    Here's a quick example:

    <event id="goSayHello">
    <move actor="player" x="100" y="50" speed="3"/>
    <wait/>
    <talk actor="player">
    Hello, my name is <PLAYER/>.<shout>Boo!!!</shout><set face=""/>I have <GOLD/>G.
    </talk>
    <global id="alreadyMet" value="1"/>
    <wait time="10"/>
    <goto event="sayBye"/>
    </event>

    <event id="sayBye">
    <talk actor="player">Bye!</talk>
    </event>


    There are two "event" elements here - "goSayHello" and "sayBye".
    At a certain point in the game, the engine will be told to run the "goSayHello" scripted event.
    It will find the event element with the id "goSayHello" and start reading its child elements, one after the other - with no pause in between, unless specified.

    The first element is a "move" element, which simply moves the specified actor to specified position.
    The next element is a "wait" element, which stops the engine moving onto the next element until the previous action has been completed (the player has reached their destination).

    The next element is more complicated, and contains several children of its own. It will simply display an RPG style conversation box, using the portrait and text color associated with the player. It will write the words "Hello, my name is ..." using a typewriter effect (one letter at a time), replacing ... with the player's name. It will then instantly write "Boo!!" (not one letter at a time), and change the portrait to a happy expression. Finally, it will write "I have ...G" replacing ... with however much gold the player actually has.

    The next element is a "global" element, which changes the value of a specified global value (in this case "alreadyMet").

    The next element is another "wait" element, but this time a "time" attribute is used to specify a number of milliseconds to wait before moving on to the next element.

    Finally, there's a "goto" element which jumps straight to an "event" element with the specified id. In this case, it just displays another conversation box with the word "Bye!".


    If you don't like XML, there are alternatives like JSON etc, or you could come up with your own custom script.

    Also, if you're working on a really big game, with loads of complicated scripted events, it may very well be worth creating your own visual editing tool to make it all quicker, easier and less tedious.

  5. #5
    Clicker Fusion 2.5Fusion 2.5 Mac
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    zip2kx's Avatar
    Join Date
    Jun 2015
    Posts
    781
    Mentioned
    17 Post(s)
    Tagged
    0 Thread(s)
    How do you bring the XML in Fusion @MuddyMole ?

  6. #6
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,245
    Mentioned
    87 Post(s)
    Tagged
    0 Thread(s)
    Thanks very much @MuddyMole . Just to clarify: the xml terms like "wait time", "goto event" or "talk actor" don't do anything on their own, right? They're just made up terms that I would then have to somehow connect inside Fusion so that they trigger certain events, yes? If so, I second zip2kx's question: how do you bring the XML into Fusion and what do you do with it once you've got it in Fusion?

    This solution looks like it's along the lines of what I should be doing. Though on the other hand, the xml syntax looks daunting and opaque to me, and wanting to avoid this sort of thing is what drove me to Fusion in the first place. I know, I know, XML is probably like the Duplo® of programming languages , but I'm a kindergarten-level programmer.

  7. #7
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Posts
    1,305
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    The hard way, I'm afraid - load it as a text file, and parse it yourself
    You could also just make up your own syntax that's easier to parse - delimited strings are pretty simple...

    eg.

    EV|goSayHello
    MV|player|100|50|3
    WT
    TK|player|Hello, my name is @Player .<!><>Boo!!<.> I have @GOLD G.
    GL|alreadyMet|1
    WT|10
    GO|sayBye
    EN

    String tokenizing extensions make it really easy to get the individual parameters.

  8. #8
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCHTML5 Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    chrilley's Avatar
    Join Date
    Jul 2006
    Posts
    917
    Mentioned
    14 Post(s)
    Tagged
    1 Thread(s)
    I actually did an example for another user way back(see attachment). For simplicity's sake I used a list object instead of more advanced formats like XML. You'll need the String Parser object but I am pretty sure this can be made using the String Tokenizer too. The commands included are rather basic but you can easily make up yourself what you want to happen.

    If you're feeling ambitious you could actually make a visual editor to generate the "scripts" in order to avoid the boring/somewhat confusing task of writing them manually. I've been toying with this idea myself!
    Attached files Attached files

  9. #9
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,245
    Mentioned
    87 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by chrilley View Post
    I actually did an example for another user way back(see attachment). For simplicity's sake I used a list object instead of more advanced formats like XML. You'll need the String Parser object but I am pretty sure this can be made using the String Tokenizer too. The commands included are rather basic but you can easily make up yourself what you want to happen.

    If you're feeling ambitious you could actually make a visual editor to generate the "scripts" in order to avoid the boring/somewhat confusing task of writing them manually. I've been toying with this idea myself!
    Finally had a proper look at this today. Thanks a million, chrilley. This is excellent - I like how easy to customise it seems, and that it doesn't require external files. I've never used the list object or string parser/tokenizer before, but I think I can work it out. I'll build my own system with my own requirements, but I think I'll use this example as my foundation. Thanks!

  10. #10
    Clicker Fusion 2.5Fusion 2.5+ DLC
    casleziro's Avatar
    Join Date
    Mar 2013
    Location
    United States
    Posts
    643
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    the xlua object and coroutines can make things like this easy. Lua itself is easy to learn and fast for many things other than just cutscenes. Chrilley's example is very good as a native solution.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Replies: 1
    Last Post: 28th January 2018, 12:01 AM
  2. Fusionner des scènes
    By LPA134 in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 14th February 2012, 05:43 PM
  3. Cut scenes help
    By Atherton in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 26th November 2009, 09:23 AM
  4. Cut Scenes
    By JaJitsu in forum Multimedia Fusion 2 - Technical Support
    Replies: 15
    Last Post: 30th July 2009, 03:57 AM
  5. Cut Scenes
    By ZayLong in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 27th July 2008, 06:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •