Search Unity

scripting an in-game how-to: thoughts?

Discussion in 'Scripting' started by naked_chicken, Dec 6, 2012.

  1. naked_chicken

    naked_chicken

    Joined:
    Sep 10, 2012
    Posts:
    186
    So first the issue I'm having. I'm making an in-game how-to for my game. Something to show the players how to play the game.
    I tried setting up the entire tutorial as one animation and simply pausing it at intervals for the tutorial text. The problem I'm having is that sometimes (not all the time, just sometimes) the animation will skip frames. The issue with that is that some frames contain script triggers and whatnot and if it skips that it puts everything out of sync.

    Questions:
    Is there a way to keep unity from skipping frames in my animation?

    Is this even a viable option for making a tutorial?

    Is one long animation better than several small ones?

    Would just doing everything with scripts, using WaitForSeconds to allow for pauses work better?

    Does anyone else have any other suggestions for making a tutorial?
     
  2. laserlars

    laserlars

    Joined:
    Nov 17, 2011
    Posts:
    255
    I don't know what kind of game you're making, but isnt it better for the player to actually try it while the tutorial is running?

    As in:
    "To jump, swipe upwards" (with a fancy animation of a finger or something) -> User has to swipe upwards to trigger the next tutorial tip.

    Just a thought:)
     
    Last edited: Dec 6, 2012
  3. Loius

    Loius

    Joined:
    Aug 16, 2012
    Posts:
    546
    Speaking from experience here - your audience is far more likely to remember the information in the tutorial if you do as laserlars suggested. To clearly illustrate, I just got back from playing two new games on a certain site. One happened to have a non-interactive tutorial, and it took me twice as long to absorb the information in that one. I ended up quitting out of the first level to go back and re-read the tutorial 'cause I missed a key thingummy.

    But to help with the animation thing-

    Skipping trigger frames seems like a serious problem. How are you triggering the scripts? If I were trying to implement this, I'd use a test for animation time - something like

    Code (csharp):
    1. if ( !shownWhereTriggerIs  tutorialAnimationClip.time > timeShowTrigger ) ShowTriggerTutorial();
    (also, as far as I can tell, Unity has no concept of 'frames'. It's all time-based)
     
  4. naked_chicken

    naked_chicken

    Joined:
    Sep 10, 2012
    Posts:
    186
    Sorry, I wasn't particularly clear on that. I do pause the animation at intervals to let the player try out things. The animation plays and at specific times it hits a trigger frame that pauses the animation by script. Then the script waits for the player to do something, then starts the animation again.

    The problem is that very occasionally the animation will skip those pause for the player keyframes. I'm guessing because they are literally only one frame.
     
  5. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    My technique is that, if the tutorial is active, the game runs a coroutine that yields while watching for certain events/variables, and when they occur it does the appropriate thing on screen and proceeds to the next step; repeat until done.

    --Eric
     
  6. Loius

    Loius

    Joined:
    Aug 16, 2012
    Posts:
    546
    But what is a frame? As far as I know, Unity doesn't "respect" frames from animation programs, it's all completely time-based. Are you using AnimationEvent or are you counting frames in Update or what?