Tag[][]: as3

Tue, 26 Jul 2011 17:41:05 GMT
More fun with pathfinding
Tags:as3 dweller pathfinding
The main problem with working on pathfinding isn't its complexity or my failure to grok its basic function... although that doesn't help. No, the main thing is that it's a fairly boring problem that I know has been solved many times before, and it's just not that interesting to work on. As a result, my mind skips ahead to things that I will need AFTER the pathfinding has been resolved. In some ways, this is a plus, in that I realize I've overlooked some things but of course it rather hinders me finishing the silly thing ...

There are a couple of things that I should have been thinking about while working on it. One, how does the NPC know that it's reached its target? Sure, the path has run out of nodes to traverse but what was it supposed to do when it got there? I have PATHING_STATUS and CREATURE_STATUS fields on NPCs, but they simply indicate whether the creature is currently pathing or not, and what type of thing it's pathing to - it is not specific. I thought of sticking the entire destination Entity into a "TARGET" status field, but comparing by reference always rubs me the wrong way - so I'm giving everything a 10-digit pseudorandom unique id, and using that as the target identifier. I think that'll work.

I also, at some point in the past, added a "newActionOverride" toggle that was intended to be set if some sort of interrupt happened. This would be broadcast to all NPCs and toggled so that they can stop pathing and look around to see if the interrupt is applicable. I envision either a player entering the same room, or a loud noise caused by a trap or getting hit ... many things. However, turns out I was misusing it and never unset it, so that monsters stopped doing what they were doing and never resumed. This is now fixed as well. That was a classic case of thinking about a future use so far in advance that NONE of its support code has been written yet, but the flag was being set. OOPS.

I guess what I'm trying to tell myself is ... I should really finish up that pathfinding code. :P The top priority now is for NPCs to get to their objectives and complete them, be it an item pickup or enemy attack. I might be adding fluff on the side, but that's the overarching goal in line with the MVP spec.

Speaking of fluff, I have also added potions, although they don't render yet. It's really just skeleton code for a potion type "item" - they don't have any actions on them yet. While working on them I realized how rather boring standard roguelike potions are, and I'll be thinking hard about making them more interesting. For one thing, the effect duration from throwing them and having them shatter on enemies will last longer and have an area of effect: finally a real use for all those potions of poison and confusion! Perhaps bonuses if you're a dedicated potion user?

Oh crap, now I'm thinking of player skills. That's not even in the long-term spec now! :)

Oh, and here's some possibly enjoyable coding music, free of charge: [archive.org]
Mon, 18 Jul 2011 19:29:32 GMT
A Dweller progress post
Tags:dweller as3 roguelike
I posted a bit of thoughts about working with a METRIC TON of constants. Seems like every game will have that quantity, so start planning your global constant strategy now!

[do-internets.posterous.com] got the scrolling camera and resize complete, now I'm finishing up some things that got smacked by the changeover (status overlay, combat texts and inventory screen). Mostly a matter of changing offsets from absolute map size to viewport size. Piddly, but not difficult.

Then, the pathfinding fixes. After that, a breather and fleshing out the item tables to include things other than weapon and armor. Then, we'll see.