Wednesday, November 24, 2010

18 - Stockpile overload

What is a good use for stockpiles? Drawing it seems. I’ve added the general stockpile categories when creating a new stockpile:

There is going to be some tweaking to these categories, but you can use it to draw stuff:

Every stockpile has its own color. I could probably do a better job of picking the colors, but I use Microsoft Paint for my image editing needs and these are some of the default colors.

In the next image there is a lot going on. I have designated a large area for cutting down trees. As a new feature, every single log that has resulted from a cut down tree is visible by the tree trunk. They are removed one by one. Six dwarves are still busy chopping down trees while the last one is hauling logs from near tree trunks to the wood stockpile. You can see that he has a log in his hands and he has already placed two logs in the stockpile:

Once the cutting is done, everyone gets busy filling up that stockpile:

Alas, the stockpile is too small and I needed to add a second one so that all the logs could be placed:

This process took quite a while and I’m looking to speed it up. Generally, I am happy with the idea of time compression but not with the implementation. It is at the first iteration so no worries. You know what is not at the first iteration? The scheduling algorithm. I get the feeling that I rewrite the damn thing two times a day.
Besides the improved scheduler, there are some small performance tweaks. When enabling full map rendering you should get a few extra FPS (5 with software rendering at 720p on of my machines). Also some small interface improvements.
Next time: workshops!
Statistics S41:
DHCore: 1881 lines / 45.9 KiB / 10 files
DH: 2205 lines / 54.6 KiB / 12 files
DHEditor: 612 lines / 16.0 KiB / 13 files
Total: 4698 lines / 116.5 / 35 files

Thursday, November 18, 2010

Official Twitter account launched

I’ve created a Twitter account: Don’t worry, I am not going to be posting stuff like “It is raining”, “I like pizza”, “I am a dwarf”, “Buy my new t-shirt” or “I feel sad”.
But I will be announcing every post there. It is an easy way to post updates. It also has the advantage that sometimes I don’t have enough to say for an entire post but I could say a few words. Then you’ll get a short tweet. I wonder if there is a tool that allows you to combine and inspect your posting history from Blogger and Twitter as a common timeline.
In order to not have an empty Twitter, it would be easy to start spamming my backlog. But I won’t do that. Maybe.
Twitter widget is also available on the blog with the latest tweets.

17 - There is a Z in the title so I can has more views like last time? (Dragon)

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 (­­p?topic=43260.0) only for the purpose of creating an early demo video. DwarvesH is not available in any form with the tiles from Stonesense by default officially or unofficially and does not assume any right to use them. The process can be repeated by anyone by downloading both applications and using a simple image editing tool to selectively change the tiles from DwarvesH with those from Stonesense or the tiles from Stonesense with those from DwarvesH.

Statistics S38:
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

Wednesday, November 10, 2010

16 – Is that wood in your stockpile?

As you saw from previous screenshots, I am going with a fixed key/function system. “1” is always digging. The keys are going to change maybe and it is going to be hard to add all actions to easily reachable keys without overwhelming the player, but it is a good system. I think I should get rid of the right panel and go with something that takes less place though.
So I have a new action, “5”: wood stockpile. This will designate your selection as an empty wood stockpile. I have a hidden cheat key that places a single log in an empty stockpile. No, you won’t get to use the cheat key. It is only available in super secret God mode. I will demonstrate this with a video. Next step that is not implemented yet is to place the logs as trees are being cut down.
This time I captured my video with Fraps. It was slightly problematic because the captured video was 2.5 GiB and YouTube only allows 2 GiB files. But I downloaded a conversion tool and got it down to 93 MiB so no problem! YouTube took a few hours to process my video, so I waited with the post until it was done. I am not completely happy with the quality yet. And as you can see, the resolution is different now. I have added support to the INI file for resolution and full screen flag. You can give any resolution if you are not running in full screen. Someday this will be available in game.
There is also a new mini feature. The editor now allows you to customize the names of you skill levels and also the maximum value for skills. They are no longer hardcoded:

