[Slick2d] Retro-Pixel Castles > Now on Steam! <

I would like to make a suggestion , currently the difficulty jumps up way too quickly to be able to build a village with even a lot of effort. considering that it can all go wrong at day 5 things should be pushed back a little bit.

Have you played since InDev 15? I changed around the spawning a bit. :slight_smile:

I played the recent one , I got to day 10 with a lot of success. My main issue is the firebolt towers , whilst useful for day 1 - 2 - 3 difficulty after that they just dont do enough damage. Maybe some splash damage towers? And buffing the fire bolt over time.

Slightly off topic here, I was scrolling through the previous posts and saw the explanation for your pathfinding and decided to try implementing it myself.

Here’s what I came up with http://pastebin.com/Kv1Yu4pd.

Its probably not as efficient as yours, here are a few examples:
Found path in 3.748906ms path length 65
Found path in 4.494716ms path length 40
Found path in 2.568227ms path length 17

It was taking 10 times longer before I used an Iterator to loop over the master array and removing previously checked tiles.

Just thought I’d challenge myself to follow your pseudo code. Keep up the good work!

Interesting system you have there, for short paths it seems to get the job done fairly easily.

I’ve actually since rewritten my entire pathfinding system, I now use a full blown A* system I’ve optimized to the point of doing 1,000-1,500+ tile paths in around 0.5ms, the new system is pretty robust and probably could still be improved further, but it’s hitting my knowledge-barrier of pathfinding algos.

A* itself isnt too hard to implement, but the tricky part is implementing it in a way that it runs quickly, if you’re curious, here’s the code. I also have a bunch of searching algos as well, but I removed them from the class file since they’re of no real use to you;
pathFind.class; http://pastebin.com/rFLkGRva
pathNode.class; http://pastebin.com/ELaXXgcE
searchNode.class (Not needed, it’s used for Search algos, but I included it anyway): http://pastebin.com/wHKGm8yc

Keep in mind it’s written specifically for my game’s map engine, so if you try to use it you’ll have to read the code line-by-line and pluck out all my game’s references and replace them with your own. Also have to keep in mind my game’s pathfinding has a “2 tier” system. The first run works like traditional pathfinding and automatically ignores “blocked” tiles, while the second doesn’t. This is how my game’s brute-force pathfinding decides when a mob should try to break/tear down a wall or terrain. So for you, there’s probably a lot of unneeded code centered around line “searchBlocked” flag inside findPath().

Basically it works like this:

  1. Try to find path.
  2. If found, build a path, return it to the entity.
    2b. if not found, if the entity is allowed to cut through terrain, flag searchBlocked to true. If not, skip to 4b.
  3. Repeat 1, with searchBlocked true.
  4. If found, build a path, return it to the entity.
    4b. if failed, return null so the entity knows no path exists for this route.