Map pathfinding

One major thing I’ve been working on recently is the overall game structure. I wanted a Mario-esque overworld map, so I mocked up a simple graveyard for the first tomb-themed world. Something like this:

Navigating this map becomes an interesting problem to solve. On a console, you would use the joypad to move from stage to stage, and then press a button to enter a stage. On mobile, that doesn’t work. Well, unless of course you have an onscreen joypad, which I generally try to avoid.

The preferred interaction would be: tap on any stage anywhere on the map and the player will walk through the world, following the path, until he arrives at the chosen destination (assuming it can be reached). The key phrase being “following the path.” Despite the simplicity of the map this will require a pathfinding solution, mainly because the path can split.

After reading some articles and doing some research, I found this excellent video explaining the A* pathfinding process step-by-step. I’m not going to try to explain the intricacies of the pathfinding problem because this video does it so well. I recommend it to anyone trying to research this stuff.

I was able to implement the pseudo code from this video very quickly and the results were perfect, almost on the first try. It’s surprisingly concise too. Here is the Dart method I came up with for finding the (probable) shortest path through the map:

class PathNode {
  Vector3 pos;
  List<int>edges = []; // indices of connections to other nodes
  int previous;
  int f;
  int g;
}

List<int> pathFinder(List<PathNode> nodes, int start, int end) {
  List<int> path = [];

  var heuristic = (Vector3 a, Vector3 b){
    // calc the 'Manhattan Distance'
    return (b.x - a.x).abs() + (b.y - a.y).abs();
  };

  var current = start;
  var open = ListQueue<int>();
  var closed = ListQueue<int>();

  while (current != end) {
    for (int i in nodes[current].edges) {
      if (!open.contains(i) && !closed.contains(i)) {
        open.add(i);
        var g = heuristic(nodes[i].pos, nodes[start].pos).round();
        var h = heuristic(nodes[i].pos, nodes[end].pos).round();
        var f = g + h;
        if (nodes[i].f == null || nodes[i].f > f) {
          nodes[i].f = f;
          nodes[i].previous = current;
        }
      }
    }
    closed.add(current);
    var low = open.reduce((curr, next) => nodes[curr].f < nodes[next].f ? curr : next);
    open.removeWhere((i){return i == low;});
    current = low;
  }

  path.add(end);
  current = end;
  while (current != start) {
    current = nodes[current].previous;
    path.add(current);
  }

  return path.reversed.toList();
}

And in game it looks like this:

 

Spiders

I’ve been working on a lot of new mechanics, one of which are these nasty cave spiders that hang from a web and swing around. The dynamics aren’t perfect yet, but they get the point across for now. I’m still trying to figure out how to build puzzles with these and explore the design space.

 

Fire & Ice

Some new features – fire and ice (as you probably could have guessed from the title). Fire is just a stationary thing that kills you, but doesn’t block movement (this is important because things that don’t die can move through). Ice reduces friction and makes the player slide really fast. Not sure yet if this should effect enemies as well.

This video also shows off my new ‘level theme’ feature. Levels will have different visual themes that change the wall tiles and color palette. This is the snow cave theme. I also have a sewer theme, a rock cave theme, and the standard tomb theme.

 

Pseudo-3D Tiles

I’ve been asked how I created the 3D effect in my upcoming game, so I thought I’d write up a little explanation without going into too much detail.

The most important thing are the tiles themselves. It’s a simple brick pattern. We only need the bricks on the edges of the tile, but they should be offset so opposite rows don’t line up. This will be important once we stack them. Also note the 1-pixel blue border around the edges of the tile. This will be the mortar between one layer and the one below it.

Now we create 3 layers of tiles, with a simple y-axis offset to simulate the height of the wall. The first and third layers are identical. But the trick here is to rotate the second layer so the bricks don’t line up and we get the alternating brick pattern. (This step is actually a lot more complicated and involves rotating, mirroring, and some other tricks. You may even want to consider a whole new set of tiles for the middle layer. But you get the general idea.)

And here is the result for a whole level.

 

Tomb Toad

I think I’ve settled on a title for my new game. Expect Tomb Toad to be released in the next couple months, initially on iOS and Android, with desktop to follow sometime afterward, probably on itch.io

 

New Game!

I’ve recently started a new untitled project and I received a tremendous response from Reddit and Twitter so I’ve decided to start using my devlog again. Here is an early demo video of the game. The gameplay is pretty unique and this gives you a good idea of what it’s all about. I’ve had a lot of questions about technical details so I’ll get into some of that in my next post. Cheers!

 

Flatiron Update

Flatiron has been out for about a year now and I’ve gotten a bit of feedback.  Due to personal matters, I haven’t been able to update the game until recently, but now I’ve finally started.  Progress has been swift and very beneficial to the gameplay.  Most of the changes are intended to address one primary issue – the game was so random, the player seemed to have no decision-making power.

In the future, I am planning on more frequent updates, which will add new power-ups, new enemies, or whatever.

Some of the more important improvements include:

  • Boss battles
  • Tap to shoot instead of swipe
  • Bombs are shootable
  • New power-ups
  • Simple combo system
  • Improved power-up system

Here’s a screenshot of the first boss – the Dreadnaught.

IMG_1267

 

 

Gameplay Gifs

Here are a couple of quick gameplay gifs for Rosso.  Still very much WIP, but it’s still nice to show some movement instead of stills all the time.  The forest environment is very very much an early test.

Untitled1  Untitled2

 

New Game Progress and Flatiron Update

Updates have been very sparse over the past few months, due in large part to having a baby!  But I’m finally getting back into the groove of game-deving in my spare time.

My new project – a driving game code-named “Rosso” – continues progress.  To prove that, here is a screenshot showing off some random color palettes:

image1

 

In other news, I’ve also been developing a long-needed update to Flatiron.  I’ve gotten primarily 2 complaints from players – the game lacks depth and the controls don’t work well.  Both of those will be addressed in this update which I will talk about in a future post.  Plus I’ve also improved a bunch of other little things.

Lastly, I have a third game project in the works, but that’s so early in development, it’s not worth going into any more detail.  But I look to be very busy in the coming few months!