Westward dev log #28 : Civilizations

In this update the “enemy civilization” makes its big comeback, introducing a basic version of the main gameplay pillar of Westward and creating a new adversarial goal.

Click here to play the demo and discover the changes discussed in this post.

The enemy civilization

If you have been following the game for a long time, you must have encountered it in the past. However, it was scraped at some point, because the overall game wasn’t mature enough yet. Now, with more polished crafting, trading, battle, inventory, building and map systems, the landscape lends itself better to it.

The enemy civilization (the “Civs” for short) consists in a hostile civilization inhabiting the continent that the players have to settle. They have a few settlements of their own scattered in the game. Their behavior is quite simple: they don’t want the players on their land, so at regular intervals they mount attacks, which consist in destroying player buildings and killing player characters.

The players can defend themselves by fighting of course, as well as by building towers which will automatically intercept Civs and kill them. Beware however, as buildings are now destructible, and will be fully destroyed if you don’t repair them regularly. Finally, the best defense is offense, and you can yourself try to locate a Civ camp and destroy their buildings to stop the attacks.

This whole system is still pretty basic but defines a nice first gameplay loop: gather resources to build defenses and repair them while you gear up, then attack enemy camps. In the future, the Civ behavior will become more complex, their camps will feature more advanced defenses, and more defense and offense options will be available to the players. Ultimately, this over-arching campaign of fending off and conquering the enemy civilization should become the focal point around which all other gameplay elements revolve.

On a more technical note, an interesting consideration here was pathfinding. When the Civs start to track a player, it could be very bad to have multiple of them perform pathfinding on relatively large distances. My fix for that was to add a “seek” mode to my custom-made pathfinding library. The idea is simple: compute the path towards a target, but up to a certain limit. Traditional algorithm declare failure if the target is not found within this limit. In seek mode however, whichever position that has been found within the limit that is closest to the target becomes the temporary target, and the character walks to it. By chaining such seek-searches, this yields a relatively natural-looking behavior of having the civs gradually close on their target, in an imperfect yet very efficient way.

Enhanced map menu

At the moment, the presence of the Civs is mainly communicated through the map menu, which features a few new markers:
– Sword icons to indicate where skirmishes with Civs recently occurred;
– Skull icons to indicate where players were recently killed;
– Dashes demarcating the Frontier between player and Civ territory.

The Frontier was fun to implement. It’s computed by creating (server-side) the Vorono├» map of all the boundaries between neighboring buildings in the game, and then only keeping the boundaries between player and Civ buildings and displaying it. This means that, as the players colonize land by building on it and by destroying enemy buildings, the frontier will morph in real time. For now, this Frontier is purely cosmetic, but relatively soon it’ll be used to inform Civ behavior as well as to compute economic indicators.

In non-Civ related news, the map menu was further enhanced by:
– Making it bigger;
– Adding animal markers, which, similarly to plant markers, indicate approximately where specific animals can be hunted (which will prove useful to find pelts once more leather-based items become available for crafting).

Misc. changes

A few varied additions have been made. First of all, butterflies. No gameplay value whatsoever, but that’s the kind of small things that bring life to a game when they add up. They spawn nearby flowers, so go look for some Sunstreak (using the map and looking for the corresponding icons) and you should find some.

Speaking of wildlife, a new wolf spritesheet has been made, including attack and death animations, which were lacking up until now.

In addition, I’ve been working on a shader to create a silhouette effect when the character is hidden by a tree, as seen below.

Basically, the client stores a list of tiles where the player could be hidden. When the player walks on one, his depth his adjusted so that he is displayed above the tree, and the silhouette shader is activated.

It works well enough, but less well when applied to items, because the contour really follows individual pixels and gives a very noisy result. If you are experienced with GLSL and would like to give a hand, feel free to reach out!

Another small change is the revamping of the building panel, which is now a bit clearer and displays in advance what ingredients you need to build a building.

Finally, the mouse cursor has now been replaced by a Sprite that follows the (now invisible) mouse. This will allow much more complex cursor behaviors than the normal browser one would have allowed. One example would be to move the cursor against the edges of the screen to move the camera (granted it would have been possible before, but less elegant).

What’s next

Now that the enemy civilization is back, it’s time to really give it importance as a core gameplay pillar. I’ll be working on new game menus and mechanics that will hopefully do that, as well as encourage collaboration between players to face this new threat.

If you’d like to support Westward, consider having a look at my donation page. In particular, take a minute to have a look at my Patreon page, where you can find a listing of rewards for various levels of recurring contributions!

Jerome Renaux

I'm an independent game developer, working mainly on browser-based multiplayer online game (HTML5 & Javascript). I love to discuss about all aspects of game development so don't hesitate to get in touch!

More Posts

Follow Me:

Jerome Renaux

I'm an independent game developer, working mainly on browser-based multiplayer online game (HTML5 & Javascript). I love to discuss about all aspects of game development so don't hesitate to get in touch!