Simplistic Cover in Unreal Engine (0): Introduction

Last year, Epic Games released their Unreal Engine out for free. Anyone can download it! It just takes heaps of gigs.

I hit up a few tutorials and was putting together some really basic stuff in my spare time. After enough fiddling around, I thought, "Epic Games made Gears of War, and I liked the cover system in it. Why not try to do the same?" So, I tried and... well, if we're talking about movement only, I'd like to say I kinda succeeded.

If I'm remembering right, most of the movement during cover was done by players - when the AI took cover, it'd usually sit around in one spot until it had to move. 'Course the game's not on me right now, so I can't check, but the point is, you don't have to worry about the AI doing this. You just have to make it for the player.

So to get started on a cover system, well... we need a cover button. But once you got one (pretty easy) what does it have to do?

  • If the cover button is pressed, the player should slide to the nearest usable cover
  • Once in cover, all movement should make the player walk along the surface of the cover, even if it's curved
  • If the player reaches a cover edge, he should not be able to move past it

Honestly, I did this in the most simple way possible - by forcibly adding movement input towards cover in addition to what the player input, and I mainly settled for this because of curved cover.

With square cover, you can easily calculate a destination to move to every frame by getting the tangent of the cover surface. However, do this with curved cover, and you might steadily spiral away from the cover since its tangent changes so much. 'Least, if you want to calculate destination points like this, you'll have to do some more complex math.

Cover edges adds a more complex dimension to the entire shebang, but at least I was able to deal with it. You can check it out what I did at Youtube, but I'm gonna go into the details here on my blog.

There's probably a way to do it by subclassing UCharacterMovementComponent, but that class is pretty labyrinth. I imagine a second pass at this would see me making that subclass, but for now, we're just subclassing ACharacter and overriding functions there.

And also, I'm not going into cover actions right now. Personally, I think that's more simple than the movement part, so that's where I put my effort for now.

Next Post:
Simplistic Cover in Unreal Engine (1): The Cover Slide and Cover Point Selection - Memories of Melon Pan