woensdag 20 oktober 2010


Hello all,

I want to talk about the visitor system for the time management game. While playing there will be visitors, or guests, walking around. They will stand on pre defined places or will be moving/walking between them. So it looks like they are visiting/enjoying the park. The game also features so called 'targets' which a visitor is going to visit. They walk into the park, get to the first target. Then look around for a while and move on to the next one. When all targets have been visited by a visitor, the visitor leaves the park.

Technically, this comes with some difficulties. For example, the targets, or 'nodes', can only be owned by one visitor at a time. There can't be more than one visitor standing on a node. This means that if there are more visitors in the game level walking around than there are nodes available, all the visitors will stop moving. Which is not wat we want ofcourse. A visitor should always be able to walk to it's next target.

Therefor we can use some solutions. For example, the most simple one:

A visitor enters the park and visits the target nodes in a linear order. Simply by walking from one to another in a pre defined sequence. When the last target is visited the visitor leaves the park. Also the spawning of visitors is controlled in such way that there are no more visitors being created/spawned than there are target nodes. This way the visiters don't freeze up.

The good thing about this system is that it is very easy to control. And will always work if the amount of targets is kept the same during gameplay. The drawbacks are that it is not very interesting to look at in the first place. Visitors always move the same predictable path, which is not really human like. The system also isn't very dynamic. Imagine adding an extra 'target' while the visitors are in the park. This would cause problems.

The method we are going to use for now is this:

As you can see, we added so called 'Free Nodes'. They almost act the same as the 'Target Nodes', except that there will be far more free nodes. In the image there are only 4 displayed, but we'll be using a lot more in the game.

Using this system, a visitor walks into the park and always moves to a free node. When reached, the visitor is looking for a target node which isn't owned by another visitor yet. Then the visitor walks to this target and makes it it's property. When the visitor is done watching/looking it searches for the next (random) available target node which it hasn't visited yet. If it finds one, the visitor moves towards it and the same sequence is repeated. If the visitor is unable to find an available target node, it moves back to an available free node. Which is, in theory, always available if there aren't too many guests.

This way the system is more flexible and gives a lot more control over the behaviour of the visitors. Also adding a target node while the game is playing wouldn't be an issue here. The only drawback is that there can't be more visitors in the park than there are free nodes. I'm also thinking of creating the free nodes on the fly if a new visitor is entering the park. This doesn't work yet, but seems to be the solution to these last issues.

Thanks for reading, more updates soon!

-- Joep

Geen opmerkingen:

Een reactie posten