First-Person Grid-Based Movement

Hey!

My goal is to create a 3D, First-Person Grid/Tile-Based Dungeon crawler, but I’m new to UE5, coding and blueprints. I took some time to watch tutorials on how to set up a character controller, but none of them set it up to move one tile at a time.

I would like there to be a slight delay between movements, and the player should be able to turn left, right, as well as take a step back.

If you’ve ever played games like Might and Magic or Wizardry, what I’m looking for is something along those lines.

Thank you!

1 Like

See if you could work with something along the lines of:

This should be set up with Enhanced Input but I could not be bothered, hope you can add it. Here’s the (UE5.2) project:

This is just a stub and can be vastly improved. Here, you can walk, rotate and not smash into walls.

Do you know if this code works in version 5.3? I tried it out but I couldn’t find the “switch on eDirection” node

It does. It’s an enumerator that you’d need make yourself. It’s trivial once you’ve seen one tutorial. There’s also the attached project.

The node and the method are optional, though. Many ways to make this work.

Nice! I managed to get it shortly after that, thank you.

I’ve been trying to improve the collision detection on it where the character will either move the full movement or not at all but have been stuck.

I figured the logic would have been something along the lines of, “If a collision is detected between point A and point B then player location equals start location else player location equals end location”.

This is already handled in the example above. In a much simpler way, too;

  • we trace ahead to see if something blocks the way
  • if so, the TL does not play

Admittedly, a capsule trace could make more sense.

I previously ended up switching to capsule trace and turned on sweep on the Set Actor Location, the character just really wants to bump into walls for me.

I must have missed something, possibly in my timeline template.

Not sure how this could be relevant. The trace produces data - use it. That’s before you even start moving or sweeping.

No need to run the TL if the way is blocked anyway.


Consider getting it working with regular line trace first, and only then switch to capsule trace. Perhaps it’s not set up correctly. If in doubt, post relevant script. Also, sweeping in a system like this seems unnecessary (but who knows what you’re up to!). Unless you use Sweep instead of Tracing that is.

This sounds a bit like:

1 Like

This helps so much! Thank you once again. This is the logic I was trying to figure out but didn’t know how using Blueprints.