Monday, February 28, 2011

30 – A full circle shall not stand alone

What I have been working on recently reminded me of coming full circle from multiple perspectives and I doubt this will be the last time it happens.

Basic plant growing implemented

One small problem with previous capabilities of DwarvesH, and thus of any settlement that you might have created with it, was its severe lack of sustainability. Sure, you could harvest all plants you can see, wait for the year to pass and harvest more from the natural surge of plants, but considering that dwarves eat and drink a lot (or they will once it is implemented), I doubt you could survive a season, yet alone a year and then hope that nature will give you enough to survive for another year (hint: nature is not that kind to you).

So I added plant planting. I need to reformulate that. The system is very easy. You select a surface, and give the orders for planting. It must be soil and some other factors are taken into consideration. This is the result:

Yes, I know that I have reused the tile from food stockpiles. It will get its own distinct tile in the future. And I also need a better word for plant seed in ground/plant babies than shrub. Now you need to wait for quite a while until the plants have reached full maturity. Until then you can't interact with them, but I'll ad a single option: to destroy the farm plot if you need to free up space for whatever reason. Doing so will not allow you to get back your seed or any useful products, just garbage. And here is our small piece of land, after a few weeks:

The grow duration is entered in the editor for each plant. You can also plant outside, but you may want to make some room for a proper field. I didn't:

The process is not that involved as I would like it to be. First, you select the seed by more of a hack than a full feature. This is only temporary. Those of you who read “Screen of the day 01” are aware that I am working on the new item browser. This browser will allow you to select seeds and all materials for all tasks once it is ready. Until then no use adding any temporary pleasant way to select seeds. Second, I want your dwarves to have to water plants regularly. This will be easy to implement, I already have buckets. What I am missing is the water!

Zooming with two levels

The zooming feature is done and bug free. You can change on the fly between normal view, zoomed out and really really zoomed out without any loading or delay. Your scrolling speed when really really zoomed out is still bad, but I'll optimize it someday. Not a priority right now, especially since you can see most of your map without zooming on this setting.

Screenshots with the zoom levels:


Streamlined scheduling data structures

Now this is all about me and my comfort of life when developing the scheduler. A lot of technical details. Suffice to say that the new scheduler is both easier to use for me and maybe for you if the editor will ever have a scripting engine, which would be a great idea. I already have a general and working script interpreter, I just don't know what to do with it. The language it uses is C-ish, but I'm sure would be modders would not have any problems with it. I haven't worked on the scheduler in quite some time. Good to know that it is solid.

More “moveable” maps

This is another implementation detail. The idea is that maps are more self sufficient and you do not need to go through a GUI like I have created to obtain a new and functional map. The creation of the map is more like “give a few values and go wild”, rather than “a complex succession of steps that all must be executed with the right parameters and in the right order”. Of course, the GUI is still in place to choose all parameters.

I have several other things lines up. Fist version of the random map generator is coming along nicely. Need to add impassable water soon. I guess my priority is to finish the item browser, then give it a spit polish and make a video about it.


  1. So far as "I already have a general and working script interpreter", you may want to consider using an existing scripting language such as Lua or Python. Implementing a scripting language from scratch is a valuable learning experience (and fun for that matter), but it tends to eat up *a lot* more time then you'd think.

    Project looks awesome right now. I really like the isometric view!

  2. I should have been more clear in my phrasing. I already have a general and working script interpreter at my disposal, so I don't have to code one. All I need to do is set up a few hooks and pass strings to an eval function. And it is general as in general purpose. This is where I will need some tweaking, since I don't want to give access to system services or allow any behavior that might crash the system.

    Using an established scripting language would be better, but I don't want to carry around dependencies. Lua and Squirrel are reasonably light weight though.

    As for the complexity of such tasks, don't worry. Compilation techniques are actually one of my nonofficial areas of expertise (and not game development or simulations :) ).