Posts Tagged ‘real time strategy’

The conquest system in the MMO campaign

The MMO campaign in Win That War! consists in acquiring new planets on behalf of your mega-corporation. How does it work?

A planet is divided into several hundreds of territories, all randomly generated. Each of these territories can host up to 9 players – 3 from each mega-corporation – simultaneously.

GUI-ONLINE3

At the start of the game, the planet is entirely virgin, since it has just been discovered. The domination is made territory after territory.

The conquest of a territory is based on the score of the established mega-corporations. This score is calculated, among other things, according to the value of the buildings in the bases of its players. To claim a territory, a mega-corporation must achieve a minimum score. Thanks to a system of relay antennas, which limits the expansion of a player’s bases, it is very difficult to acquire a territory alone, so cooperation between players is highly recommended.

GUI-ONLINE3sans-epingle

When a territory is dominated by a mega-corporation, it takes its color in the planetary view. But it is still “contestable”.

When a territory dominated by a mega-corporation is entirely surrounded by other territories dominated by the same mega-corporation, it becomes a “locked” territory, and only the players belonging to that mega-corporation can access it. To collect resources, for example.

GUI-ONLINE3A

Finally, newly discovered planets will be exploitable for a limited time only. At the end of the allocated time, the Galactic Board, the highest body in Win That War!, will announce the victory of the mega-corporation owning the most territories on the planet.

Win That War! is on Steam Greenlight.

The Greenlight is now officially launched, and is only waiting for your votes!

We’re counting on you, not only to show your interest by offering us some green thumbs, but also to spread  the word of the Greenlight on your Steam community. Having Win That War! available on Steam is up to you now.

The decal system

A World without UI

Let’s imagine a RTS game where you’d play without an HUD, or even without a proper UI, just by clicking around with your mouse and learning by heart dozens of shortcuts. Pretty annoying, right ? You couldn’t tell how healthy is your army, assuming that you managed to create it, without a hint of which building is selected, and no construction menu. Think about all the stuffs you would miss.

That’s right, efficiently printing information on the screen is one of the main challenges in making a strategy game, and precisely the point I am actively working on. But let’s start with the beginning, before taking a look at what will come for you in the next releases. A lot of UI elements are already implemented in the game, like the tracking of the actions you programmed, by printing little circles on the floor, but how does it work ?

The decal system

Well those little indicators are called decals, and are wildly used in the large variety of games, from heraldry on a knight’s armor to a GPS arrow on the floor. The technique is inspired by real-life decalcomania, which is basically the art of printing a 2D image on a 3D surface, by pressing it and copying it on a support. What we want to do here is exactly the same, applying a texture on the terrain, but we have to do this in the most efficient way possible, since there can be a lot of decals, and they are refreshed every frame. (hint : we use the GPU for that).

Giving the example of the selection decal, let’s take a look at what we have to work with :

→ A texture of the pattern we want to print: cercle

→ The depth-map, giving the height of the terrain for every pixel on the screen: depthmap

→ The position where we want our decal to be, and the color we want it to have

Life is like a box of pixels

Now we are only a few steps away from the best UI ever.

First, we create a box around the given position, large enough to contain the full decal. To make this simple, we give it the maximum height of the terrain, and the size of our texture. This aims to reduce the number of pixels the shader will compute, since everything outside the box will simply get discarded.

Then, the challenge is to detect which part of the box is intersecting with the terrain, to know where to apply the texture. We do this by casting rays from the camera (in blue in the drawing) to every pixel of the box visible by the camera. There are three possible results:

  1. the ray enters and gets out of the box, intersecting the terrain after the box (top ray)
  2. the ray enters and doesn’t get out, intersecting the terrain (mid ray)
  3. the ray doesn’t even enter the box, intersecting the terrain before the box (bottom ray)

boite

Thanks to the depth map, we get the surface we want by the rays in the second case, and we can get the corresponding texture coordinates by projection.

However, the technique is not perfect, and we still compute a lot of pixels for nothing. The box is almost always way too big since we take the maximum height of the terrain. Actually, we consider a box, independently of the shape of the decals, which brings us to draw a lot of useless pixels. In the case of the selection decal, only the circle is used, so 80 % of the texture is transparent. With small decals it is not a problem, since drawing a small number of superfluous points has no impact on the performance, but when it comes to very large shape, such as printing the range of an artillery for example, we have to think another way.

An other problem is that the decal is relying on an input texture that is static. But we could need something computed dynamically from the game state, like an influence zone drawn by the whole army.

So yes, there are a lot of complications ahead, but don’t worry, you will hear from all of this very soon, in a future article.

Kranchy

Return top