Wednesday, January 26, 2011

pre-alpha-1 – 1 – Yogi Bear

Since I am in a feature freeze until I finish this pre-alpha, I am not going to be able to post new and exciting stuff about bright-and-shiny-bing-bong hot new features. So this obviously means that the Internet will declare this project dead. We don’t want that, do we? So I’ll continue posting I my usual style even if I don’t have any new features, only refinements. It will be clearly visible from the title that I’m talking about the pre-alpha.

Optimized rendering engine

I have added a new optimization to the rendering engine. It is very weird and has had some even weirder consequences on mouse interaction with the world (of all things), so I’m not sure if it good or not. Only time will tell. But, it did raise my FPS at maximal strain from 72 to 107-109. That is 35 extra FPS on a stationary screen, so it might be just worth it only for this bonus. As always, when I’m talking about FPS and don’t give any additional details, I always read the FPS on the same machine, with software rendering and an 800x600 window. On my gamming rig I get over 400 FPS with hardware acceleration, but this is not that representative, since my holly goal is to make DwarvesH run on anything with a processor that is still used today by non-dinosaurs. I may not be at my goal yet, but I’m damn close. I hope. All the dwarves have their fingers crossed.

Height map added

A persistent height map has been long since overdue. And now it is here. It has made world generation faster. It will make grass and snow easier to implement and fix in a satisfying manner. And other benefits.

Making the world a little less dull

Partially due to the height map, I can now do some small tweaks in world generation so that the world is not that uniform. I’ll add small patches of sand in the future, but for now we have small de-elevations in floors. It will look a lot better once we have grass in these holes. Also notice that it is possible for plants to grow there and that the mouse cursor selection box is displayed deeper, taking into consideration your elevation:

A lot less hardcoding

While most objects are handled by the editor, there will always be a few entities that have place nowhere but are essential. The tiles for such entities have been hardcoded for ages. This was a huge nuisance every time the tile set changed. Now I can handle these items from the editor. It will be easy to tell if they need adjustments.  This is the only tab from the editor in which you are not supposed to make modifications randomly or risk breaking your game because and everything has fixed meaning.

Missing skills

I removed all skills that are not used, but I would have liked to keep the combat skills in. They have been streamlined. Now we have “Melee” and “Ranged” governing their respective combat style. “Dodge” is useful for everyone. “Armor Use” allows both the better mitigation of damage when wearing armor and the reduction of the penalties resulting from the use of said armor. “Shield Use” is used both for damage mitigation and chance to block. These are the only skills you have for fighting, but I might add back “Wrestling” and others in the future. All weapon specific skills are no longer skills, but proficiencies, which stack with your skills. An expert melee fighter will be able to use all weapons effectively, but will have a bonus if he is fighting with a weapon with which he is proficient. You will not be able to put points into proficiencies, but they grow on use. Dwarves can acquire proficiencies with multiple weapon types, but you do not need to see them all as with skills. In order to activate the adequate proficiency, the dwarf only need to pick up a weapon.

Monday, January 24, 2011

Video Tour and November-January in review

Yes, I know that we are still in January. But in December I did not get to do too much, so it counts as half a month and this is an appropriate time for a review.
But first: check out my new video!
It is a small presentation and tutorial video, trying to recreate some possible steps one would take in a new fortress, like cutting out a few storage rooms, gathering some plants and logs, building a grand dinning/meeting room and getting started on personal lodgings for your dwarves. The video is annotated with explanations.
I am not 100% happy with it, but this is my best take in over 10. It is not as easy to make a good video as it seems. Coding is a lot easier. gEEEEEEEEEEEEEEEEEEEEEEk.
So, back to the review. November and January went great. I managed to get in most of the features I planned in October. I got sidetracked with stones and layering, but it is for the better.
So what is the status of the project? Pre-alpha-one! I’m calling it!
So for the immediate future I am not going to add any new features, but bring the final polish to the existing ones and once I’m done I’ll archive and call it pre-alpha-one. I’ll post a series of short-posts about what feature got the final polish.
Then I’ll start work on pre-alpha-two. This version is going to be all about wood and stone working, bringing you the associated workshops and all the products that result from these materials. Dwarves will have selectable appearances so they don’t all look the same. And as some of you know, I have an experimental 3D engine that I’m playing around with, but I don’t think we’ll see it in pre-alpha-two.

Thursday, January 20, 2011

25 – That’s no stone explosion… that’s a spoon!

This is a stone explosion!
I totally underestimated the complexity of stones and walls. Adding all the stone types in the editor with layering information, preparing the graphics and doing the coding took forever and a day. I also took two days off.

More data added to stones in the editor

The current count is 91. This includes 4 types of soil and 5 types of sand. The number is not going to increase, but maybe it will decrease. There is now detailed layering information available for stones.

Stone layering implemented

There is now a basic stone layering implemented. It is not as smart as the data available for it in the editor, but it is enough for now. Layers are randomly selected and they have pockets of different stones. There is also a top layer of soil, which is also randomly selected. The soil cuts into stone forming a nice pattern. It is hard to find a representative image that gives the same impression as having the game in front of you and scrolling the map, but I’ll try.

