How to move square by square, dungeon crawler?

Hello, i’am French and my english is very poor, sorry :wink:
I make a dungeon crawler, but coding is hard for me… but I learn fast :wink:
How to move square by square like a dungeon crawler with blueprint ?
thanks for all

Hi there,

this might help you, and there are lots of discussions to learn from :slight_smile:

(there is even a link for template samples to download)

hth :slight_smile: Marooney

Thanks Marooney… but it will take me some time to understand how to do it in 3D …
Ideally, I wanted to put a distance of movement for not doing grid …

When you have a top-down view with square by square movement then you will have grid movement :slight_smile: Or do want to create a side-scroller?

Do you know dungeon master or Grimrock? you would not think … The view is that of a fps and the displacement is by square … or by distance (eg 150u)
And I see that everyone says it is easy or suggests, the sort requires blah but nobody knows exactly how to do … Also I found 2 different examples approaching what I want with cubeblocks and GridMove and it is far from easy after studies of BP …:wink:
No I think the simplicity displacements by distance will be simpler … but may be I am wrong
I am currently testing …

I just watched a youtube video of that game. I have played similar games decades ago.

How do you create your dungeon? If you use cube blocks then you need to arrange them. And in the end you will arrange them as a grid anyway. So you will have grid movement. Which is your distance movement.

What is so wrong with the first sample i gave you? It works for FirstPerson View as well. (How should I implement grid based movement - Character & Animation - Unreal Engine Forums)

The first screenshot shows you how to check if there is a wall:

You press forward once, the look direction of the character tells you which direction you want to move the character within your map. And then you just need to implement the screenshot. If the hit result is false (no wall or closed door) then you can execute the second screenshot.

The second screenshot shows you how to move the Character. GridSize 100 where 100/2 is the middle position of the cube.
And the Timeline handles correct movement over time to the target distance.

Just try this on a simple plane, you will have your “distance” movement like that in any direction you look with your character. And you will get the Grid-Movement for your cube blocks by snapping rotation to 90 degrees (like you see in the Grimrock game).

Hope that helps :slight_smile:

“And I see that everyone says it is easy or suggests, the sort requires blah but nobody knows exactly how to do” Once you are able to handle others suggestions and solutions, you will be happy that people know what they are talking about.

And to be able to understand what people say and to be able to extrapolate information of other tutorials, I highly recommend you to watch as many videos from the following playlist as possible. Short and compact basic knowledge. If you think you do not need them, you will run straight into issues by not knowing things. People just lead you the way, and the playlist shows you how to walk :slight_smile:

I watch videos for over a week, but my English is limited,
and my brain too :wink:
The worst is that I do not want grids or other things to learn too long, I just want to give away the forward, backward, strafe left and rotation etc …
When I see 3/4 nodes for movements default and complexity of other stuff with grid, I told myself that it’s not normal to make 8 pages of blueprints :wink:
In any thank you again;)

No need to be afraid of these tutorials :slight_smile: It is really just about these 2 screenshots mentioned there :slight_smile: I have put this together for you now. So this sample solves all you are asking for:

For this sample you need to create a new FirstPerson Template Project.

Within the FirstPersonCharacter Blueprint:

Add these two events:

  • Move takes the direction you want to move to. Calculates Start and End location. Does a LineTrace towards the destination. And if nothing gets hit, it starts the Timeline which does the movement. DoOnce makes sure the timeline does not start over again during movement.

  • Rotation is similar but does not need the LineTrace. Rotation is handled by the PlayerController so you need to set the values there.

Interpolation is done by the Alpha-value which is the percentage between the fixed Start and End values.

TimeLine Curve for Movement and Rotation Timelines. You can adjust the Curve as you wish but keep the value between 0 and 1:

And now you just need to handle Input. Replace some existing nodes within the Blueprint.

Movement - where you need to get the direction vector:

Rotation - where you need the YAW direction. I’ve put a mouse input leeway in, to avoid rotation on a single mouse input:

Have fun :slight_smile:
It works on my side, so if you have any issues, feel free to ask :slight_smile:

And if this solution works for you, please click the accept answer button on the left side of the answer :slight_smile: The answer will turn green and the Question will be marked as [RESOLVED] for everyone. Thx :slight_smile:

Btw. Implement the Movement at first and play around with. And after that the Rotation. That makes it easier for you to understand what is happening. Because then you will realize, this is already the Grid-Movement :slight_smile:

Oh, and if you move while the character is rotating, you will have a wrong direction (leaving the grid). Just avoid such input for now and you can fix that pretty easy later on before someone else plays your game. (You can use a Gate-Node in the Move-Event that gets closed while rotating)

Hello my savior … or anyone;)
After 2 days:
First day I understood (+ or -) your code and have applied for my keys … Hooray;)
Second day, I try to stop the rotation during movement (move_event) with gates … Failed … Same with the keyboard and I have no ideas …
I found a post but it does not work for me… or I’ve done wrong …

Otherwise, I also have a slight problem with collisions …
When I click many times a key movement, I cross the walls …
And one last thing about the movements …
That with the right mouse click to bullback with both axes and disable the movements and rotations … a track? (Surely input_active / Deactive but for the right click …)
Well thank you in advance … or not :wink:
PS: I post the imgs for the next…

For the next with the same problem but we must first make the two events (move and rotate) posts by Marooney …

For the next with the same problem but we must first make the two events (move and rotate) post by Marooney …

Hey, my solution for your problem was just one of a thousands ways to solve something. This was the easiest and shortest one with ThirdPerson Template I figured out for you. Because you don’t have any dungeon right now. And you don’t want to face your dungeon Grid that explicitly for now.

This is the Gate solution to block the Movement during Rotation. Rotation during Movement is ok, because StartLocation and EndLocation are calculated at the beginning of the movement.

You only face your collision Problem on the ThirdPersonExample Map which is not set up for your movement “Distances” (No Grid and inappropriate obstacles). You can still set the “Sweep” option at SetActorLocation that handles collision for you. But in your dungeon you will not have a wall or door in the middle/center of your “Cube” anyway, just on the sides. And this collision is already handled by LineTrace.

In your dungeon you need to set your Character into the center of your first tile/cube. If your character collides for any reason, it will be off grid for further movement. So you don’t want to use the sweep option.

Thank you, but it does not work :wink:
What I think by my tests, in my opinion because the door opens a time T, and, going the 2 flux (shown in graph_event)
I think the only way is to completely cut the key / flow while the other is execute …
I glimpse myself as the character “steals” in a vacuum, so I quickly click the movement… For now, I add a delay at the end of the event that corrects collisions and levitation but it slowed the gameplay :frowning:
Again thank you very much even if it is not the point :wink:

After several tests, I understood that the curves lerp was the problem … If the last point of the curve is equal to the length, so it creates a lag with the full accomplishment of the movement because each time, from 0.1 the curve is not fulfilled … (regardless of the length: 0.15 to 0.14 for the rotation and last point, works very well)
In fact, I think the gate was not working because it was a lag of rotation, while the gate works perfectly !!!
This also caused collisions problems …
I still have two problems:
1 major: The character does not fall as the buttons are pressed …
1 minor: When collision sound is played several times at the same time …
Thank you