So now, without further a due, the video:
Same as the last time, I have added a disclaimer because I am still using Stonesense tiles for demo purposes, but I do have some original graphics mixed in there.
This video has been produced by using a version of DwarvesH and modifying it by applying the tiles form Stonesense (­p?topic=43260.0) only for the purpose of creating an early demo video. DwarvesH is not available in any form with the tiles from Stonesense by default officially or unofficially and does not assume any right to use them. The process can be repeated by anyone by downloading both applications and using a simple image editing tool to selectively change the tiles from DwarvesH with those from Stonesense or the tiles from Stonesense with those from DwarvesH.

Statistics S34:
DHCore: 1522 lines / 37.0 KiB / 6 files
DH: 2034 lines / 52.2 KiB / 10 files
DHEditor: 613 lines / 16.1 KiB / 13 files
Total: 4169 lines / 105.3 / 29 files

Tuesday, November 9, 2010

September and October in review

Are you familiar with the concept of a release report? Well, I won’t do something as dire here, but once in a while, more precisely at the end of a month or two of development, I’ll put a few words on paper. I’ll try to be as short as a dwarf but less inebriated. Not because I am trying not to be, but there is just no alcohol around here right now.
I wanted to do this at the end of September, but that was when the change from 2D to isometric happened, so it was not a good moment. I also wanted to add a few tables, with features broken down and with percentages relative to their completion given. But how about I skip the bureaucratics? So I’ll use a short bulleted list with major things that are done:
·         Basic game engine that is capable of rendering and populating multiple Z levels, but movement is restricted to just one
·         Basic editor
·         Scheduling of digs, channeling, plant harvesting and wood cutting
·         Plants and trees
·         A few info screens
·         INI file support for multiple rendering backbends
·         Other things that I forget but are in previous posts
·         And XML support!!!
Oh gosh, I forgot about XML support in my previous post. Since I want to publish the editor ASAP, the very frequent change to the data that is serialized is not that advantageous. The serialization format is very fast and painless to use, but it is very sensitive to data changes. So for now both the editor and the game will use XML to try and obtain a minimum backwards compatibility. This was done in the same timeframe as the previous post, but I am not going to edit it.
Not short enough!
Features planned for November:
·         Food and wood stockpiles
·         Stone deposits while digging
·         Butchering of animals
·         And maybe a few wood products

15 – Will you shut up with the plants already? Sure!

It’s been quite a while since I posted yet again, but I came down with a particularly nasty bug. Fallout: New Vegas!!! Good times! Great game, but extremely buggy. If I would remove half of my code base randomly ant the thing would still compile, there is a chance that I would have less weird bugs than in Fallout. For now, I have gotten my fix and maybe I can get some work done.
So I’m done with the plants. With the rules set in stone from last time and a few more tweaks, I have gotten plants to a respectable place that is not going to undergo major changes until somewhere after a release or two. I’ll still do small tweaks here and there, but nothing that would warrant more than a phrase in writing.
General cleanup is also done. I’ve done the reorganizing part and the code base is quite stable right now and I like the way things are set up. I’ve eliminated most of the dead code and parts left by the transition from 2D to isometric.
Another change is that this is the first version that properly compiles and links without CtrlCore and CtrlLib, two packages form U++ that provide the widgets and their framework. This is not important for you, but the executable has gotten smaller and linking is a little bit faster.
I also overhauled the rendering engine. I removed all computations from rendering loop giving between 7 and 10 FPS. Not much, but If you add all other improvements from previous versions, it seems that I should get DwarvesH going on a very old computer and see if it performs as well I think it should. I also optimized floor drawing. Now, if you can’t see it, it won’t be drawn. This causes a gain up to 50 FPS if you scroll the map to part completely covered by hills. Rendering hills is now even faster than rendering grass areas because you don’t have to render plants.
I also managed to do something about the very ugly font I had before, but I have encountered two problems. The font generator does not have an option to generate not antialized fonts, and everything turns out just a little it to blurry. And most important of all, saving the same font as a PNG instead of a BMP gives major performance penalties. I tried changing all textures to BMP to see, but I got a minor performance penalty. Congratulations Irrllich for being random!
Just a single screenshot. Is the font to wide?

Statistics S33:
DHCore: 1534 lines / 37.0 KiB / 6 files
DH: 2006 lines / 51.4 KiB / 12 files
DHEditor: 530 lines / 14.3 KiB / 11 files
Total: 4070 lines / 102.7 / 29 files