The past two nights I've spent some time on my Field of Vision algorithm. Last night I wrote the initial algorithm, and got it running inside the game. Today I fixed a bug in the algorithm (hard to believe there was only one), cleaned up, and comment the code. I'm using both the Midpoint Circle Algorithm and the Bresenham's Line Algorithm together to calculate the field. It stores the field with each point keyed based on how far away from the original point the field was calculated for. This will turn out to be extremely useful when I want to apply effects to different points based on how far away they are from the origin.
The algorithm is built as a grid worker. This allows it to be used by any other object in the system, and fields that have been calculated that may never change can be reused without recalculating. The grid worker class has grown to be immensely useful, and is now probably the most common base class in the system.
I'm writing this post because I don't know where I'm going to go from here. There is still a lot of ground to be laid, but I'm trying to figure out what gives me the most bang for my buck. The current goal is to get a basic working game going, so with that in mind I'll probably work on dungeon depth and persistence. Hopefully that goes as well as the field of vision code did!
Thursday, September 18, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment