Adding a custom movement mode to Unreal’s CharacterMovementComponent via blueprints

This isn’t a full tutorial, and I’m not an expert, but I noticed this knowledge wasn’t really collected together anywhere, so I’m putting something together here. Please shout if there’s any holes or mistakes.

The CharacterMovementComponent that comes with the third-person starter kit has several movement modes you can switch between using the Set Movement Mode node. Walking, falling, swimming, and flying are all supported out-of-the-box, but there’s also a “Custom” option in the dropdown. How do you implement a new custom movement mode?

First, limitations: I’ve not found a way to make networkable custom movement modes via blueprint. I think I need to be reusing the input from Add Movement Input, but I’m not yet sure how. Without doing that, the server has no idea how to do your movement.

When you set a new movement mode, the OnMovementModeChanged event (which is undocumented??) gets fired:

movementmodechanged

At this point you can toggle state or meshes, zero velocity, and other things you might want to do when entering and leaving your custom mode.

The (also undocumented) UpdateCustomMovement event will fire when you need to do movement:

updatemovementmode.PNG

From here you can read your input axis and implement your behaviours. You can just use the delta and Set Actor Location, but there’s also the Calc Velocity node which can help implement friction and deceleration for you.

To return to normal movement again, I’ve found it’s safest to use Set Movement Mode to enter Falling, and let the component sort itself out, but ymmv there.

Hope someone finds this helpful.

Advertisements

Game AI Pro chapter on Context Steering

I think every few years I’ll be destined to make a blog post that starts “oh I have a blog don’t I.”

You can now get the chapter I wrote about context steering in Game AI Pro Volume 2 for free on their website:

http://www.gameaipro.com/GameAIPro2/GameAIPro2_Chapter18_Context_Steering_Behavior-Driven_Steering_at_the_Macro_Scale.pdf

Melbourne Games Week

Oh yeah I have a blog, don’t I.

I’m going to be in Australia for the week of the 31st October 2016. I’ll be appearing in the Unite Melbourne (https://unite.unity.com/2016/melbourne) keynote and doing an Alphabear post mortem at 5.30pm in Room 1, both on the 31st. I think the former might be streamed live? But I haven’t got a link yet.

I’m also doing a Fireside Chat at GCAP at 2.10pm on November 2nd with Laura Voss: http://gcap.com.au/sessions/laura-voss-talks-to-andrew-fray/. I’m excited about this because I don’t really know what to expect, but hopefully I can entertaining and informative. Enterformative.

I’m leaving late on the Friday, but have no other firm plans. If you’d like to meet up, let me know here or on twitter!

How did I get into AI gamedev?

A computer science graduate got in touch with me via an academic friend, interested to know how they could become a games industry AI programmer. They seemed interested in what kind of masters course would help their career. Although that’s definitely possible, it’s not the route I took. My full answer follows:

I’m not currently an AI programmer, but I was one in a former life, on games like Operation Flashpoint Dragon Rising and F1 2010/2011. To pimp myself even more, I’ve spoken at GDC’s AI Summit, been profiled on AIGameDev.com and published a chapter in Game AI Pros 2.

The simple answer to your question is that it’s really hard to get in as a graduate AI programmer. I don’t think specific courses would help as much as devouring sites like AIGameDev.com. Infact their sister site nucl.ai has a good intro-to-AI online course that goes beyond mere pathfinding: https://courses.nucl.ai/. You can also dig into the GDC (Game Developers Conference, the biggest event in gamedev each year) vaults for lectures under the AI tag. Most recent ones are paid only, but some are free and all 3 year+ ones are free: http://www.gdcvault.com/browse/?track_category=1402.

Hopefully some of these will inspire you towards some side-project work that you can bring along to industry interviews.

The route I took was initially becoming a graduate gameplay programmer, and making it clear to my bosses that I wanted to transition into AI as fast as possible. Many smaller studios (which is almost all of them in the UK at the moment) might not have a dedicated AI programmer, so as the “AI guy” gameplay programmer, you can grab the odd task here and there that might look good on a future CV. I used that approach to do animal AI on a zoo expansion to Rollercoaster Tycoon 3, and to prototype pathfinding for thousands of actors with very limited Playstation 2 (!) resources on a rollercoaster game that was so crap I won’t namedrop it. 🙂

That took just over two years, and once I had that I was able to apply to other studios and get jobs on dedicated AI teams. All the while learning about the realities of shipping games, even if I was sometimes working on UI instead of AI. I think that’s a much better use of time than a masters. Sorry [my aforementioned academic friend] Nick!

If you’re interested in the hot topics in the gamedev AI world at the moment (which is needless to say very different from academic AI), check out monte carlo tree search, recurrent neural networks, and AI-assisted tooling. Slightly older tech includes Hierarchical Task Planners, Behaviour Trees and Utility Systems.

Hope this helps. If you have any followup questions, just shout.

What do you think? How did you get into the industry? How was your experience different?

Remote Working at Spry Fox slides

Here are my annotated slides to last week’s GDC talk. The attendance was good and the vibe I got was that people enjoyed it! Last year I (eventually) screencasted my unit testing talk and put it on youtube; I’ll update the blog if I get around to the same with this. It’ll also be on the GDC value soon, and I’ll ask if they’ll make it a free talk.

GDC 2015 – Remote working and automated testing

I’m speaking again at GDC in March. This will be my third GDC in a row, yet I’m no less nervous!

On Wednesday at 11am, I’m speaking for half an hour on remote working at Spry Fox (room 2020 west). I’ll be covering tools and processes, but the things I’m most interested in talking about are the qualities of a good remote developer, and the hacks we use to build a tight supportive team out of people of different continents.

On Thursday I’m building on the success of last year’s unit testing talk to chair a roundtable on automated testing. Anyone interested in any strata – from CI servers to smoke tests to unit tests – should come along. Bring war stories, gotchas and hacks.

If you’ve got ideas you’d like raised during the roundtable, but can’t make it to San Francisco, why not leave a comment below? Here’s some questions to get you thinking:

  • What’s the coolest piece of automated testing tech you’ve seen used?
  • What’s the most dramatic improvement you’ve seen after introducing some automated testing into a process?
  • Are there any kinds of automated testing you find don’t work so well with games?
  • Do you think automated testing is mainstream yet? What more can we do to sell various types of testing to the management?