Custom player movement for isometric game

Hi,

I’ve been working on some issues with player movement, I wanted to share here for feedback on how it’s working, and also in case there’s been something built into the standard controls that I’ve missed that I could use to do this better.

In my game players are in an isometric maze (so with a fixed camera angle that can’t be changed) and will run around it.

Using the standard roblox controls you will always move straight up/down/left/right by pressing WSAD

Because of the isometric view these angles are ‘wrong’ here and it makes running down a corridor a lot harder than it should be.

My first attempt to make this better was to rotate the control movement vectors so that they align with my camera view. I couldn’t find any customisable properties for this, so forked the player ControlModule and it’s a fairly simple change in there to fix how the moveVector is calculated.


This feels better, walking in a straight line down a corridor is easier. But as the corridors and corners are quite tight it is hard to move smoothly, and its still easy to get stuck trying to turn a corner

My final change was to customise the movement logic to keep the player moving in the direction they have chosen, until they hit a wall, when they will stop. If you press to change direction while moving I’ll wait until you are in the middle of a grid cell and then raycast to check that there is no wall in your requested direction. If the path is clear then you change direction. If not you keep on moving until there is a gap.
What this means is that if, for example, I’m here in the maze
image
I’ll keep moving forward. if I press “up” at any point before the junction, shown by the green line, I’ll turn when I get there.

It would be really useful to get some feedback on this, I’ve put together a test game here

There’s a button at the bottom which should toggle through the different movement modes.

I’ve tested this out on PC and tablet. I don’t have a controller here at the moment, if anyone does and would be able to see how/if this works on that, it would also be really helpful.

Thanks in advance,

6 Likes

very cool, could you explain what rotated is supposed to do with normal and custom?

I’m testing on mobile and I can’t find a difference when making rotated enabled

1 Like

Thanks for looking!

It will be about exactly what direction you move the virtual joystick in to move.

If it’s not rotated then I think on mobile you move exactly the direction you move the joystick in, so you move it straight up, you’d move straight up on your screen. If you move it up and slightly left, you’d move up and slightly left.
This is probably the best option here.

If you’ve got rotated on then on mobile if you move the joystick straight up, you’ll move up in my world-coordinates, so will be up and right on screen.

I think that the rotated version works better on PC and non-rotated works better on mobile.
But for mobile i think it’s a pretty subtle difference that may not be that easy to see.

thank you so much for this, anyways I wonder what this can be used for in the future. I see many great things that could come from this

2 Likes

I tested it and it was honestly so cool. The custom, rotated one is probably my favorite out of all of them. Also might want to turn off the collisions, when I tested it there were 2 other people there, and I tried running into them and it still worked.

1 Like

that should be a very easy fix

Thanks for looking!

You’re right about collisions, in my full game that will use this I’ve got those turned off already, I’ll fix that here as well as it works better without other people blocking the path.

I think that custom rotated is probably the best option for PC, I find custom unrotated better on mobile/tablet.

what do you think is best for console?

I’ve not been able to test on console yet cos I’ve got no controller here, so I’m hoping someone will be able to check that.
my guess is that custom rotated will be best there

(p.s. just updated to turn player collisions off)

(post marked for deletion for privacy reasons)

3 Likes

Thanks for looking!
Main game that uses this is here

https://www.roblox.com/games/6876491467

Here just a test place for the new controls, to try to check them out

I’ve updated the demo here to add a new ‘step’ mode where it will just move you one block at a time, rather than keeping moving until you hit a wall.
If anyone finds it useful I’ve uncopylocked the demo place here, so should be possible to get and use the code. I don’t need credit if you do, but would be nice to post a link back here or somewhere to see where it’s been used.

The code should be commented to show what it’s doing. If anyone has any suggestions on stuff that’s done horribly and can be optimised or made better then please let me know. The two main parts are in
StarterPlayer>StarterCharacterScripts>PlayerScript
and a forked control script in
StarterPlayer>StarterPlayerScripts>PlayerModule>ControlModule

Finally, would be really useful if anyone with access to a controller could try this out, would be good to see if it works OK on there too. I can’t find any way to emulate a controller in studio and don’t have one here to use, so I’m stuck testing it.

step works perfectly fine on mobile, great job

1 Like

Nice, thanks for checking, seemed worth adding in