TowerJam 004 Setting the character up

2016-02-06 4:48 PM

I’ve been working on getting the character setup for movement and a simple attack combo system. This is my progress on the character at the time of writing this post.

This post was written in 3 parts as I progressed through the process of setting the character up.

Part 1

To start off I’ve added 2 new action mappings to the project for light and heavy attacks. I’m very impressed with the action mapping stuff. It’s a nice way to add new actions to characters without locking yourself in too much at the code level. By that I mean when you want to define a new action mapping (aka input abstraction) you go to the project settings, choose the action mapping type and then give it a name. The name you give the mapping is what you use across the editor and the codebase to refer to the mapping.I’m not usually a fan of stringly typed stuff or using strings to reference data from code but I think in this case it’s actually a quite elegant solution as it allows easy extensibility and you can add new mapping without having to recompile the code portion of the project.

For instance to bind an light attack named “AttackLight”I would use this line of code in my character cpp file.

InputComponent->BindAction("AttackLight", IE_Pressed, this, &ATowerJamCharacter::AttackLight);

Where I’m referencing the action name I defined in the projects settings as well as a callback when the action event occurs. Inside the callback I set a bool called IsLightAttacking to true and later let the animation system use that to determine what animation plays.

The animation system is a little complicated at first but I’m now at the point where I can see the value in such a complex solution. It consists of many different components. Code, blueprint event graphs, special state machine graphs and state transition graphs. I’ve had some experience setting up characters in source and quake engines but this was quite different from an implementation standpoint. It took me about 3 hours of studying until I got comfortable with the tool. Compared to other tools I’ve used in the past is about the fastest ramp up time I’ve ever experienced.

Here is the starting point for learning about how character animation works in unreal.

https://docs.unrealengine.com/latest/INT/Engine/Animation/index.html

Part 2

Once I got the light and heavy animations and working I started looking at how I could do Devil May Cry style combo attacks where one attack animation can be cancelled into another attack animation. I started out by purchasing a package of sword animations from the Unreal marketplace. I had a 30$ credit from when Unreal 4 went free so I figured this was easily worth the money. The animations I used are available https://www.unrealengine.com/marketplace/sword-animset-pro

My first attempt to get it working as fast as possible so I can see something on a screen was both naive and ugly. If I was in the first attack in a combo I set it to allow switching to the next animation in the combo if the player pressed the attack button and the current animation was more than 50% complete. This caused the animation to change far too abruptly.

Now I want the animation to change abruptly. The term itself is called cancelling so I figured I had the right overall idea but I’m just approaching it too bluntly. So I went back to the unreal answer hub with specific questions which didn’t answer my questions but linked to the relevant documentation.

After reading the docs I determined that the next step to improving the animation transitions was to pick the transition points with more care than simply allowing it after the animation was more than 50% complete. For this I used animation notify events. Here’s a screenshot of them setup in the timeline. As you can see I have 4 custom events. The regions CanCancel and ResetCancel define the portion of the animation that the user can cancel into the next attack.

resources/images/2016/02/01.png

Here is a screenshot of where these events are used. This is inside the animation blueprints event graph.

resources/images/2016/02/02.png

At first I thought my animation notifies weren’t working correctly or were inaccurate. This was exacerbated by the fact animation notify events have a property called “montage tick type” which seemed to indicate the timing accuracy the event was fired. I chose the more accurate but also more computationally expensive “Branching Point” value. It turned out the biggest issue was that I don’t have an eye for animation and I had simply placed the animation notify at a badly chosen location in the animation timeline. I moved the notify events to earlier points in the timeline than my instincts initially thought was correct and everything started looking good.

Once I sorted out how to cancel an animation based on an animation notify event things were massively improved but I had accidentally set the blend logic transition property to “Custom” when I was playing with options and suffered a bug. The character model would T-pose for the duration of the animation transition. The temporary solution was to set the transition duration to 0.0 seconds. By removing the transition I removed the T-pose error. Ideally I’d like to have a slight transition between animations. It might turn out that it will look bad but I would at least like to see how it looks before deciding whether or not I want to use transition blending. Once I set the Blend Logic property back to “Standard Blend” everything was solved.

Once the blend was in I was BLOWN AWAY by how good it looked. In my head it seemed like animation blending couldn’t possibly yield such great results but I was dead wrong. This first attempt was with the linear blending mode. Here is the first combo results. The first animation is cancelling into the next one.

resources/images/2016/02/swordanimation02.gif

Part 3

Finally to wrap it up I decided I would add 2 major “hub states”. This is to say I have 2 idle poses. A standard idle pose with the characters weapon sheathed and an attack stance which the player must be in to execute attacks. When in the attack stance the players movement speed is reduced.

Here is the state machine graph that shows a general overview of the flow between all the animations and animation states.

resources/images/2016/02/03.png

Tags: tower jam unreal4

TowerJam 003 Adding the forest area

2016-01-23 3:44 PM

Did some work this morning on finishing up the base of the bridge area and adding in the forest area. Now there is a complete path from the starting point to the tower. As you move towards the core of the forest I change the tint towards a washed out greenish color.

I also took a second to step back and focus on what to do next.

  • Add attack animations and logic to the character - Finish the graph paper floor plan for the first floor of the tower - Setup the streaming level system to allow me to transition into the first floor of the tower

Here’s some screenshots of the forest and bridge areas.

resources/images/2016/01/01.jpg

resources/images/2016/01/02.jpg

resources/images/2016/01/03.jpg

Tags: tower jam unreal4

TowerJam 002 Designing the tower and surrounding world

2016-01-18 7:54 AM

I started by designing the world around the tower because in my head I wanted the start of the game to involve the player approaching the tower in a fashion that shows how vast the tower is. To do this I have the player start a few kilometers away from the tower with the tower in view.

The world design involves the player starting in a small mountain peak town with the tower in a distant view. This is used as a beacon much like the north star to guide the player. The world will be designed to also guide the player and blocking geometry will be used where appropriate.

Here are the first two sketches I made to get a rough outline of the world :

Quick design of the tower splitting it up into its major sections.

resources/images/2016/01/towerjam_devlog_01.jpg

Topdown view of the world (tower is in the center top)

resources/images/2016/01/towerjam_devlog_02.jpg

Side view approaching tower :

resources/images/2016/01/towerjam_devlog_03.jpg

After drawing this I began blocking out the world in the Unreal editor to quickly establish the scale and world size. Important to get that right as early as possible to reduce the pain of fixing scale issues later. As I worked onthe layout the world design began to change relative to my sketches. There’s many reasons this happens. One of the main reasons is that once I have something in 3D I can frame the world using the game camera in different ways and see issues I couldn’t see when only desgining on paper.

I will most likely go back and redraw the world overhead view again to reflect the new world. At that point I wouldn’t be surprised if the design changes again when I got back to taking a big picture view of the level. This kind of iterative and destructive design I find immensely helpful early in the project. This is the point where throwing out things that don’t work is the cheapest to correct so it’s important to make as many mistakes as possible.

Here is an in-editor screenshot of the world at the point this blog was written.

resources/images/2016/01/towerjam_devlog_04.jpg

Finally I think many blog posts for this game jam will have a cliche shot of the player standing with the tower in the background

resources/images/2016/01/towerjam_devlog_05.jpg

Tags: tower jam unreal4