Saturday, September 7, 2013

Key, Gate, Exit


Well, I've got something working. I don't like the behavior, and I don't like the implementation. But it's "working". Including sometimes when it isn't exactly working the way I want, even then it's pretty much working.

My process here is to first pick a random spot on the map, I call that the seed. Then I find a spot as far as I can (pathfinding-wise) from the seed. That's the exit from the maze. Then I find a spot as far as I can from the exit, that's the start. I'm not entirely sure that that's the right feel for a maze - but it does give the player the maximum distance to travel in the best case.

After that, I find the path from the start to the finish, and drop the gate 70% of the way along it. This divides the maze into two sub-mazes. I want to pick a spot in the player's sub-maze, far away from the start position and far away from the gate. Instead, I just pick a spot halfway from the start to the gate. This puts all the interesting bits of the maze on a single path, and if you're extremely lucky, you won't have to backtrack at all.

I'm finding that I want to build some nicer tools for handling tile positions - right now, I'm iterating over lists more than I want, and it's gross.

Also, sometimes, the player ends up at a location that's not the furthest from the exit, so something's not right.

If/when I rewrite the tile position code, maybe that bug will get sorted out.

I'm calling this stuff good for now, with the intent to come back and rewrite it to make it pretty.

TODO:
clicks make player move
player animates from location to location
player picks up key
player can't pass through gate without key
landing on exit is a victory

That's not much, really, and I have over 3 weeks to do it. That means I'm likely to actually get around to the cleanup, I hope.


No comments:

Post a Comment