Wurm Dev Blog: Crazy Creatures

A couple of years ago on Xanadu there were a lot of people not really finding anything to kill in areas they were trying to hunt in, despite the server having a much higher total creature population than any other server. At that time there was some investigation into these claims, to see just where all the creatures were and what they were doing – and that led to a few tweaks on how the creatures spawned to help make things feel a bit better.

Just recently I saw another comment that was much the same as comments a couple of years ago before those changes, talking about not seeing any mobs to kill in their areas and finding nothing substantial when out hunting. For a little while now I’ve had various plans to update the creature system in Wurm in a couple of ways – so this seems like a good place to start on what those changes are, why I’d like to do them, and how they might help out on any issues players might have relating to current creatures.


Current Creature Capabilities

First off, back when this was first looked at there was a new command added to the game for the devs to use to make the server dump out a map with all the current creature locations for the entire server. This map was used to find where problem areas might have been in how creatures spawned and moved, and to see why people were finding nothing to kill. The output of such map looks something like the below, and shows a marker on every tile where a creature is currently sitting.

Typical creature distribution in an area with little to no deeds.

With this view of everything on a server, it gives us a better look at where creatures are, how they are moving, and where they are avoiding. As expected and experienced by players, the areas near deeds and well travelled highways tend to be very sparsely populated by creatures because of a combination of players killing creatures they see, spirit templars and guard towers, and large amounts of areas being taken up by deeds and buildings where creatures do not spawn. In the creature pathing code you also have a tendency for most creatures to try and avoid deeds if possible – this doesn’t always happen as anyone with spirit templars will know, but they do try to avoid guarded deeds when they move. Adding onto this is the fleeing mechanic that controls how creatures behave when getting near other hostile creatures or near players.

How areas around some deeds may look. Happy hunting to those that recognise their deed.

With herbivores, not liking the presence of players, leading to them running away from players and other aggressive creatures, combined with them generally not spawning too close to deeds and buildings, and add in player’s proclivity to kill anything they see anywhere near their deeds, you can get some areas looking like the above – creatures finding their safe spaces in areas of land between deeds that are less travelled by players.

Now as if this isn’t enough, carnivorous creatures also like to hunt – and where do they go to get their feast on? To the large grouping of herbivores running away from the nasty players. All of these interactions can compound with each other until you get the odd worst-case scenario that pops up in a couple of small areas on each map.

A piece of land squished between a large deed and a cliff. Farm animals galore.

This isn’t so much a widespread problem however, a large percentage of the map looks like the very first image above – good distribution of creatures across the large majority of the map. That’s not to say that some things cannot be improved though.


Corralling Confined Creatures

There are a few main areas where we could improve how creatures spawn and move around. The first is one that a large portion of the playerbase experience, and that is creatures that are penned up and stuck on deed trying to path their way outside of those pens and eventually all ending up stuck in various corners. This feature isn’t something that is unique to Wurm as I have seen the same behaviour in penned creatures in other games, and it comes with an interesting explanation. When a creature chooses a place to go, it will pick a tile in its range and then try its best to get to that tile – if it can find a valid path going around obstacles, through unlocked gates and around houses it will – but when it can’t it will most of the time just sit still instead, trying again for a different tile in range later.

Now when a creature is inside a pen there are a lot less valid tiles that it can move to. It can move inside the pen and that’s about it. If your prized cow is sitting in the center of a large pen it can move to every tile around it since its max range is still inside the pen. But after that movement the cow is now closer to the edge of the pen, and half of the tiles it can try to move to are outside of the pen – so half the time when it picks a new tile to move to, it will do nothing. Leave that running for long enough and the cow will eventually run itself into a corner tile, where 75% of the tiles in range are outside of the pen – so 75% of its new movements are doing nothing because it is trying to get to an invalid tile.

Left: All tiles in range are valid. Center: Some tiles outside of the pen are invalid. Right: Majority of tiles in range are invalid.

A potential fix to this is actually reusing movement code that some other creatures use. Instead of picking a tile and trying to make their way to it, when these creatures have nothing better to move towards (like an easy kill while hunting) they will pick a direction and walk in that direction, turning every now and then, bouncing off obstacles like walls and fences, and just generally wandering aimlessly. Applying this code to penned creatures would mean less movement checks that end in them stuck in one spot, and more randomly moving around their available space – they will be able to walk up to the edge of their pen, then turn in a direction away from the fence or wall, and carry on in that other direction.

Looking at it from a different direction, another way to possibly fix this issue would be to make creatures want to avoid tiles that already have other creatures on them or nearby them when possible. Ideally this would make bunched up creatures naturally spread out when they have no specific tile they are pathing towards leading to more evenly spread pens, and would also help out with another issue described above with creatures naturally gathering at certain points on the map in large groups currently.


Counseling Cowardly Creatures

For the issue of creatures seemingly grouping up at similar distances from active deeds as shown in the map view with deeds earlier, one easy change that we’ll be testing is simply tweaking the range that these fleeing creatures react to players. This will make them far less likely to scatter from an area around a deed, and instead just try and keep their distance from players when they are in a more realistically visible range. Adding onto this is a new system I’d like to try on these creatures to make them a bit more smart in choosing where they are running to when fleeing.

At the moment when a fleeing creature is picking a new tile to run towards, it will take a look at all of the creatures it can see in range, and will attempt to run directly away from the first player or aggressive creature is sees in that list. This can mean that in their fleeing from one creature, they might run directly towards another that they would also rather not be near. To get them to choose their destination a little bit smarter instead of just running away from the first creature in their range, all of the tiles in their range will be weighted based on the relative distance and strength of enemy creatures nearby. This will give them a clear list of lowest risk tiles they should path to which can be used to decide where they move.

Blue: Creature, Orange: Enemies, Green: Lowest risk tiles to move to.

As a secondary addition to this heatmap-like system that we may test down the line would be to include other non-aggressive mobs to the tile weighting, making creatures less likely to travel to a tile that already has some other creatures on it.


Changing Creature Creation

In a similar manner to the above heatmap system to be tested with fleeing creature movements, in the near future I’ll be testing out another heatmap system for creature spawns. This would be a cached version of all the map tiles with a weighting based on deeds, guard towers and highways. Tiles closer to guard towers or deeds with templars would be weighted based on their distance to the deed/tower and the number of templars or tower guards. What this would allow is more precision in spawning creatures based on how safe or wild the area is – areas closer to deeds and towers tend to be more safe, so more passive and weaker mobs would spawn in those areas. Moving further out from these areas would take you farther into wilderness with stronger creatures spawning.

This heatmap could then also be used to pick out best areas to spawn uniques or future more difficult creatures that we think up. We’d be able to safely spawn uniques out in the relative wilderness, out of the way of deeds and the destruction uniques may cause to them. This would ideally cause a more fluid system for hunting, with lower skilled players being able to feel relatively safe in areas that are well guarded or well travelled, while seasoned hunters will have a better idea of where they can travel to have a real fight.

Finally, just in relation to creature numbers and how rare some creatures are compared to others – we’ll be taking another look at those after the above changes are live and working. The current hope is that the spreading out of these wild creatures more will make it more obvious what creatures are around and what creatures are actually pretty scarce. From there we can once again look at tweaking the percentages in what some creatures spawn.

As for now though, we’re currently testing some of the changes and ideas talked about here on the test servers, with some of them due to be put onto one of the smaller Freedom servers in the near future for some better live testing. Once they are confirmed to be working as intended and not causing any extra stress on the servers they will be rolled out across all of the servers. We hope they’ll make a nice difference to your farms and hunting experiences.

// TODO: Insert outro here.
// @author: Budda