Monday, March 14, 2011

32 – A little more love for the editor

I've continued updating the editor for the coming apocalypse. New versions might seems more and more complicated, but there is a good reason for that.

The editor is designed to handle both a simple and realistic set of items and a very complicated set of items. Let's take trees for example, at the risk of repeating myself. Trees have multiple "slots". The first is the seed slot. As far as I know, there are no trees in reality that have seeds. I am talking about just seeds, without any fruit. In the right season, trees bear seeds. You can harvest them without harming the tree. Out of the box, DwarvesH will not ship with any trees that have seeds that are considered seeds (what?), but the option is always there for modders. Then, trees can have leaves. And leaves can have seeds. Again, this is not the traditional way trees are. These seeds are embedded in the leaves and you get them by harvesting the leaves. And finally, trees have fruit with seeds. Now this seems familiar. The good old apple tree. Or beans encased in a pod. But if you blur the lines between fruit and seeds, the other models seem feasible. Take a tree that has nuts. If you want to model this, you may choose to make the nuts edible "seeds". This way you don't have to add a dummy seed to a nut. Nuts do not open to release the real seed. This goes for all fruit that you plant directly in the ground and which has no discernible seed (by the layman).

Did I mange to confuse you? To make things more complicated (and more expressive), you can have a tree with all three kind of seeds. And you can make them all yield a different kind of plant when they reach maturity if you wish. The only rule is that a given seed, or more precisely, a given ID can only be used once. If you want to add three kind of seeds to same tree in all three different slots, then you need to create three seeds with the same information (or not), but with different IDs.

While this may seem overly complicated, let me repeat that the plants that I will ship are more traditional and will bear fruit that contains seeds.

SUPER SPECIAL LAST MINUTE UPDATE: While writing this I decided that I want to experiment with a model where the distinction between seeds, leaves and fruit is totally blurred. In this model, trees still have three slots, but leaves, fruit and seeds are the same kind of item. Everything gets a result field and the type of the slot determines the behavior. If this model turns out to be a success the above explanation will be outdated. Sorry for not coming up with a final design on time, but I never done something like this before. But here's a question: who has?

Advancements in the plant model

Here is the new seed editor tab:

These are all items from DF and I am adding the new ones, but I started with trees and first I must finish the fruit before I can create the seeds. Fairly typical stuff here, but notice the "result" field. You must specify what plant will result from a seed. This is not done automatically for the cases where you want to try something strange and mix up the results. As said before, the result doesn't have to be a plant, but it will take some time before this can be seen in practice, and not before 0.1. So if seeds are their stand alone entity, how does the plant editor look like?

The same, only this time seeds are referenced by the bush. The tree editor is the same, but it references both the seeds and the leaves:

I moved the trees that are part of the final list closer to the top. Some items are missing, like the common fruit trees. And the final piece of the puzzle: the leaf editor:

I let pictures do the talking intentionally, since I already confused everybody with the lengthy introduction. The icons for seeds and leaves are the same, but this is only temporary.

Editor usability improved

Besides the new features, I greatly improved the editor and its usability. The design of the code is better, allowing me to add new tabs with great ease. Serialization is so robust that during these frequent changes in format and data layout, I have not lost any data once. Automatic cursor movement when doing some task in the spreadsheets is improved, and there is a more feature rich right click menu:

Engine updates

All these changes in the model have resulted in countless small changes in the code. The most visible one is the way things are handled in the item browser:

Here you can see the icons for leaves. Notice that a cooked leaf has three icons. They tell a little story. Fire was used on a leaf from a tree. A cooked leaf! I hope I managed to make the list fairly intuitive. I will rename the "Seed" tab to "Plantables".

No comments:

Post a Comment