Smooth Tile Movement

by FIREking
A demo showing you how to achieve perfectly timed gliding for smoothest possible movement.
*Waits for it*
I am still new but I guess I need to ask and just hope my conclusion isn't flawed due to ignorance.

From my testing I have found that the 'skipping' or 'jumping to position has to do with reinitializing the process of moving before the current move has been completed.

When called in an AI loop with a set speed of every .2 seconds it skipped alot. I set the loop to .4 seconds and it was virtually gone, moved transition speeds up so players moved faster and the skips/jumps returned.

Does this jive with anyone else's knowledge?
I have mixed this with some diagonal code and it took me a bit to narrow it down.
You shouldn't use walk_ functions with this demo. This is why its not a library.

This is how you should use it:

proc/real_walk_to(ref, trg, min = 1)
while(ref)
if(get_dist(ref, trg) >= min) break
step_to(ref, trg)
sleep(get_speed_delay(ref:speed))


Cardinal and diagonal work smooth if you use the get_step_size() proc and tell it your speed and your direction

In other words, you shouldn't see any skipping or jumping if you use my system properly.
I am more than willing to accept that I am having trouble learning to use this engine, but I can't seem to undertand how to implement this.

Even just taking the demo as is, the skipping and jumping is present. I thought it was something I added or changed or how I was using it.

Just using the WASD movement it's great I can't make it skip no matter how hard I try.
Using numpad, diagonal skips every step when held.

It boggles me that the if the system can already see that mobs/objs are size X and have a step size of X, why it doesnt check that the transfer is done before trying again.

I really like this engine but sometimes it's the simple things that give me the biggest headache!
It is skipping with the number pad because the built-in procs that call client procs such as North() are not overridden (which means its trying to move outside of my system), adding this code will remove that...

client/North()
client/South()
client/East()
client/West()
client/Northwest()
client/Northeast()
client/Southwest()
client/Southeast()


I tried implementing this in my game, though when I include the code files, I can't move my character.

Any help?
Just wanted to pop in and ask if there were any sort of terms of usage for this snippet. I'm especially fond of it and wanted to make sure I'm giving the right sort of credit to you for using it. Are you okay with potentially being used in commercial games as well?
In response to LordAndrew
LordAndrew wrote:
Just wanted to pop in and ask if there were any sort of terms of usage for this snippet. I'm especially fond of it and wanted to make sure I'm giving the right sort of credit to you for using it. Are you okay with potentially being used in commercial games as well?

I am giving permission for this code to be used for any purpose.
Page: 1 2