ID:2336613
 
Utilizes forum_account.keyboard's library , and Jtgibson's ActionLocks snippet

http://www.byond.com/forum/?post=195092
http://www.byond.com/developer/Forum_account/Keyboard


You can improve around line 146 in ActionLocks with the following:
!lock_duration?(actionlock -= lock):(actionlock[lock] = lock_duration)





You don't have to use forum_account's keyboard library, it's simply what I'm used to. Feel free to test out http://www.byond.com/developer/Kaiochao/InputHandler


The goal here is for movement in this tile based game to be more fluid and responsive, while also allowing single tile movement . To do this I had to play around with sleep settings and movement delays until I came up with something that would allow you to easily change direction with the character without moving too quickly to the next tile or moving multiple tiles. You're free to toy around with the delay between movements.


Now to the code:
client/var/moveKey
client/var/prevMoveKey

mob
var/moveTime=0
var/movecounter
var/newmovedelay = 2.1
var moveHalt

key_down(k)
if(k == "north" || k == "south" || k == "east" || k == "west")
client.moveKey = k

key_up(k)
if(k == client.moveKey)
client.moveKey = null
client.prevMoveKey = null

proc/move()
set waitfor=0
if(client.moveKey && !moveHalt && client.prevMoveKey == client.moveKey && movecounter>0 && movecounter<2)
moveHalt=1
if(moveHalt && !(movecounter>0 && movecounter<2))
moveHalt=0

if(moveHalt && ActionLock("newmovedelay", newmovedelay))
return
if(client.moveKey && canmove && !ActionLock("moveDelay", movedelay))
sleep(world.tick_lag)
if(client.prevMoveKey != client.moveKey)
movecounter=0
movecounter++

glide_size = world.icon_size * world.tick_lag / movedelay

switch(client.moveKey)
if("north")
step(src,NORTH)
if("south")
step(src,SOUTH)
if("east")
step(src,EAST)
if("west")
step(src,WEST)
client.prevMoveKey = client.moveKey

mob/var
movedelay = 1.3

world
fps = 75
New()
..()
spawn movementLoop()

client/fps=75

proc/movementLoop()
while(1)
for(var/client/c in worldclients)
if(c.moveKey)
var/mob/p = c.mob
p.move()
sleep(world.tick_lag)
var
list/worldclients = new

client
New()
..()
worldclients += src
Del()
worldclients -= src
..()


I know it isn't perfect, so feel free to suggest improvements. This is a start and I would love to see someone post their iteration or changes they'd make :)
It's up to you how much you want to modify the newmovedelay , but I found 2.1 to work the best for me. You could also potentially let players modify this variable themselves, or choose from a list of specific delays.

Please note the following: I have tested the movement system without a sleep vs increasing the delay on movement, and the movement always appears to work more smoothly, vs adding that amount of time to the ActionLock delay. Therefore, I am using the depreciated waitfor in this.

http://files.byondhome.com/Chaokai/ Rise_of_Heroes_Unlimited.zip

Above is the system in action. If you're interested in the future of our project, feel free to check it out here
You can vastly improve BYOND's smoothness using an FPS of 100 for both the world and client.

At a MASSIVE cost to the server. This should never be done for a multiplayer game because of the way that BYOND sends periodic viewport information across the net.

This is dangerously stupid advice.
Unless you have a bluespace crystal attached to your CPU ^