Tuesday, July 19, 2011

49 – Not Skynet

Today I will be doing the final steps necessary to finish this iteration of the grass system. A little cosmetic touch, without any serious influence on the gameplay.

But in order to demo this, I need a way to make dwarves walk a lot on the same path.

So I decided to not skip any corners and get started prematurely on a basic A.I. system. I want an A.I. capable of taking high level objectives like "build a successful settlement", "create a huge dam" or "become a feared military power". It will break down these task in a lot of small tasks and will try to solve them one by one while reacting to the environment. It will take a lot of time before the A.I. becomes more than a bumbling jester tripping over a rock and destroying everything it has built, but I need to start somewhere:


Basic A.I. movement system
The first micro task that the A.I. should be able to do is move dwarves around. This may not seem like much, but this movement is different from normal movement when the use issues a command. Three actions are implemented.

The first one is the "Group Move" action. This will cause all dwarves to move to a desired area. There is support in the GUI for designating said area for testing purposes. Not that interesting and I do not like the feel of the group movement so I won't be demoing this today.

The second action is the "Random Move". When giving this order, the dwarves will continue to select destination squares from the designated area and run to them, doing this until they get exhausted. Selection of destinations is random but uniformly distributed, so on the long run every square will be visited roughly the same number of times. This is true for normal "Group Move", even though a destination is chosen only once.

The third action allows you to cancel the move commands.

Right now these command are issued by the user. After I add a few more commands, like "Place Stockpile in a Strategic Location" and "Harvest Everything" I will be demoing a game session completely devoid of user input.

As an implementation detail, I started using lists for A.I. task lists. This was slightly harder than expected since U++ does not provide a classical list container. Now lists are the prime choice for a lot of tasks and when their use is justified they usually destroy the competition performance wise, but they are not a particularly good general purpose container. With emphasis on container. Even in cases where lists are recommended, they shine usually because the accent is put upon the node, not the container itself, which plays second fiddle in such cases. I don't want to bore you with the theory of lists. If only I had a place where I could rant on for pages about programming languages. *Wink Wink*. Expect a comprehensive post about lists in the Z2 section one day.

If everything works out as planned, I'll transition all tasks to lists and greatly increase the number of tasks that can be scheduled simultaneously as a task that need to be executed and tested before version 0.1.




Grass erosion due to heavy trampling
This is why I needed a way to make dwarves walk in a controllable fashion all over the place: grass gets trampled if you walk over it. I may need to adjust the weights for the erosion, but I like the effect. It is one of those small touches that can improve the experience and its perceived depth without really affecting gameplay. Once I have animals in game they will also eat grass if they are herbivores. Combine the two sources of grass erosion and the landscape will seem a little bit more dynamic.

I consider the grass system finished for now.

Here is a short video demoing the A.I. control panel and grass erosion.

3 comments:

  1. Nice! Small touches like this really does make the world feel more alive.

    ReplyDelete
  2. Its looking so good. BTW do you have a list anywhere that we can go to to see what you are working on and what still needs to be implemented before you release open alpha?

    ReplyDelete
  3. To InfecteD:
    Thanks! That was the idea: small touches that enhance the experience but do not contribute to the gameplay (for now).

    To Ian Fischer:
    I am afraid not. Right now all information that is available is right here on the blog. But I am only a few official posts away from the final pre-alpha phase that will result in version 0.1.

    Somewhere during this period I will post an updated feature set for version 0.1 and after that a rough estimate of version 0.2 features.

    For version 0.1 I won't post completion percentages for each individual feature since they all need to get to 100% before 0.1.

    ReplyDelete