2 Oct, 2016

Cheats 4 Hires Movement System

This blog post was originally written for the Travian Games GmbH and was published at the Cheats 4 hire Blog at first. The copyright still belongs to Travian Games GmbH.


The Requirements

For our character movement we wanted a system that

  • Feels fluid
  • Is self-explaining
  • Feels natural on touch devices
  • Give us the possibility for interactive visual feedback

It wasn’t easy to find a solution but we think that we’ve got a result which fits into the game, is touch friendly, easy to learn and covers all of our requirements.

But at first I’ll tell you more about our first step and explain some of our ideas.


The first step

Early on we decided to have a grid based map. Floor tiles representing the parts of the classroom, which are walkable and visualizes the playable map.

The floor tiles give us the possibility for interactive visual feedback and are self-explaining in case of the walkable area.

After this first step we’ve thought about many different ways to let our characters walk and tested a lot of them.


Idea 1 – Point & Touch Pathfinding

We’ve thought about a point and touch path finding system were you touch on a character and than on the floor tile that you want to reach. The path to the target floor tile would be calculated and highlighted automatically. That worked great so far but it restricts the player as well, because he can’t define his own route through the classroom. We wanted more freedom in case of the movement path because it is sometimes necessary to make a detour to the target floor tile. For example if you don’t want to walk into the teachers or teacher’s pets view cone or hear radius. So we’ve decided to discard this idea.



Idea 2 – Point & Touch waypoints

Our second approach was similar to the first idea but instead of the path finding we thought of a waypoint touch mechanic. It seemed to be great to touch on your character to activate the movement mode and than create waypoints for every touched floor tile. This solution kills the problem from idea 1 were you couldn’t make a detour but sadly raises other problems. We had two major issues with this idea. The first was that it is very hectic to touch every single waypoint on the tablet. The second issue was that we couldn’t imagine a good solution for executing the movement and to smoothly undo already set waypoints. As you’ve already guessed we’ve decided to discard this idea as well.



Idea 3 – Draw the path

The third idea was a very different approach because it seemed that the point & touch ideas won’t work very well. So we’ve thought about a more touch friendly movement system and came up with the idea to just “draw” the movement path. We’ve roughly implemented the system and it worked quite well. It felt natural on touch devices and could easily be triggered through dragging a character and than just drawing the path to the target floor tile. This idea matched all our requirements except for one: It felt not as fluid as we thought. But we’ve decided to stick with this idea.



Why does it not feel fluid?

Our characters can’t walk in diagonal directions so it should only be possible to draw the path vertically and horizontally. But it’s not that easy to draw a straight line if you’re under pressure and have to draw it very fast on a touch device and if that wasn’t enough the isometric perspective in our game enhanced the level of difficulty significantly.

In addition we have blocked floor tiles were you couldn’t draw on. So if you draw over such a blocked floor tile the drawing stopped because the path must not be interrupted.


Make it fluid!

We’ve thought about how to fix our fluidity issue and came up with the idea to interpolate steps between floor tiles if you draw over blocked floor tiles.


This worked very well and the draw mechanic felt more fluid but there was another problem. If you draw too fast the game can’t recognize that you’ve drawn a path across the whole map. But that issues was fixed and combined with more interpolation rules.



As you’ve seen in the images above, there are a lot of different possibilities to interpolate the steps between floor tiles and we couldn’t add an interpolation rule for every possibility. So we thought about another interpolation solution and came up with the idea to use a path finding subsystem between the last possible floor tile and the next possible floor tile. The path finding subsystem then generates a list of floor tiles that are lying between them. This list is used to automatically handle the complete path behavior between these two floor tiles.

The path finding subsystem brought us to our final character movement system.


Final thoughts

To sum up our solution for a fluid character movement system: We’ve created a system which uses a hand drawn input for the path that is supported by a subsystem which interpolates the steps between not connected floor tiles if you draw over blocked floor tiles or too fast in general.

The iteration of this system took us about 1 year but we’ve not constantly worked on this feature. It’s worth to take that much time because now we’re convinced that we’ve created a great character movement system that fits very well into our game.

I hope that you’ve enjoyed the read and got a deeper insight in our iterative development process of one of our features.

Christian Putzke

Hi, I'm Christian! Proud Father of two little princesses. Tech enthusiast. Passionate Console-, Computer- and Board-Gamer. Open Source Software Developer. Coding Games at TreasureHunt. Additionally you can find me on GitHub, Twitter, LinkedIn and Xing.