The title of the post is a pun upon the fact that one of my posts, 11 – (Dragon) Plants and Z (level), got more views at the time than others. This could be due to the fact that the post was about a more interesting subject at least in theory, but maybe it somehow got associated to other subjects because of two keywords in the title. Dragon an Z. I’ll let you figure out the third key word.
I’m not ranting about titles just for fun. I managed to improve the Z layering, and now you can have multiple Z levels. Still only one level is playable, but I like the overall look and feel of the multiple levels. Of course, when turning on multi-level rendering FPS drops like a rock. Or a lazy dragon. Z! For now it is a mystery how people in the 2D isometric era of gaming managed to have such smooth framerates. Maybe they used really sophisticated algorithms. I have some in mind that would surely work very well, making the number of visible layers not count at all, but I get the feeling that I would be just reinventing what the GPU could do for me if I switch over to a polygon based engine. Another new feature is the ability to have maps where the cliffs face at a different angle:
But Z level is not the big feature of this update. It is the new scheduler. Again! I just can’t leave it alone. But the new one is really great. It is a lot more powerful, faster and easier to use. It is really great quality piece code and there is little I can do to improve it in the future. Maybe adding LOS (line-of-sight) tie breakers to better simulate a way a sentient being would go on about these tasks.
The new algorithm is very general. Given a set of any tasks, it can choose a dwarf D and a task T that has the properties P. T will be heuristically the best (read most reachable) task from the set and there should be a path from D to T. If there is none, an action can be taken. In previous version of the algorithm, if you would choose a task that was not reachable, like a bush from a sealed off cave, the game would freeze. With this new algorithm, the task will be removed. The process is still very slow, but it is a lot better than freezing. Unfortunately, A* is a lot better at finding a path between two points than figuring out if a path exists (because you’ll end up exploring all reachable points). In the future I’ll add a constant time (and near zero) algorithm that can tell me if there is a path between the two points to know if it is safe to call A*.
Here is a video. At the end I also demonstrate the “remove floor” feature which I’ve never shown before. It is a little bit buggy, that’s why:
This video has been produced by using a version of DwarvesH and modifying it by applying the tiles form Stonesense (http://www.bay12forums.com/smf/index.ph
DHCore: 1755 lines / 43.1 KiB / 10 files
DH: 2055 lines / 50.3 KiB / 10 files
DHEditor: 612 lines / 16.0 KiB / 13 files
Total: 4422 lines / 109,4 / 33 files