Sign in to follow this  

Smooth Movement in RTS/Zelda like games? How is it done?[Solved]

This topic is 4516 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi folks, since my last posting concerning this was a bit misleading, i am reposting it here. Let's assume we have coded an 2-D-TileBased RPG / RTS where you can move in HEXTILES (like "Battle Isle", "Mech Warrior I"). I understand how this works generally (array with tiles and so on), but i think it looks bad, since every movement is just a change of the player/vehicle to another hextile. Now, let´s look at games like Zelda, Command&Conquer (early), StarCraft, Rage of Mages, Diablo,... The pure movement is "smooth" in these games, you click somewhere in your map and the char/vehicle moves (animated) to exactly that place (as there were no tiles at all). Now to my question, how is the technique called that allows this kind of movement? Which GFX Engines are involved (is it 2D? 3D? Iso?) and how are maps created/saved in these case!? I am really only interested in the movement/mapbuilding process, i know that accomplishing a game like diablo,... is not possible, but only this way of handling movement would really interest me. Thanks for your time! [Edited by - code_nerd on August 3, 2005 2:23:09 AM]

Share this post


Link to post
Share on other sites
Well, the maps could be made the same way (array of tiles). The type of movement found in games like Starcraft, Warcraft, and C&C, is actually very simple (until you start talking about pathfinding). What you want to do is have an end destination for your units, find the angle you would have to go to reach the end destination, and then use sin and cosine to move the unit along that angle at a certain speed until it reaches the destination. This will work just fine until you need have your unit get around an object/unwalkable tile. In order to do that you should probably look into the A* pathfinding algorithm.

Also , it doesn't matter if you are using 2D or 3D, the movement will be the same concept the same in both cases.

Sorry if I was a little incoherent, its early where I live, let us know if you need anymore help.

EDIT: I really didn't answer some of your questions, I'll post a better answer later in the day.

Share this post


Link to post
Share on other sites
The basic idea (from a mapbuilding perspective) is that while a map consists of a big array containing tile info and such, units are free entities that are instead stored individually and have their individual coordinates saved with them. These coordinates would be to a grid that subdivides the tilemap (splits tiles into many spaces).

That didn't come out as well as I'd hoped, but hopefully it gets you thinking in the right direction. [wink]

Share this post


Link to post
Share on other sites
hmm... let's see if i get it right

If thats the background:
xxxxxxxx
xxxxxxxx
xxxxxxxx
xxxxxxxx

And thats a spaceship:
...A
.AAAAA
..AAA
...A

...it does NOT work like this (move the complete spaceship
to background in one single step):
xxxAxxxx
xAAAAAxx
xxAAAxxx
xxxAxxxx

...instead like it works like this:
Axxxxxx
AAAxxxx
AAxxxxx
Axxxxxx

xAxxxxxx
AAAAxxxx
AAAxxxxx
xAxxxxxx

xxAxxxxxx
AAAAAxxxx
xAAAxxxxx
xxAxxxxxx

and so on.

Is "smooth" movement done that way!?

And, is it possible with all common GFX libs like DirectX, GDI+, SDL, OGL,...?

Share this post


Link to post
Share on other sites
If I understand your question correctly, you are asking how you can get your units or characters to move smoothly between tiles, rather than jumping from tile to tile, yes?

There's heaps of ways to code this, but the principle is that the position of the units doesn't have to be linked directly to the tiles. You can have units on "fractional" positions, half in one tile, and half out. This can be coded literaly as a decimal fraction of tile units, or as pixel coordinates, or in a variety of other ways.

Share this post


Link to post
Share on other sites
This article might help you understand how it's done. The player isn't just moved a tile at a time. The player has screen coordinates that are translated to map coordinates to determine what tile the player is on. When the player wants to move his position is just updated with the speed of the player. It's a little more complicated than that but that's the general idea.

Share this post


Link to post
Share on other sites

This topic is 4516 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this