Stone cutting added

All new feature. Select a number of stones and select what you want to carve out of them. While masons need a workshop for doing fine stonework, they can still go out and cut out a huge stone where it stands. Hauling such stones would be out of the question anyway. This is a city builder, not a give-hernia-to-all-your-dwarves simulator. You can carve the following things: fortifications, tables, chairs, cabinets, chests, columns and of course, the most difficult but valuable result: statues. Contrast could be improved for some types of stone, but here is a sample:

New options for floors

In the last version I added the tasks of smoothing or engraving walls. Now, the same is available for floors.

Interface tweaks

As you probably saw in the screenshots, the interface is changing. I am going to focus more on task categories which open up additional options. Here are the menus for walls and floor, which also indicate the number of items on which the operation can be performed:

Skills overhaul

I may have touched upon the number of skills in the past and gave my fair assessment of the situation. Quoting myself: “that's a $%^$^$@@@@!!# lot of skills”. But reducing the number of skills is not that easy. To solve this problem, I have taken two steps. The first one is to remove all skills that are not used right now. This is a temporary solution at best, because as new features are added the skills will come back and I’ll end up where I started. On the other hand, this way I can make sure no token skills are added. The second step is to combine a few skills into one where it makes sense, but keeping their associated labors as separate actions. So gem setting is out as a skill and has been merged with engraver. Those guys did not do that much anyway and it makes sense for engravers to sometimes use gems in their field of work. So they will now handle all gen setting related tasks. Gem cutting is still a separate skill. Herbalists now take care of both plant gathering and plant growing, including farming. Farmers are just less adventurous herbalists. Butchers now take care of wish cleaning also, not just land animals. Here is the new skill dialog. As tasks get added, there will be more and more options, but less than 89 skills:

U++/Irlicht bridge changes

My U++/Irrlicht bridge has served me well but I grew tired of maintaining it. Every time I needed a new control from Irrlicht I had to write a new wrapper and make sure it has the same interface as U++. So I removed the heavy wrapper and replaced it with a very simple one. This means that now I’m using Irrlicht API for GUI. The bridge now only adds callback support to Irrlicht controls. I would rather give up completely on Irrlicht than use the painfully outdated and just painful ID system.

And plenty more

There are a lot of extra tweaks that I am not going to describe here. Both small stuff and a huge freaking memory corruption bug that took me 4 hours to fix! I am too lazy to do full statistics each post.
6205 total lines of code

Ready fo ma vid

So now I think I have all the features in place for the video I promised last time after adding some features. So I’ll get on to that.

Wednesday, January 12, 2011

24 – Random stone explosion

A lot has happened since last post.
I managed to get in contact with the Stonesense crew and they gave their permission for me to use the tiles. While as time goes by it is becoming more and more apparent that 3D is the way to go, until that point it is good to know that I don’t have to worry about getting sued! All joking aside, I would like to thank them and wish them the best.
Also, special thanks to Jadael, who hooked me up with a sizeable set of graphics for all kinds of stones and stone objects. Now, I can’t let these resources go to waste, even if this means that I need to change my schedule a little.
And even though I said that I shouldn’t rewrite existing systems anymore, I really needed a new item system. So, on with the show!

New item system

I have a new item system that is faster, cleaner, more elegant, general and powerful that ever. The old was quite cumbersome and the new system also has the advantage of being a fully OOP system. So is it possible that I could have a new system that has only huge advantages and no disadvantages when compared to the old one? Well, if I was an idiot the first time maybe. Unfortunately I wasn’t, and as is often the case, you need to compromise and the gains of the new system come at the price of more memory consumption. Don’t worry, it is still under control and you will be able to run on a wide range of machines.
Another side effect is that workshops are broken, but they were placeholder anyway and they’ll be back.

Stone added to the editor

The editor has a new tab for stones. I added 80 kinds of stones, all with unique graphics. I’ll take some time and finish the basic stone system before I move on with what I had scheduled.

Maps now use stones randomly

Well, if stones are present in the editor, they must be present in the world too, right? For now, they are just randomly placed, but by next version I should have some basic layering done.

Stones can be smoothed and then engraved

That’s right! Two new actions for your dwarves! They are not that useful yet, but once you get the ability to carve out furniture (next post), you will be almost at the point where you can create a real fortress, not just an empty tunnel in the ground. All smoothed and all engraved stone kinds have unique graphics.

Plants have seeds

The plant editor has some extra fields, where you can edit what plants have seeds, how they are called and if they are available for purchase by new expeditions.

Expedition supplies customization dialog extended

The new expedition supplies customization dialog has been extended with seeds, but the big new feature is that it now uses the new item system allowing for more control and it now also track and groups together identical items, giving you a better overview.

Better cell inspect feature

Again, thanks to the new item system, the little panel that shows you what is under your mouse just got a lot better. Let me show you a montage of different information it can provide:

New mining scheduling algorithm

This new algorithm is quite experimental, but the old one had one big problem. If you would designate an area with unreachable tiles, these tiles would be removed from your designation and thus ignored. Not cool. The new system determines if the tile is reachable, and if not, it ignores it only for the moment. As soon as it becomes reachable, the dwarves will carry on with their given task. If the system proves itself a success, I will apply it to all tasks, not just mining.

Things to come

For my next post, I’ll do my best to give the final polish to some existing features, add stone layering and stone carving and create a tutorial video on YouTube, which will walk you thought the beginning phase of a new game and the existing features. Existing videos are old and not quite representative anymore.

Friday, January 7, 2011

23 – Going pro

In an attempt o not bore myself or my very few readers, I will be periodically switching format over here.  I changed the layout and theme of the blog, but the bigger change is going to be in format. Up to this moment, my posts were free format free flowing block of text. Starting with this post, I’ll try to organize it into sections. This way it going to be easier to figure out what the post is about and will also serve as a quick change log.

New world creation dialog

When selecting a new game, users will be greeted by a dialog that will allow them to select a few details, like the general layout and content of their respective slice of the world, the size of the slice, biome, alignment and savagery of the region. Item properties of wet and dry are ignored for now.
This dialog is quite ugly, but this is intentional. A massive user interface overhaul is planned, and any effort to align stuff, decorate or make it beautiful would be a waste until then. So I am going to focus on quick, sparse and to the point dialogs.

This dialog is the first one in a series that will allow you to customize your world and expedition parameters. The next one is the “Expedition customizer” dialog.

Expedition customization dialog is back

In case you were wondering why you haven’t seen this dialog since my third post, this was one of the first pieces of code I have written and was well before the Irrlicht transition and ever since it has been dead code. But now it is back and converted to Irrlicht.
The conversion was quick and painless, with very few features lost, but now it is ugly and doesn’t really fit on the screen unless I increase the resolution. It will have to do for now. I’ll have to rethink the way skills work, an especially the large number of them. I’ll have to condense it as much as possible without losing depth.

Expedition supplies dialog is back

Yet another dialog back from the dead? Well, zombies are very popular nowadays.  The revival of this dialog was less straight forward and is more of a rewrite. Item availability is governed by a new property of items called avail. The editor has been updated to support this value.

DHEditor has new layout and properties

The tab based layout was not going to be long lived, since the editor will eventually have a large number of tabs. The new layout is based on menus. The editor also supports a few extra properties and has a new “tab”.

New butchery editor

As you have seen when in the section about expedition supplies, you can choose not meat before embarking. The results of butchering an animal are now entered in the editor, using a new tab. As you can see, I am very fond of the spreadsheet look. Did you know that dwarven engineers were the first sentient being to use spreadsheets?

Serialization validation

All operations of serialization to streams or XML are now governed by a validation process. Should it encounter an invalid value, it will correct it and log the occurrence. Theoretically it should be impossible to crash DwarvesH now with invalid data. But I am looking forward on you proving me wrong.


DHCore                                1823 / 43.3 / 10
DH                                        3093 / 77.4 / 18
DHEditor                              780 / 20.3 / 15
Total lines                           5696 lines

Monday, January 3, 2011

22 – Happy New Year!

Have a great new year! I sure plan to.
Here we are in January 2011, a fresh new year. So it is time to leave the not very productive December behind and let the keyboard roll. Or burn.  Still, I managed to get to a computer in some lazy afternoons and work just a little bit. Here is a sorry excuse of a main menu, but it works fine as a proof of concept:

I also worked a little on implementing animals. In an exercise of futility, I also added support for animations. Since I still don’t have my own tile set, these animations will be replaced, but they look good for now, not that you can see the idle movements of the animals if I only link pictures:

These animals are courtesy of a more complex animal editor:

There are unique tiles and names for all gender/age combinations. And that’s about it for new features.
But before doing this, I also did a lot of testing with the new rendering engine. I greatly increased map height for testing purposes and frame rate was smooth, but scrolling speed was very low. But after leaving for holiday, I did no longer have access to any of my computers and the ones I used were a lot less powerful. Here, scrolling has extremely slow, even with normal map heights. So I wrote a new scroller.
I seem to be doing this way too much: greatly improving existing features rather than adding new ones. I plan to change this. With the new renderer and scroller, I have a great isometric engine that does not care about map horizontal sizes and cares very little about map height. Scrolling is constant cost and near zero. Performance is surprisingly uniform on all machines with hardware acceleration and pretty predictable without. So I’m calling it done.
For the immediate future, I am going to try and finish all partially implemented features (not perfect them) and then get a version together and make a ten minute demo of solid gameplay. Also, need to do something about graphics.
DHCore:  1866 lines / 44.3 KiB / 11 files
DH: 2680 lines / 67.2 KiB / 15 files
DHEditor: 618 lines / 15.9 KiB / 13 files
Total:  5164 lines / 127.4 KiB / 39 files