Blending gameplay & storytelling w/ Timeline: Cutscenes & game graphics | Unite Now 2020

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
♪ [MUSIC] ♪ [NARRATOR] Welcome to Unite Now where we bring Unity to you wherever you are. [CIRO] Hello everyone! And welcome to this presentation. Today we talk about how to blend gameplay and storytelling with Timeline. My name is Ciro Continisio, and I'm the lead Evangelist for the EMEA region at Unity. In today's agenda, we have a few things. First, we will have a brief chat on why blending gameplay and storytelling, and what does that mean. Then we will dive into the technical aspects and see how Timeline can help us do that with all of its various parts. Then, we will go and see how to customize Timeline to better achieve this goal. And again, we will take a look at some use cases, so I will present you a few Projects that I worked on, which highlight specific cases and interesting cases where I blended gameplay and storytelling together. Finally, I will give you a few additional resources to study, to read, and to watch after you watch this talk. As a reminder, I just wanted to point out that I will use mostly 19.4, so the LTS version of Unity of this year, which means that if you're on 19.4, you will have all of the features that I'm talking about. So first things first. What do I mean by blending gameplay and storytelling? Let's talk about Dart first. I want to touch on the case where you don't blend gameplay and storytelling, which is pre-rendered cutscenes. In this case, this is the technique used in plenty of games, and it's a perfectly fine technique. The idea is to have an animation have some kind of sequence and render it either in the Engine or in the DCC tool, in an external tool, and maybe do some video editing as well and some post-processing, compositing, and all that stuff. And then, you play the video in the game as it is, so you just embed the video in the game, and then the game plays the video, just like a small movie. That's perfectly fine. It has a few advantages, of course. The #1 advantage is that you're not constrained by the platform you're going on, so, for example, on mobile, you can play super beautiful cutscenes, which you wouldn't be able to render in real-time. That's why this technique was used a lot in the past when hardware couldn't run a lot of polygons, a lot of effects, they will just pre-render cutscenes and play them as they were. And they were inspiring players, of course. Today, hardware is much more powerful, so this advantage makes less sense. Obviously, other tradeoffs is that a video occupies a lot of space on disk, so if that's your constraint, you don't want to do that. But again, this is a perfectly fine technique. Here you're seeing, for example, the recent game <i>Mosaic</i> by Norwegian studio Krillbite, and they use this technique, because they just wanted these incredible animations to play on the screen. And then they move into gameplay, where you control the guy in the white shirt, there in the shot, in a much smaller environment. In other cases, you might use pre-rendered cutscenes to use better animation, better effects. That, for example, is the case or better dubbing sound whatever, as is the case for <i>Yaga,</i> a game made by a Romanian studio, Breadcrumbs. So there's plenty of advantages to this technique, of course. One of the downsides, though, which I was forgetting to mention, is that these cutscenes don't scale well, they don't basically... When you see the game maybe a few years later, and you play it on a much more powerful hardware, the cutscene just stays the same, it doesn't upscale. So, for instance, the resolution also doesn't go up, and that could be annoying to some players. So something to take into consideration. On the other hand, in-engine cutscenes are completely dynamic in the sense that they are being rendered in real-time as the player's playing through the game. In this case, there might still be a narrative that goes from A to B, without any kind of deviation, so it's almost like a video. But because it's rendered in real-time, you can make it as dynamic as you want. For example, it could reflect the customization of the Character, which is not the case for this particular game. And then, it could reflect things that happen in the gameplay. So maybe you destroy the building, and you see that that building is destroyed in the background, and stuff like that. In this case, I'm showing the game<i> Ori and the Will of the Wisps</i> from a studio from Austria called Moon Studios, a super-beautiful game. The other downside, which I guess Moon Studios had to deal with, is that you need to make the cutscenes run smoothly. That means that you need to stay within the budget of your game. So it means that you need to optimize the cutscenes as well. So that's one downside of using in-engine cutscenes. You're constrained by that, and you need to optimize and debug your storytelling as well. But again, upsides/downsides, they both have their own strong points and weak points. But the point I want to make in this presentation, the thing I want to focus on is what I call here "Interactive Narrative." Interactive Narrative means that you are telling a story, that's, obviously, the craft of games in themselves, but, in this case, you're telling a piece of the story in the game, and at the same time, things are still interactive. So you, as the player, will still be able to move around, do things, interact with things, as the story is playing around you, in some way. I used the example here of the game <i>Oxenfree</i>, from a studio from the US, Night School Studio. In <i>Oxenfree</i>, you have this character, she is framed in the center of the shot, and she can, obviously, move around and talk with other characters. As you can see here, for instance, the character called Clarissa is talking on the left, that's a red balloon, you see the very small red balloon. So she is talking. So this is a piece of narrative, this is, basically, a cutscene. But at the same time, you as the player can interrupt that narrative by choosing one of the three options that you see here, on the screen: "Jonas is my stepbrother," "Jonas, don't you remember?" etc. By choosing that, you interrupt the cutscene, and Clarissa is interrupted, and then you talk, and then Clarissa maybe replies or another character replies. So the story is interconnected with the gameplay, and you can interact, you can intervene at any point. And that makes it super powerful, because now you feel in control. You don't just feel that you're watching a movie, but you're part of the movie, you can take part in it. This is, as I was saying, a powerful technique, although it obviously requires its own share of work, because you need to plan ahead all of these dialogues, you need to plan ahead all the interactions, you need to debug them, and that might be challenging, of course, because once the cutscenes are interactive, then it means that the player can act at any point, they can perform any action. So you need to make sure that the cutscene holds and it doesn't break at any point in time. But again, if you're able to deal with that amount of work, I think it's a very powerful tool at your disposal that you have in games. Now that we know what we want to achieve, let's take a look at the tools, and, of course, I want to mention Timeline. Timeline is a feature that we introduced in Unity in 2017, in the 2017 release cycle. The first thing I want to mention is that Timeline is a linear tool. This is pretty obvious, of course, but I want to mention it because sometimes it might be tempting to try and use Timeline for things that are inherently non-linear, or things that are procedural, or branching. That's okay, and you can do that if it makes sense for you. You just need to remember that the real power of Timeline is unlocked when something is linear, something plays exactly the same way every time, and because Timeline gives you the ability to scrub and preview what's happening. So that's really powerful. And some tools don't play well with that, so just remember this. Although, for instance, you could also use Timeline for things that are branching just slightly. Think of quick time events, for example, those moments in games where you have to press a button, and whether you press the correct button or the wrong button, you get two different endings. It might make sense to use one Timeline for those and have both endings on the same Timeline, so you can preview them together, and then some game logic will skip to the exact time, depending on the button press. So Timeline can be interactive in that sense. But again, just consider whether it makes sense for you to use this tool or something else. The other important thing to remember is that you can have multiple timelines playing at the same time, because Timeline is an Asset, but it's played by a component, which means that it can go on different GameObjects at the same time. This means you can break your timelines or your narration, if you want, into multiple blocks, and play them together, play them separately, make one that, for example, starts a few seconds after the other, you can do all sorts of things, just remember that. And also, the point of this talk is to show you how Timeline can do so much more than play animation or camera movements and sound, which is the typical usage, but I'll show you how you can actually harness and take control of different elements in the game. The bread and butter of Timeline is, obviously, clips. Clips look like this, and they're basically an action, an action which plays over a certain amount of time. It has a beginning, it has a duration, and an end. Clips are laid out on tracks, so you need a track to put clips on. And you have animation tracks, like the blue one that you see here in the image. You have audio tracks, like the yellow one, and you have a Cinemachine Track, when you Cinemachine in your project, which is the red one here. Clips are a really powerful tool, because they can be blended together, they can be played at different speeds sometimes, like, for example, with the animation. They have multiple properties, so they not only have one thing that they reference, like an animation clip, but they can be full of meaning and full of options that you can tweak to obtain different effects. On the other hand, you have markers. Markers are a relatively new feature of Timeline. Markers lets you mark an instant in time on a timeline. They're not something that like clips has a continuous segment of time. They have a start, duration, and ending, which is the case for clips, but markers have just one instant. And, specifically, I'm going to talk about signals. Signals are basically a custom type of marker, which we provide out of the box. And signals are a marker that can call for functionality. And to do that, they have been architectured with three parts: there's a Signal Emitter, which is the thing that you see on the Timeline, and it has the little marker icon. Here you see two signals, and then you see one on a track that has been collapsed, so you can select it, and the Signal Emitter, the role of the Signal Emitter is to emit a notification. Then you have an Asset, which is a channel where the notification is broadcasted, so that you can create multiple channels, and filter these notifications, depending on the channel. And finally, the component which listens to the signal. This is called Signal Receiver, and in the component you find a familiar Interface of Unity Action where you can bind a GameObject, and a Script, and a Function to that signal. So whenever the Timeline passes over that signal, or plays through that signal, you could say, the signal is broadcasted in the Asset, and then the Asset broadcasts it to the receiver, and that creates the functionality. So through signals, you can basically extend the functionality of Timeline very, very quickly and without coding, and hook into any functions that you have anywhere else in the game, just like UnityEvent, so just like you would do with the UI, for example, with a button. We talked about the theory of blending gameplay and storytelling, but let's take a look at a few practical examples just to see what I meant. In this very simple one, more than blending, I'm really just connecting them for now. The idea here is that I have this mobile game. This is kind of like a clone of <i>Clash Royale</i>, so a card game where you play your units on the battlefield, and I wanted to have a cutscene at the beginning of the game, which then bridges directly into the gameplay. So let me show you the cutscene first. You see how you have these two Viking kings threatening each other, and the other one is laughing, and now the gameplay starts. And I can play my units on the battlefield, and everything has been connected together, and I didn't even notice the transition. Let me show you how it's done. Obviously, I'm using Timeline. So here I have an IntroTimeline. And as you can see here, the Timeline controls a few of the classic things that you would expect: Animation of the Kings, you can see it here as I scrub the Timeline. It's very useful, of course, that's what I was mentioning before, the linear storytelling that you want to be able to scrub through and see and preview in the gameview. It controls camera shots, it controls audio, and then the key point where it connects with the gameplay is here, is on this Signal, at the end of the Timeline. So this Signal here, which is on a special track which hosts Signals, is broadcasting a Signal again, sorry for the pun, involuntary pun, is broadcasting a Signal called StartMatch to an object, here TimelineSignalRelayer which, as you can see, is a GameObject here, in the Scene, and this object picks it up with this component, Signal Receiver. This component is set up to receive a few Signals GameOverCutscene, CameraShake, and StartMatch. The StartMatch is the one that I'm interested in. For this Signal, this component will call this function on the Game Manager, which is another object. So this is how I bridge this Timeline. And when it ends, I broadcast a Signal to this object, and that object starts the gameplay. Obviously, you need some preparation for this, somebody has to call this function, but once you have it, you can give this System to a designer, level designer, or narrative designer, and they can use these markers to basically put these functions wherever they want on the Timeline. So if this Timeline were to become longer for any reason, or shorter, they could just move this functionality and connect what is the narration with the gameplay, which is somewhere else in the game. Again, this is a very simple case of how to pass control from the storytelling to the gameplay. We're getting to the heart of the talk, and this is when things start to become interesting. So you have the ability in Unity to customize the behavior of Timeline. Customizing Timeline means that you can create custom clips and tracks to hold them, and custom Markers to basically connect Timeline with whatever is in your game. For instance, I created this Time Control Track. It's a very simple example, I was just like experimenting, and I made a track that can control the timescale of the game. In this case, I have two clips, and I'm blending them together. Each clip has a timescale value, for example, from 1 to 0.5. This means that I can create a slow-motion effect which slowly rolls in, in the Timeline, and then I could bring it up back to 1 if I wanted. And once I have this custom track created, I can use it in all the Timelines in my game. So I basically created a very powerful tool, which I can give my, again, narrative designers, level designers, whatever you call that role, and these custom tracks, these custom clips, they can be connected with anything in the game, and that's why they have to be custom in the sense that only you can know what kind of functionality you want to enable. And you can have logic in them as well, and make checks on the logic of your game. So it's a very, very powerful tool at your disposal. In fact, if you noticed, the Cinemachine Track is actually a custom track. You notice that because when you right-click in Timeline, you will notice that Cinemachine Track appears at the bottom, below the line, that is a clear signal that that's actually a custom track. If you look into the scripts of the Cinemachine Package, you will find implementation of the Timeline track. This is actually a very good practice. I mean, If you are, for example, Assets Store toolmaker, and your tool makes sense in the Timeline, then it would be very nice to provide the custom track to enhance the functionality of your tool and put the functionality at the disposal of anyone who doesn't know how to program. So you can integrate your tool with Timeline this way. The other option, of course, I mentioned it before, is you can create custom markers. So you choose whichever works best for you. If it's a continuous act in time, you create a custom track. If you say an instantaneous thing, you create a custom marker. Custom markers are also easier to code. And they look like that. They look like a position marker on a map, if you want. So they have a custom, a different icon from normal markers. The last thing I wanted to mention is that during this course of this talk, I'm not going to show you how to create custom tracks, clips, and markers from scratch, because that's a bit of a broad subject. In this talk, I will talk more about the uses that you can achieve with creating these custom tools and some creative uses as well. If you want to learn how to create them, I will provide a couple of links at the end of the talk of blog posts which you can consult and learn how to create these custom tools. And now for the interesting part. For this section, till the end of the talk, I will go through a few examples of games and demos that I made where I created custom tracks, custom clips, and custom markers, and how I used them to really blend gameplay and storytelling. So, let's go! As a first stop, I want to show you again <i>Unity Royale</i>, the game that I've shown you before, the mobile game where you can play cards to create units on the battlefield. As I was making this game, I thought, "If I have that possibility, why don't I use it to drive storytelling as well?" So I created these custom markers, these ones: this one here and this one here, and as you can see, they're called Card Markers. Basically, they are markers that from the Timeline can simulate the creation of a unit as if you're playing a card as the player. So let me show you how they work in practice. Notice that if I play, you saw that these two units were created out of nothing, and they were created basically as if the player had played a card in this spot here. That card is a special card, is basically a variation of this one with the two Vikings, they're very, very weak Vikings. So you will see that now that the Timeline reaches this other marker, the other King will reply with the same card. And because these are just normal cards, and the gameplay is actually going on, even though, I cannot play in my own cards, these Vikings will attack each other and eventually kill each other, but because they're very weak, they don't affect the battle in any way. So you see that they fight like that, and now I can play my cards but these two are effectively two normal units. This is the first example of how to bridge gameplay and storytelling. What I'm doing here is I'm relying on all the systems that I have here in all the gameplay that's already been made to drive some storytelling through the Timeline. So these markers here, again, they're custom, as you can see, they show what kind of card they will play, and the position of the card, and then the faction that this card belongs to. For instance, I could potentially have another marker here, like this one, and I can assign any kind of card, of course, I have a card premade from my game. Let's say, I could create a rock, and I could say that it belongs to the player or whatever. Place it maybe around here. Now when I play the game, you will notice that at this point in time, the rock has been created. Maybe you don't see it from that angle, but the rock is here. So as you can see, I can easily now connect the Timeline with the gameplay and mix gameplay and storytelling this way. And this is a very, very powerful tool. Just to give you an example of the code behind this to create those custom markers. Basically, it's just two classes. Let me show you here. The two classes are here. Basically, there's one which is the marker. This derives from marker and it implements an interface called INotification, and as you can see, this one contains all the data that the card needs to have to work. For instance, if I select the Timeline again, and I select a marker, you notice that the data is reflected here: Card, Position, and the Faction it belongs to. These are as simple as this, then you have this PropertyName that you need to implement, we aren't using it. And then there's another script which derives from MonoBehavior and implements INotificationReceiver. And this one has an OnNotify function, which will be called when the Timeline passes through the marker. And then here I basically called the gameManager, and I use a card, which is taken from the data that the marker contains. So it's super, super simple to create custom markers. Again, I will provide a link on how to do this in more detail at the end of the talk. Let's see another more elaborate example of using custom tracks. This is from an older demo I made. It's called <i>A Terrible Kingdom</i>, and I will link to it at the end of the talk. Just to show you the game first, let me play the game. The idea here is that this game is an RTS. I have a bunch of units, like in a classic RTS game: I can move the camera around, I can zoom in, and I can right-click to direct these units to a target, which they will move to in a formation. So these units have basically a very, very basic AI routine. They have different states, they can be idle, like here, they could be walking, they could be attacking. For example, if I click on this monster here, they will converge to the monster, and now they're in attacking state, and then, eventually, some of them will be dead as well. So they have an AI which is driving the animation. There's plenty of animation that is been driven by these states. And I wanted to piggyback on this AI to drive some Timeline. For instance, if a press a button, I can see this Timeline. This Timeline is showing a sequence where this character moves to the position, then they decide to fight back in some way, but these three monsters overpower him. And then you have this other sequence where the army decides to fight back, and they spring forward, and the battle starts, and now you see the battle from a distance, and more monsters come in, and they overpower the army, and that's the end of this kingdom. Very, very dramatic Timeline. So the idea here is that to animate all of these characters, it will take me a very long time, and if I were to decide to change the battle somehow, maybe I don't want it in front of the gates, I want it to happen here, then I will have to change quite a few things. Instead, as I said before, if I piggyback on the AI system that I have in the game, then I can make things easier for myself. And that's what I did. So I created a custom track. If you see here in this Timeline, I have this custom track called AI Commands... sorry, that's the group, but the track is called the same. I have a few of them. And each one of them controls something that I called the Platoon. Platoon is basically a group of units, which sometimes, like in this case, contains just one unit. Go back to the Timeline, if I lock it. Sometimes, like in this case, it contains three units, like the monsters that we saw in the first Scene. So the idea here is that if I enable this Timeline, you will see that these clips, these custom clips, are able to issue commands to the AI of the game. So, for instance, this one is issuing a command called "Go to and guard." You can see that the clip itself has a list of commands, and all of these, I had to input them manually, modeled on the AI of my game, but it was very, very quick, and now I have this very powerful tool when I can issue commands to groups of units while the Timeline is running. When the playhead hits this position, that unit will receive the command, and then the AI is going to take over and perform the action as best as it could. Obviously, it's going to use the NavMesh to navigate around this mountain, and so forth. You can actually see that this action, in particular, that has a position, I also created a custom gizmo in the Scene. Now if I move this, this is directly wired to the position, so I can decide where the unit is going to move to. Same here, AttackTarget, I can assign the target. GoToAndGuard, then you can have, for example... If I do this, you can have, for example, Die, even, so you can decide to kill a unit on demand. Stop, which stops them in their track, and go to an Idle, which moves them to the position and tells them to wait. And then the other cool thing I added to this custom track, because I wanted to visualize all of these, and, as I said before, one of the cool things with Timeline is the ability to scrub the Timeline and visualize things, even when you're not in Play Mode. The issue here was that these units move on a NavMesh, and the AI that does that, the NavMeshAgent is not active when the game is not in Play Mode. So what I did was I took the current position of the unit, and I interpolated to the end position, which is determined by this target here, and then I basically tween the position of the unit along the length of the clip. Here if I do this, you will see the unit will move close to this point. It doesn't move on the point because there's a certain formation that they have to respect. This unit is on the right of this ideal circle. The monsters, you will see that they will move on the same spot, but they will circle the unit. But anyway, the point here is that, as you can see, now I can kind of preview what the units will do, and then at this point in time, I know that they will be roughly here. When I say "roughly" is because when you play the game, they will do it based on the AI, so they might die on the way, so they might die here if somebody is attacking them. You need to doublecheck and play the game just to make sure. But at least this gives you a vague idea. By this time, this character will be dead, and then the units will move to the center, and here is where you get the other shot that you saw before with the army. At this point, the Camera is looking from this position. And you can see, if we go to the Game view, and then immediately here, this army will attack and move forward. They move forward, and they will find this other army which came from the back here. As you can see, I can coordinate quite a large number of units just by using the gameplay of the game, which I've built before. The idea is, for example, if I were to fix something in the gameplay, then the Timeline will also improve and change as a result. So everything is dynamic. If I change the Graphics of the characters, they will be reflected in the new Timeline, and if I add new animations and stuff, so I don't need to go in and change the clips, which is quite cool. At this point, you have two systems that are speaking with each other, and the Timeline benefits from that. And you can really quickly create new sections with plenty of units, as long as your target hardware supports. Another little thing that I have here that I want to highlight is this Time Machine Track. The Time Machine Track is a track that allows you to fast forward or rewind the Timeline at will and checks on conditions in the gameplay. For instance, this one is checking if the specific Platoon is alive, in this case the Boy, and this means that this Timeline will play and then rewind to Second 4, if the Boy is still alive. Second 4 will be, if we go to Time > Seconds, it will be roughly here. So you will just stay indefinitely here as long as the Boy is alive. If I play again, I'll show you the Timeline itself, how it does it. We'll see now the cursor will jump back a few times. And then when the battle is over, it will just keep going. So this other custom track is a way for me to have a Timeline which has loops inside, and that allows me to account for potential battles, which I don't necessarily know when they're going to finish. I stay in this area for a while, and then once I'm done, I move to the next section. But again, the conjunction of all of these tools together allows me to have this very powerful visualization of huge battles, even though I'm not animating all the characters by hand. For my third and last example of how to blend gameplay and storytelling using Timeline, I want to show you another demo. This is what you would call a danmaku or bullet hell shooter kind of game. Kind of like the Japanese-style 2D scrolling shooters, where you have these patterns of bullets that come at you, and you have to find your way through it. Let me show you the gameplay first, as I talk. As you can see, you can drive this ship, and you can shoot bullets, and you have these enemies coming at you, and you can destroy them. As you see, they move in patterns, they don't care what you do, they just follow their pattern and shoot bullets according to a specific pattern set up by the developer. And then you see these dialogues that pop up every now and then, which also give you a little bit of storytelling while you're playing the game. And then you see again like special sections, here I'm entering an Asteroid Field, and can take damage, of course, from these bullets. And I can destroy the ships and everything. The peculiarity about this demo is that you will notice, if I select this object and I go to Timeline, you will notice that we're actually running on a Timeline. All of the gameplay is being driven by this Timeline. I went through Phase 1, Phase 2 with the Asteroid Field, and now, I'm looking at the small, kind of like cutscene, but I can still control the ship, as I do it. And then the gameplay resumes, and I get into a more heated section where I really need to lodge the bullets, and I'm going to totally fail at it. As you can see, again, same kind of difficult section. I'm going to stop. As you can see, we have this huge Timeline that has Phase 1, Phase 2, Asteroid Field. So this is where I was going through the Asteroid Field, and then this was the cutscene that I was talking about, The Chase. And then you have these two sections: Phase 3, repeated twice with different speed. Just so you know, this one is not a custom track, this one is just a control track. So this is taking control of other timelines, which, as you can see, they're here. You see I'm on the Master Timeline here. As I scrub through this Timeline, other timelines are activated and deactivated to start playing. If I dive into these timelines, then I find the custom tracks. The custom tracks are called PathWorker. PathWorker means that these tracks are able to create an object and make it work on a path, starting from the right part of the screen and moving across to the left part of the screen. And that's how I create these patterns of enemies coming at you and shooting you. The PathWorker Track has clips, of course. These clips have a variety of properties. One of them, probably the most important, is the path which uses an Animation Curve to define the path that these ships are going to walk. For instance... and sorry I want to mention another thing... The other important thing is this object which is bound to the track. If I click on it, we'll notice that there's five hidden objects in the Scene, which I can actually visualize, they're just reference points. I call them the Lanes. This means that an object can start from the top here and move to the left. If I assign the first Lane, it means that the object is starting from here. For example, if I rewind, you will notice that this ship here, which is exactly this one, is starting from that object. Normally, you don't want to have them enabled. So I can disable them. So the ship here, associated with this clip, is described by a SciptableObject which is here. If I were to double-click, you will see that it has a reference to a Prefab and a few Parameters, like the Energy, the Speed at which it moves. What this custom track does is that, as soon as this clip starts, it will instantiate your object at the beginning of the path, and then you will move it programmatically, so it will calculate the time and the position at which the ship has to be at that time, and it will just move it via the Transform. According to the Animation Clips, I will evaluate this Animation Clip, and it will find the exact position at the ship should be. And according to the time, it will also instantiate bullets as needed and move them forward. And it will move them according to this other ScriptableObject. Through all of these Parameters, you can really customize the behavior of these objects. Again, moving on a path, shooting bullets. The bullets right now are not active if you want, because I cannot move, I'm not in Play Mode. But once Play Mode starts, because the bullets have a Rigidbody, upon touching the Player, they will produce a collision and they would actually produce damage. Similarly, for me, when I shoot the bullets, if they touch the enemies, the enemies would be damaged. So these are fully gameplay elements, but I'm controlling them through Timeline. If you remember, I mentioned it at the beginning of the talk, I'm doing this through Timeline because this kind of gameplay is very linear: I know that it will always go from here to here, and it will not rewind or there are no branches. Regardless of what I do, I can only succeed or do a game over, but if I succeed, I will keep going in a linear fashion. You will also see here a Dialogue Track which takes care of showing the dialogues in the game. So if I scroll, it just displays the text and the portrait of the character that's talking. Again, you can see that I'm relying again on some ScriptableObjects which are bits of dialogue with a Character, a Line, and an Audio Clip which acts as the sound effect. This is another custom track that I'm using here. And this directly interfaces with the UI Manager that I have somewhere here which displays the UI. All of this Timeline is plugging into the gameplay, and it's actually driving the gameplay in this case. It's not just requesting actions, but it's literally describing what the gameplay does at any second, which gives me the ability to scrub through it. And if I go back to the Master Timeline, now I can scrub through the entire Level, and visualize the patterns, visualize the Asteroid Field and how it plays. If it obscures something at any given point, and that's exactly what the player will see during the gameplay, which is super, super cool. Here then I have this cutscene, as I've shown you before. This is all driven via Cinemachine, so whatever the player will be, the Cinemachine will always frame these four elements. So I know that even if they move lower, the cutscene will play almost exactly the same, but I know that the player will see what I want them to see. They see these three ships moving around, there's some dialogue playing, and then I move into this more heated phase, and this is really where I can visualize the pattern that these bullets will have just by scrubbing the Timeline or pressing Play. I can also play in Edit Mode, and now I can really see the pattern. And if at any point I wanted to play, for example, this particular section, I can just select Seconds, and this is 90 seconds in, and if I go to the Master Timeline, I can choose here the Initial Time. And if I input like 90 seconds and I press Play twice, then I'm starting exactly from this point. So you see how cool and powerful this system can be to really test this gameplay at any point, and remix it, and tweak it in any way. For instance, I want to show you how to add something. Let's say I'm in this Phase 1. I want to dive in and then I add a new track. As you can see, it appears at the bottom because it's a custom track, so Path Worker Track. I assigned one of the Lanes. Let's say that I assigned the last one. Then I create a new PathWorker Clip. And now I can assign a definition of one of the enemies. Let's say that I assign this one, the definition of Pattern, like this one, and a Path. For the Path, I can choose anything, but let's say that I create a curve, and then I tweak the curve to go, for example, from here to here. This is going to represent the starting point. And this is the movement that the ship will perform. And if I close, and now, if I scrub, you see that the enemy is starting from this point here. It's moving up, and it's proceeding to the left according to the curve that I've drawn. The end of the clip signals the moment when the enemy will stop shooting. You see that here it stopped shooting. If I wanted to shoot it more, then I can make the clip longer, then the enemy will just shoot more bullets. And then, again, stop shooting but keep going left, basically continuing on the clip. You can actually even change the loop. For example, if I do this and I do this, then the enemy will keep going up and down on the curve. So super, super powerful way of controlling gameplay. Again, this really works for this type of game, it might not work for every type of game, of course, to drive everything to Timeline, that would be crazy, but you can see the power of creating your own custom tracks. Just a very quick dive into the code, because I want to show you, just give you a teaser if you want. I'm going to give you a link on how to learn, how to do these things at the end of the talk. The custom track is made by these four scripts, there's the track, there's the clip. And then there's the Behavior, which means how the clip works, what the clip does. And then there's a MixerBehavior, which is the heart of this logic. The MixerBehavior is able to mix different clips together on the same track, so, for example, in situations where I have multiple clips, that's where the MixerBehavior is able to read both of them. In here, I'm actually not mixing them, so you see, I cannot overlap them in that sense. But it's able to keep playing this clip, for example, even if I go past it, so the ship that is being moved by this clip keeps going. And that's what the MixerBehavior does. The important thing here is that the MixerBehavior is doing... Sorry, this is not the one, it's exactly in here. The MixerBehavior is calling this Script here. So the logic... What is the logic doing? The logic is basically taking care of the whole gameplay. As you can see here, OnGraphStart, when I press Play or when I'm previewing the Timeline, it takes care of instantiating the actual object from the Definition. So the Definition that I just assigned to the clip, it creates the object, and then it manages the lifetime of the object for the whole duration. It moves the object around, of course, so there's a point where it handles the transform of the object. It sets it active and deactivated. And when I exit Play Mode, it takes care of destroying it. So the whole lifetime of the object is managed by the Timeline. In fact, if I get out of Preview, you see that these two objects are empty. If I get into Preview, they get populated with the ships and they get populated with the bullets. Everything is pre-spawned, kind of like in an object pooling fashion. Once the Timeline is over is de-spawned. You can really choose your strategy here. I decided to spawn them in an object-pooling fashion, but if you want, you can spawn them as soon as the clip starts. This is up to you. A super-powerful tool that allows you to do this kind of stuff. You will need to code it yourself. I will repeat it over and over again: we cannot predict what's the Logic of your game, so this is what you need to do. But once you do it, you have a tool which will help you... If this would be a real production, then this tool will help you for months to come, designing your levels, previewing them, quickly being able to jump to specific times. That's an invaluable addition to your toolset. With these few use cases that I've shown you. I hope I inspired you to create your own custom tools with Timeline and to blend gameplay and storytelling a bit more in your game, whatever is the genre that you're making. I want to leave you with some additional resources to help you learn how to customize Timeline, as I promised. These are two blog posts. I wrote the first one, which details how to create custom clips and tracks, and my colleague, Julien, has created the second one on how to create custom markers. The second one is slightly easier. Creating custom markers is slightly easier. And then clips and tracks are a bit more complicated, but obviously, are much more powerful. You choose the best tool for your use case. Read these blog posts first, if you want to understand how to make it, and then, I'll give you the link to the projects that I've shown you in this presentation. After you read the blog posts, you can dive into these projects, if you want, and see how I implemented all the use cases that I talked about. The only difference here is Unity Royale won't have the audio. I'm sorry for that, but I can't distribute it. All projects run on 19.4. I updated them, so you can use them on 19.4 LTS. As a wrap-up, we have seen in this talk that you can create cutscenes using in-engine graphics that scale well on the user's hardware. We have seen how these cutscenes can reflect cosmetic and gameplay choices when being used in a game that allows that from the side of the player. The main point that I wanted to make, I hope I made it, is how you can blend seamlessly these cutscenes with the gameplay, and also how to leverage gameplay elements to create narration. So specifically in the example of the RTS, how I leveraged the AI and the gameplay of the game to drive some narration through pre-scripted cutscenes. But, again, not having to animate characters by hand. I think it's a very powerful opportunity that you have with game engines, and you should really take it. Finally, how Timeline makes it very easy to iterate on cutscenes, like, for example, with the danmaku example where you have all these elements and you can dynamically move them around and iterate really fast, and not only on cutscenes, actually on cutscenes and gameplay. If you gave these tools to your designers, then they can go very, very fast and produce a lot of content in a reduced amount of time. This is all from me. Thank you so much for watching the talk. I hope you come back for more. If you have questions, or you want to reach out to me, or you want to show me what you have created with the Timeline, please reach out to me on Twitter at the handle that you see on screen. Otherwise, you can come to the Unity forums. There's a thread on the Unite Now subforum, and you can ask questions specifically related to this talk. I'll be answering together with the Development Team. So this is all from me. Thank you so much for watching, and I'll see you in the next video. ♪ [MUSIC] ♪
Info
Channel: Unity
Views: 30,150
Rating: undefined out of 5
Keywords: Unity3d, Unity, Unity Technologies, Games, Game Development, Game Dev, Game Engine, unity timeline cutscene, unity timeline cinemachine, unity timeline tutorial, unity timeline blending, unity timeline camera, unity timeline camera animation, unity timeline 2020
Id: gsEe0_o_934
Channel Id: undefined
Length: 50min 55sec (3055 seconds)
Published: Mon Jul 27 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.