A mouse has appeared!

Mon, 01 Aug 2011 17:39:49 GMT
A mouse has appeared!
Tags:dweller ui
I was having issues trying to figure out why my pathing wasn't working, and eventually I tracked it down to missing node information. More specifically, I was able to see that a neighbor that I was expecting to appear in the neighbor list wasn't appearing there.

Since there's thousands of these operations (multiples for each tile on screen - at this point I'm running about 1000x800, so do your own math there) it's a little difficult to pin this down on level generation. Further complicating matters is the fact that I *have* random generation - which means I can't put down a breakpoint on an expected coordinate, since those change every time.

So Nathan suggested a "live" debugging tool: put in mouse-over controls where you can click on a node to have its neighbors highlighted. The game can do the necessary monitoring code and then render the neighbors. I initially balked as thoughts of adding mouse detection sounded daunting, but then I realized if I get over this hurdle I can get more interesting things in, such as NPC hover info, attack-by-mouse, or even mouse inventory control (much later though).

So I figured what the heck; and good thing that I did, because it turned out that with the Flashpunk Input library, mouse detection and actions are trivial. I was able to instantly get coordinates and mouse response, and adding a simple neighbor traversal only took a little bit of trial and error. With the ability to get location, obtaining NPC info is just a matter of locating the entity at that location, and giving back some details about it - again, rather simple.

I guess Dweller will "ship" with a mouse UI. Thanks Nathan! :D

As always, you can see the game here: [froggyfish] Click on a node!