I’m posting this in the forum because I would like to hear other opinions on this. In a classic beat em up style game, how do you think the enemies moved toward and around the player?
From what I can tell, most BEU games seem to have the enemy try to achieve the same “horizontal line” as the player ,as the primary objective. As if a horizontal went out of their feet in both directions for hundreds of feet or infinite. And then once they (the enemies) achieved it, they moved left or right toward the player till they were right next to the player. Then in a fraction of a second they would attack the player. In which case the player could dodge if fast enough. In some games, like Golden Axe, if that horizontal line was achieved for more than a few seconds, AND if the enemy is basically on the other side of the screen or far from the player, they would do a dash attack and charge the player in a straight line, and in which case this usually made for some comical times as the enemies could be easily juked while they charged off a ledge or such.
I noticed on the game P.O.W., the enemies would attack, then drop back about 6 or so feet then move in again for another attack. In Streets Of Rage, I noticed the enemies attack, then do a half circle around the player, then circle back, and when they are at about a 45 degree angle, they moved in an attacked again, and its rinse and repeat.
So yeah, I would like to hear any opinions and insights others have on enemy movements in a BEAT EM UP style game. Thank you.
Unless the player has some sort of cleave or area attack, I think it works best if the enemies go to the player’s horizon line first. While it looks more natural if they approach from all angles, it can feel cheap if you can only attack left or right.
Having them back up and charge back in like Golden Axe can make them feel smarter without being able to cheese you from multiple directions.
Alternatively, you could break the mold a bit and use orient rotation to movement on the player so thy can attack in all directions like an ARPG. Diablo 3 and 4 can almost feel like a beatemup at times when played on gamepad.
The problem with UE4.27 (and idk if 5x fixed this) - is the default settings in Epic’s Movement Component - for how it handles depenetration force. It is too extreme.
This means that if 2 characters occupy the same space (e.g. Player does a dash attack into AI) - then Epic’s settings force the AI to either jump (go airborn for a second > play the IsInAir animation) or be hit off a platform/in the Air (get lost in the level), as tho it was a lightweight pingpong ball = unrealistic.
So to answer your question, you also need to solve for the problem above (which for me involved a lot of tinkering with 10 variables - time waster).
Answer to your main question:
I made my SS character locked on axis, but made my Enemy characters unlocked, and spawn them off axis. And Epic’s Navmesh made them automatically seek my Player’s axis - until within attack range.
And I made it so my player can push AI’s off his (player’s) axis. (But I want giant enemies to block player - cannot be pushed.)
This [pushing AI into 3D] is good to keep enemies 10 units off Player’s axis, so that his axis doesnt become blocked/cluttered (unless you want enemies to block Player path).
This is also good for mob attacks (can have multiple enemies attack Player since they are not axis locked = they can circle around player). I.e. it’s good to allow Enemies to encircle Player so that Player cannot exploit by using lesser Enemies to block high-threat enemies from reaching Player - if they all had to travel in a straight line (axis locked).
And that [encircle] is good for immersion in 3D. Thus you can introduce player AOE attacks (spin to hit enemies that are in the 3D plane, even if Player only moves in 2D).
Make a second type of AI that is axis locked to X = -10 (e.g. for Bosses or giants that you want Player to face directly). So AI arms/attacks are within range of Player’s axis (X = 0).
This keeps the Player’s axis free from clutter / avoid Mesh-animation-clipping (since SK mesh usually goes outside of Capsule radius during animations - thus we need to force some separation distance). And gives priority AI’s their own axis to quickly get to Player.
Also make a specific axis for spawning pickups (+/- 5 or 10 units from Player, so Player’s Capsule can still hit). But this provides less clutter and more 3D.
Again, the main problem is Epic’s default physics settings, which are extreme or have weird default values (like 750000 instead of 100 or 1000). And I havent seen anyone post what exactly each value does, and which is most significant to make physics react how we think they should, according to a mass of 100.
But I believe “Depenetration” was one of the significant variables.
There are 5 settings to change to get Player-push-AI to work, without extreme AI launching:
Two settings in Player BP, 3 in AI BP.
Player BP: Capsule Component >> Collision:
Pawn = Ignore or Overlap; and PhysicsBody = Ignore or Overlap.
If Pawn block = AI blocks Player path (bad)
If PhysicsBody block = Physics bones (hair) glitch with body
(AI should be using the Player’s Capsule Collision set to Block, to stop foot trip, but can’t because Block on, will mess up Player’s physics bones on the Mesh collision.
Player BP: Mesh >> Collision:
Pawn = Overlap or Block; and PhysicsBody = Overlap or Block (works to Nudge AI out of the way, but AI trips on Player’s feet)
AI BP: Capsule >> Collision:
Pawn and PhysicsBody = Block (as is).
AI BP: Mesh > Collision:
PhysicsBody = needs to be Overlap – to not Body block (stop) Player movement (because we want to push AI to the side. But the problem #1 is AI trips on Player’s Mesh foot).
Most important to reduce extreme Physics collision:
AI BP: Character Movement Comp >> Character Movement: Jumping / Falling:
Had to turn off Impart Base Vel X, Y – or else when AI trips – he jumps/launches off the platform.
Braking Deceleration Falling = 2000; and Air Control = 1: had to set to reduce extreme launches.
[And maybe a change to “Depenetration” was not needed. I think [IMPART BASE VELOCITY X, Y = OFF] was the significant variable.]
Also some old notes for settings to stop the push on Giants. (I forgot which were valid after I changed my physics setup, or it didnt work):
AI > Character Movement Comp > CM: Jumping
Air control = 1.0 (was 0.05). 1 = better?
Braking Deceleraton Falling = 2000 (works at min, with off X,Y, but still airborn)
IMPART BASE VELOCITY X, Y = OFF
mass 10000 = still z jumping high
NEED DEPENETRATION with PAWN at least not 0 = nudge AI in same path, avoid exploit
Max DEPENETRATION with PAWN = 100 (works to nudge, but still push exploit)
As a casual player I would expect normal enemies to get on same X with me while they also shortening the Y distance. So diagonal movement to X and then the rest.
They can also wait for their turn before starting reaching X and then Y, like classic movie villains who never attack all at the same time - if X line on one side of the player is occupied they join the queue for that side or try to reach opposite side if its free.
Smarter enemies can first try to reach me on Y, ignoring the X and only align themselves with me on X when they close enough for attack.
Uber ninjas can do same as above, plus actively avoid my X line, if I move to be on same X with them they also move up or down sticking to safe zone. Would be extremely annoying though.
Not sure if it’s really fixed, per se, but I was experimenting with a dash attack which changes collision response with other pawns to only overlap for the duration,then switches it back to normal at the end of animation. If I dash and end up inside another pawn now, it seems to gently nudge one of them away instead of turning one into a ping pong ball. Could just be dumb luck though that I’ve not ended up in the inverse sweet spot which would yeet a pawn back in 4.x. Might also help that my characters are120cm tall goblins thus having smaller capsules than typical humans or mannequins
Great. This is what I want (and what Id expect Epic to code as default behavior).
Can you please share the code/pic? Thank you.
Also how I test to check if [whatever I did stops the “ping-pong-ball” glitch AKA launch other player away]:
I run back and forth past an enemy, and repeat 10 times to see if he gets launched away (broken settings) or not (fixed).
What I see is that running past an enemy makes them go Airborn for a brief time (to Depenetrate by choosing to move Z up instead of XY out of the way?). And thus it plays the IsInAir anim. But I think this is just a reaction from Epic’s bugged push force settings.
Running into an enemy should not make them go Airborn at all (Z launch force), but only push in the XY axis.
In my [Character Movement component] settings-post above, I sort of fixed it by making the Enemy recover faster from Airborn launches and I disabled XY movement (IMPART BASE VELOCITY X, Y = OFF) since Z is still forced (I think I couldnt find a way to disable Z). Thus [disabled XY] since I didnt want them to ZX-launch off of Platforms. But it’s not perfect because Epic’s code still forces a Z launch to nudge/depenetrate.
Might just be 5.x toned down the z for the depenentration nudge.
If you’re still using 4.x, maybe it would be less bouncy if you ticked the can step up on option for the capsule collision? The bounceback when landing on another capsule was always a bit high, and maybe that’s also triggered on penetration?
Thanks.
Oh youre using UE5x? That might be the fix for UE4.27’s problems and abandonment
My thinking was that if AI can try to step on Player’s head Cap, then it would jitter/glitch out since it’s not a flat surface - cause air time, and thus prompt weird physics/launch.
But if AI cant step on Player’s head, then this seems to force Airborn [velocities/calcs] anyways. So I’ll try your suggestion for UE4.27.