Posts Tagged ‘strategy’

Dynamical sound-design: the Artillery

For Win That War! we chose to work with the Wwise audio engine, which offers a greater autonomy to the sound designer.

Freed from technical constraints thanks to a tool such as Wwise, which brings a real flexibility of use and very intuitive tools for sound integration, all that remains is to be creative: recover the events of the game to play the sounds of the objects, of the atmosphere, the feedback, the music… and work the sound in its entirety to create a cohesion between all these sounds.

For this first article about Sound Design, we chose to talk about one unit in particular: the Artillery.
This is the 2nd part of the article about the Artillery animation, you can read it here.

artillery win that war

The Artillery is a vehicle which, in the game, plays several animations. To achieve the sound of the vehicle and stick to its animations, we divided it into five parts:

  1. Movement
  2. Artillery landing
  3. Cannon deployment
  4. Artillery shooting
  5. Artillery “take off”

 

Movement :

 

An engine sound is played when the vehicle is moving, two events allow the sound to start and stop.

These events are common to all of the vehicles of the game, they are linked to a switch in which the sounds of vehicles are located.

  • StartEngine
  • StopEngine

Wwise events

startenginemarque

The “StartEngine” event plays the “EngineSounds” switch. The “EngineSounds” Switch contains all the sounds of all the vehicles. These sounds are named exactly the same both in the switch and in the code of the game, playing the sound corresponding to the right vehicle.

stopenginemarque

The “StopEngine” event mutes the sound of the vehicle played in the “EngineSounds” switch. The selected line (dark gray) corresponds to the action performed by Wwise on the selected object.

Wwise sequence

artilleryloop-sequencewwisemarque

The “EngineSounds” switch on the main tab (and not the event tab) contains the vehicle movement sounds. By selecting the sequence of the Artillery, we enter the settings window.

 

Artillery landing:

At the very moment the vehicle sets into position on the ground, a sequence of sounds is played, triggered by a “code” event, which plays the sounds in Wwise.

This sequence consists in several sounds which are played one after the other, or overlap one another.

  • ArtilleryLand
  • ArtlleryLandRotation
  • ArtilleryDeploymentTurret

Wwise event

artillerylandmarque

The « ArtilleryLand » event plays the Artillery landing sequence.

Wwise sequence

artilleryland-sequencewwisemarque

This “Container sequence” contains the different sounds constituting the landing action of the vehicle. The playlist, at the bottom right, allows you to decide in which order the sounds of the sequence are played

 

 

Cannon deployment: 

 

Following the landing of the Artillery, the cannon deploys. This sequence is launched by an event:

  • AtilleryDeploymentCanon

Wwise event

artillerydeploymentmarque

The “ArtilleryDeployement” event plays the sound of the cannon deployment. When the order of deployment of the gun is launched, an order to stop the landing sequence “ArtlleryLand” is sent from the same event, at the same time.

Wwise sequence

artillerydeployment-sequencewwisemarque

 

 

Artillery shooting:

 

Then, the time has come to fire…

 

Always driven by an event, a sequence mixes the shooting sound with a “metallic” recoil sound, and another for ammo reloading.

  • ArtilleryShoot
  • ArtilleryShootCanon
  • ArtilleryRecharge

Wwise event

artilleryshootmarque

Wwise sequence

artilleryshoot-sequencewwisemarque

 

Artillery “Take Off”:

 

Once the target has been destroyed, or by order of the player, the vehicle must be moved. A sound is played when it leaves its state of siege.

  • ArtilleryTakeOff

Wwise event

artillerytakeoffmarque

Wwise sequence

artillerytakeoff-sequencewwisemarque

 

Each sound is created ahead, with an “audio sequencer” software, in which an animation video of the vehicle enables to tune the sounds to the image and to proceed to the editing of the recorded or collected sounds, as well as the processing. This creates a harmonious and credible mix (eq, filters, pitch, compression, reverb…)

Everythin is made as one piece, then cut to create several sounds. Then, these sounds are exported to Wwise and played in sequences as explained above.

In game, the different parts that make the final sound of the Artillery are played accordingly to the actions of the unit.

And this is how it looks and sounds in game, when you are playing:

 

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.

Switching Win That War! to the Entity-Component-System Pattern

This post describes the switch of our gameplay codebase from a class hierarchy to an architecture based on the Entity-Component-System pattern (ECS). It will first explain why we undertook this refactoring and then present the new ECS framework with which we are currently developing Win That War!. The description is accompanied by some code samples as this post is voluntarily geared towards readers who are curious about the technical details of such an implementation.

The old ways

The Win That War! team is growing and the scope of the game has evolved towards a richer design than originally planned. Concretely, this means that we now need to support new game mechanics as well as new units with some unanticipated characteristics.

Some months ago, at the core of Win That War!‘s code was your typical class hierarchy. A base GameObject implemented all the shared behavior. Additional sub-classing then progressively added new functionalities to create specialized types (Fig. 1). This was all fine and dandy, until our game designer got loose and imagined fancy units such as the Command Unit. Here is an excerpt from its specifications:

The command unit is both a building and a unit that materializes the player’s presence on the game map. The player’s buildings can only operate within the range of a Command Unit and its destruction triggers the player’s defeat.

In other words, this unit must be able to anchor itself on the ground, like a building, but also to take off in order to establish new bases on any other point of the map. Behold the first flaw of the class tree, the dreaded diamond: due to the tree-like nature of our architecture, we got to a point where it was impossible to share antagonist behaviors such as being both a static building and a mobile unit.

ecs-tree

Fig. 1 — Simplified representation of the initial architecture. The new Command Unit does not fit in this hierarchy.

At this point, we had two options. Option 1 was to go deeper into the rabbit hole and create a new subclass of GameObject (imagine a StaticButSometimesMobile class alongside Mobile and Static). Option 2 was to think ahead and switch to a more flexible architecture. Given the loads of other units and mechanics that are planned, it became obvious that we really needed to look at alternatives. After some consideration, we chose the Entity-Component-System pattern.

In the meantime, we settled for a quick hack: two versions of the Command Unit were coded, a mobile one and a static one, and we swapped them when landing/taking off. Let’s just say that we were only moderately satisfied with this approach. Some code had to be duplicated and having this very specific swapping logic for a single  type of unit did not sit well with us.

Composition over inheritance

The Entity-Component-System pattern is an alternative to the canonical class hierarchy. The three ingredient of the ECS recipe are:

  • Entities: the concrete instances of our game objects. For example, units, buildings, decor elements and cameras can all be entities. Conceptually, an entity can be seen as a bag of components.
  • Components: the pieces of data that represent specific aspects of the entity that they belong to. For example, position, physics parameters, 3D models and health could all be components. It is the aggregation of components that defines the nature of an entity. We call this set of components the entity’s composition. A strong characteristic of the ECS pattern is that components should only contain data and no logic.
  • Systems: the modules that govern the logic of specific parts of the game by manipulating related components (Fig. 2). For example, a Drawing system could examine the Position and Model components of entities in order to render them. A Physics system could examine Velocity components to mutate Position components. Another strong characteristic of the ECS pattern is that all the game logic should reside in systems and that systems are responsible for the interaction between components.
ecs-data-logic

Fig. 2 — Entities (Top) can be seen as “bags of components”. Systems (Bottom) update them. There is a clean separation between data and logic.

ECS is a component-based pattern with a strict separation of data and logic. The Unity game engine often comes into the discussion when speaking of components. However, the vanilla Unity approach is looser in its definition: a component (MonoBehaviour) contains both the data and the logic. Some libraries do provide an ECS layer for Unity, such as Entitas.

Here are the benefits that we expect from ECS:

  • Flexibility: it will be trivial to dynamically alter the nature of our entities. Want to temporarily buff a unit? Simply change the data in the appropriate component or swap it with another component altogether. Similarly, systems can be enabled/disabled at runtime, which is extremely useful to un-complexify the game for testing/debugging or to reproduce Minimal Working Examples.
  • Data-driven: because ECS is so strict about the separation of data and logic, we should naturally end up with a more data-oriented application. Hence, it will be more straightforward to deserialize our on-disk game data (authored by the game designer) into game entities. Similarly, it will be easier to sync this data over the network without resorting to an intermediary form.
While it was not the reason for this refactoring, ECS is also known to be performance-friendly because the underlying data structures are often layout in a way that corresponds to their processing. That is, same-type components that are processed sequentially by logic systems are contiguous in memory. Thus, the CPU cache is happy.

Practicalities

The new architecture had to mesh well with most of the code that was already in place. To this end, we designed the central data store for entities and components (the Entity Manager) to expose them in different forms to the “legacy” code and to the “new” code (which will reside in Systems).

The gist of it is that the legacy code uses stand-alone Entities with a similar API as the old stand-alone GameObjects. However, the new ECS systems leverage a more sophisticated approach in which they process views on entities that match certain compositions (each system has it own criteria).

Fig. 3 gives an overview of this architecture. Each part will be discussed in the following sections.

Fig 3 -- TODO

Fig 3 — Our ECS architecture. The game data is exposed to the “new” code and to the “legacy” code in different forms.

Components

We use an interface to mark a class as being a component. Notice that there is no internal references to the entity that owns the component. This is a voluntary design choice: not exposing the owner forbids indelicate programmers to access unrelated data (eg. myTransform.Owner.AnUnrelatedComponent). Even more importantly, not exposing the owner prevents to add any logic to the components that could mutate them from the inside, since their context of execution (the “neighbor components”) is unknown. The way in which logic systems do access this context in order to make components interact will be discussed in a further section.

EntityManager

The entity manager contains the meat of our implementation. It has the following roles:

  1. Managing the entities lifetime. Users have control over the creation and destruction of entities. On creation, an entity is given a unique ID by the manager. Under the hood, entities are stored in a map in which they are indexed by this ID.
  2. Composing entities. Users can create, destroy, and query components. Components are stored in a matrix-like structure where rows correspond to the various types of components, and columns correspond to entities. Querying component X of entity Y is a matter of looking at element (X, Y) in this map. Tab. 1 illustrates the kind of data that can be found inside the matrix if you were to inspect its content (this article provides a nice illustration of this layout).
  3. Categorizing entities with respect to their composition. The last job of the manager is to keep track of which entities match a set of user-defined compositions. In this way, logic systems can process only a subset of the existing entities and only consider components that are consistent with their work. This mechanics is detailed in the Logic Systems section.
Tab. 1 — The game data is stored in a matrix-like structure that associates component types and entity IDs. Rows correspond to component types. Columns correspond to individual entities. Changing the composition of an entity simply consists in filling its slots with other components.
ENTITIES
#1
(tank)
#2
(resource)
#3
(decor element)
#4
(factory)
COMPONENTS Transform
  • x: 0
  • y: 5
  • z: 1
  • x: 0
  • y: 0
  • z: 3
  • x: 0
  • y: 0
  • z: 5
  • x: 3
  • y: 10
  • z: 10
RigidBody
  • type: dynamic,
  • mass: 1000
  • type: static
  • type: static
Model
  • name: "tank"
  • name: "crystal"
  •  name: "tiny_rock"
  • name: "factory"
Weapon
  • effect: "laser"
  • dmg: "5"

This structure is a good illustration of the flexibility provided by ECS. It really favors experimentation and quick iteration because, once all our components are defined, we can design entities with novel behaviors in a pinch. For instance, it’s trivial to weaponize a factory (give a Weapon component to #4) or to make some decor elements interactive (switch the RigidBody of #2 from static to dynamic) so that players can play with them.

Entity

An IEntity instance exposes methods for mutating and inspecting a specific game entity. In practice, this interface is mostly used by legacy code that has not been converted to ECS. Because its usage closely resembles that of the previous architecture (a stand-alone GameObject held all the data of a single unit/building/game thingy), we kept a similar API, which significantly reduced the amount of code rewrite.

Manipulating entities is straightforward:

The concrete Entity class that we use acts as a facade for the EntityManager. It also adds a layer of cache in order to reduce queries for the most used components, plus game-related metadata that we had to keep for legacy reasons.

Logic Systems

The last part of the architecture deals with the logic systems that update the entities’ components and run the game simulation. Let’s start by looking at the type of code that we wanted to avoid writing:

We did not want to iterate blindly through all entities (there could be thousands), filtering them away with some predicate, only to process a fraction of them. Instead, we needed a way for each system to express which types of entities it is interested in ahead of time, so that it would only process those.

This mechanics is made possible by the formulation of compositions. A composition is a user-defined class with a number of fields of type IComponent, as well as a reference to an entity that possesses said components.

A composition instance, or node, can be seen as a view on an entity, exposing only components of interest. Their creation is handled by the entity manager who is already responsible for mutating the entities and thus provides the best place to also inspect them when a change in composition happens. Basically, for each existing composition type TComposition,  the manager has an internal collection CompositionNodes<TComposition> containing one node for each entity that matches TComposition (see code sample below).

The logic systems can access those node collections via the EntityManager.GetNodes<TComposition>() method that was seen previously. They can also subscribe to two events: OnNodeCreated(node) and OnNodeDestroyed(node). The collection raises OnNodeCreated when an entity matches the composition and it raises OnNodeRemoved when an entity does not match it anymore. In this way, systems do not need to consider an entity during its whole lifetime, but only when the entity’s composition is relevant to its work.

Here is an example of a physics system written with this strategy.

In this example, the system reacts to new entities having both a Transform and a RigidBody, and it manipulates nodes exposing only those two components. A benefit of this approach is that a programmer does not need to know the inner workings of our ECS implementation by heart to write new systems. The entity manager does all the bookkeeping by tracking which entities match which compositions, and systems just have to listen to the events that it raises.

This notion of expressing subsets of entities to work on can be found in other forms in established ECS libraries. For instance, Artemis-odb lets users formulate aspects and the Ash framework lets users define nodes in a way similar to ours.

Results

After spending several months coding gameplay within this new architecture based on ECS, some conclusions can be drawn.

  • Unavoidably, refactoring a sizable codebase such as Win That War!‘s was several week’s work. Switching to this new “philosophy” also required a bit of getting used to from everyone in the team. So, all in all, the move to ECS took a bite in our schedule. However, the promise of ECS is to make up for this lost time with greater speed and flexibility during the rest of the development. It seems that ECS is already paying dividends as we now iterate more quickly on new features.
  • We had to make some compromises during the switch to ECS and chose to convert specific parts of the codebase in priority. Some aspects of the game logic still adhere to the old ways of doing things and will probably not be updated due to lack of time. And this is fine, because these parts interface well with the Entity facade that we described. In any case, the code that has been converted — as well as new code — feels cleaner. It’s just simpler to write clear, explicit code, and a lot of complex use cases just seem to sort themselves out naturally.
  • Finally, the ECS favors isolation, which is precious for testing/debugging purposes. For instance, we obviously don’t want to pull all of the game rules in our unit tests and some game mechanics that would be constraining in this context (eg. the need to be close a relay for a unit to be active) can be trivially disabled by turning off the systems that handle them.
Screenshot of Win That War! with the components of several in-game entities

Fig. 4 — Some components actually used in Win That War! for different units.

To conclude, switching Win That War! to the Entity-Component-System pattern required a significative amount of work but we are already reaping some benefits. The gameplay code is more modular since various aspects of the game are now neatly decoupled from each other. Most importantly the game code feels clearer and gives us a better sense of control. For the curious, Fig. 4 shows a screenshot of Win That War! with some of the components that are actually used under the hood.

About this Command Unit trick that we had to resort to (the building version sneakily swapped for the mobile version): now we just give our unit a Building component when it lands. When the unit takes off, we replace the Building with a Motion component and all is well in the ECS world!

References

Procedural generation & P2P

Network, network aaaand network… yeah, I’m working on multi over Internet mod for some months now. But here it is, today I decided to take a rest and write a post about the backstage, for you!


p2p

RTS & Lock-stepping

In a multiplayer game, we use the network to synchronize the world’s state on all the computers. Every player has then the same representation of the map than the others. Following the example of all known RTS,  WinThatWar! network layer is based on an algorithm called lock-stepping.

The classical approach (in FPS for instance), is to synchronize the internal representation of every items of the game by relaying, via the network, the changes bring to the other players. In a RTS, we can get to hundreds, even thousands of items to synchronize at the same time. So, you would probably understand that’s not possible to send, 5 time a second, the exact location of every unit of the map to every player in the game. However, even the most frenzied korean Starcrafter doesn’t exceed more than 5 commands by second, so that’s 300 APM (actions per minute)… Ok that’s not so bad.

To simplify, the lock-stepping will “cut” the game in 200ms turns. During that turn, we’ll record all the controls of the player: selection, moving orders, attack orders… At the end of the turn, theses controls will be send to all the other players while you’re waiting for their own. After a period of time, all the players finally get the list of  all the controls for this turn. This list is delivered to the game-logic (AI, Gfx, etc.) that will execute them (the controls). Then, the next turn begins. If the game-logic is determinist, which means it will always get to the same result for a given list of controls, the World state is exactly the same for every player. It’s called “Synchronous simulations”.

In facts, that’s a bit more complicated: we mask the network latency by simulating a n -1 turn, so we give time to the next turn controls to arrive before the end of the current turn simulation. Are you still following me? Anyway, in the case of games over Internet, we just make sure that these turns length of time vary depending on the players’ computers and network capacities.

This paper, wrote by Age of Empires creators, describe this principle very well.

At the end, the network part is quite simple. The true difficulty resides in the game-logic determinism. For a given list of controls, all the computers have to end in the exact same result.

Procedural generator & GPU

In the case of WTW, we chose to use procedural generation to produce our maps. We’ve actually got a tool that allows us to define varied maps styles, then our generator is able to create an infinity of variants of them. Well, we have to confess that’s still a bit experimental now, but we’re working on it!

For the sake of performance, the maps relief (heightmap) is generated by the graphics card with the help of Pixel Shader, at the very beginning of the match. That’s quick, and efficient.

Problem is there’s still some negligible differences between what results of two graphics cards made by a different constructor or so. Usually, it really is a tiny variation, in the range of 10e -5 or 10e -6 maybe (0,00.001 and 0,000.001 if you prefer). But here it is, that causes troubles in the synchronous simulations. For example, at Player 1’s, a tank could perfectly shoot the target, but at Player 2’s, the tank seems a bit upper on the map, and it can’t shoot. In short, that’s not synchronous anymore. And we do not like it this way.

P2P transfer & ECC

I the way to fix this problem, in LAN mode, the host was sending his own heightmap to all the player. This way, we ensured there was no display difference. But we can’t use this method  concerning the multiplayer over Internet mode. Our largest maps heightmaps is around 400Ko heavy. In the case of a 8 players game, the host would have to transfer 7x400Ko of data, knowing our Network technology is P2P based, and if, like me, you didn’t have choice and subscribed to an ADSL which don’t allow you to upload more than 100ko/s… it would take you 28 seconds just to transfer the map. And we all now, here, how these seconds can seem lengthy when you wait a game to be launch.

So, this is roughly how it works at Insane Unity: If 8 players join the game, the map is “cut” in 8 parts, and every player send his own eighth to the 7 others. So one player will upload only 350Ko (7x50Ko), which means 3.5s sending time.

Actually, the map is “cut” to be as efficient as possible for the processor cache, but in any case, it doesn’t change anything of the 8 parts things, since every player will send more or less the same volume of data.

Engine

The heightmap in Yellow, the cutting in Red.

But wait for it… that’s not the best!

I think that ECC (Error Correction Codes) are one of the most magical thing of informatics. The principle is to use an abstruse mathematical process: For one data bloc, a “parity” bloc is reckoned. The whole (data + parity) is relayed, then through a second abstruse process, we can firstly check that none of the data are damaged, and then fix the potential errors. Reed-Solomon codes (RS) might be the most used: CD, DVD, Blu-Ray… it even works when it’s scratched. And, if as mine, your ADSL is a 2,5km long interferences antenna, I think you might be happy that your residential gateway or router fix some of the errors.

reed_solomon_code_word

RS bloc coding, n = total weight, k = playload (useful data), and 2t = parity. Through a 2t parity, you can fix up to t errors.

Well, let’s get back to our map. The heightmaps are almost the same for all the players. So, I’m using the RS to calculate a parity bloc, and that’s what players are exchanging through the Network. Then everyone can apply the error correction, and that’s how all the players will finally can have a perfectly identical map. Oh yeah, I almost forgot, parity bloc is obviously smaller than data bloc but you probably noticed that already. In our case, it’s RS(223,255), being 32 octets parity and 223 octets of data. Let me do the calculation for you: Now, the players just have to upload  50Ko each thanks to this method, which means an half a second transfer.  And that’s what we like!

So, that’s my daily life at Insane Unity. Hope you enjoyed this post.

Doom

Roadmap little changes

Hi people!

It’s been a long time I haven’t wrote anything on this blog. That’s why I take advantage of this post-return of summer holidays break to bring you some general news.

From movie the mummy found on tumblr

So! Insane Unity is doing well. Doom is still working on his network stack (which has quite progressed), and Philemon get back to a concept arts phase (which are also in a good way). Also… our two trainees abandoned us last week (sob).

Anyway, we’re still looking for financing and that takes a lot of time, but we’re doing our best to stick to our roadmap at the same time. And as you’ll see below, that was not as effective as we expected. Let’s see what we forecast for September:

  • HUD (tactical information)
  • Tutorial
  • Multiplayer over the Internet
  • Gameplay-guided music

Hum. Well, the HUD is functional, as you may already know if you receive our newsletter, but we’re waiting for Philemon to find a moment to draw some pretty strategy icons miniatures before we let you test it.

About the tutorial, we’re waiting to finish fixing every single interface issues. But, here is the point: Since I had loads of administrative tasks to handle these months, I barely made progress on the interface. Maybe I should buy a tie (just kidding). Even though, I found some times to work on the AI, and that’s the good news. Be patient, I’ll wrote a  post about that later.

Multiplayer over the Internet mode is working! Here is another good news, right? At least, one of us is doing his job, here: Doom. The connecting time between two players is just melting like an icecube on the top of an uranium battery, and the stack is getting stronger and  more and more efficient. Maybe Doom will also write a post about this in a couple weeks.

Last but not least, about the gameplay-guided music, we just have to integrate in the engine the loops CiD produced on Wwise.

I think I’ve nothing else to add. I just wanted to be honest with you and confess my mea culpa before sneakily going to modify the roadmap on WinThatWar! website.

Bye everyone, and thanks again for all your support.

Etham

the decal system part 2

You missed the part 1? Keep calm and click here.

Long distance decals

The problem with the artillery in the game is that you don’t have a clear idea of its possibilities. For example, you’d like to park it behind a mountain and target the enemy base, forcing him to bypass the relief and loose a precious time. However, since it is impossible to have the base and your artillery in the same screen, you cannot know how your artillery would react to such an order. In fact, if not at range, it will move right into the enemy base and be destroyed. The point is, when you start thinking strategically and not just a-clicking the enemy, you need critical information, such as the range of a unit.

Now technically, how should we do it ? We could make a decal from a texture, as we did with the selection circle, but that would be a really large area, mostly empty, so it may not be the best option. What we can do, is using the GPU to render vector art on the screen. I’ll explain it later, but if you want to know more about it you can check this chapter from GPU Gems 3 : http://http.developer.nvidia.com/GPUGems3/gpugems3_ch25.html.

But, what is a vector art?

The most common way to consider an image on a computer is basically with a table of colours. When you create an image you have to define its size, which is the number of pixels it contains, and each one of these pixels will have a colour. So all you have to write in the file are the colours of the pixels in the right order, and the GPU will be able to print the image whenever you need it. However, this induces a small problem when it comes to scaling the image.

Picture yourself in a FPS, and in front of you is a brick wall. You are a few meters away from the wall, and can admire the beautiful brick texture the graphic designer created. However, as you get closer, this texture takes a bigger part of your screen, since it is larger, in pixels, than its original size. At this point the details of the texture are less accurate since the colour of a pixel is extended to 5 or 6 adjacent pixels. We could increase the size of the texture, but then the file would be two times bigger, and we want to avoid a heavy file that will take longer to load.


briques

The classic way to overcome this difficulty is vector art, used in the svg format that we need for large decals, such as ranges. The idea is to save a description of the image that doesn’t depend on its size in pixels. To do that we rather consider the curves that form the image, as “paths”. Each path is a command, a set of points, plus a colour and various options about fill, or stroke, or whatever you need, defined in the svg standard. But it will be easier with an example.

Please, draw me a triangle

Let’s make a simple triangle : all we have to do is draw three lines, with each end being the beginning of the next one. For instance,

M 0 0 L 0 100 L 100 0 Z.

This is what a path looks like, a set of letters that are commands to indicate a certain shape to draw. The numbers after it are the coordinates that describe this shape. M means “Move” the current point to this position. It represents the start of the shape, as if it was the position of a virtual mouse. Here we position this cursor in (0,0). L is the command for “Lineto”, that draws a line from the current point to the arguments. At this point we drew a line from (0,0) to (0,100) then from (0,100) to (100,0). Z is the command that closes the shape, by drawing a line to the start point. In this example the line joins (100,0) and (0,0).

triangle

We now have a triangle between the points (0,0), (0,100) and (100,0). We can add options like “fill: black” if we want to fill the shape in black, but basically that is how svg files work.

This way, we can always adapt the shape to how large our image appears on the screen, and then avoid the problem of resolution, but of course complex images can induce a lot of paths, so it is better to save it for something schematic, with only simple shapes.

Other commands (Q, C, A) are used to draw the Bezier curves that we will need for the large decals, and are a little more complex, as you will see in the next part. Yes, there will be a part 3! Wait for it.

Mineral 1 – Sharp Crystal

I won’t write a novel on this blog today, I swear.
We just wanted to show you this new modeled version of the Sharp Crystal.
Mineral PatchUntil now, the Crystal you could have seen in game was kind of a “test” model, allowing you to play the game while waiting for this new one.
The Sharp Crystal is a common ore. It’s the basic element for construction.

It’s really simple. For now, in WinThatWar! you just have to take care of the level of two resources. The first one is the Energy, created through generators, and the second one is the Sharp Crystal you have to extract through… well, through an extractor.

We chose as reference a particular ore : Ilmenite. A titanium and iron oxyde mineral.

ilmenite ilmenite
The hexagonal shapes are used to represent strengh and solidity. We hope it works!
We tried to make it very raw/unrefined, as it’s mean to be the most basic resource of the game. But at the same time we wanted it a bit sharp.

When it came to color it, we thought it needed to be Surreal, so the purple was perfect.
We really want the player (a.k.a you) to desire to find and extract this kind of cake made of Crystal.

Top View
It’s not really a retro-future style element, as you may have noticed, but I think it contrasts nicely with the retro-futurism style of the buildings, as the extractor, for example:

Extractor plus Mineral Patch

Hope you could find some on a distant planet. I think you could find it useful.

Cheers

The blueprints system

“So you want our beautiful vehicles? You want to build and deploy them on still unknown and unexplored planets? Thanks to our Blueprints, you will be able to do all this.”
Wilmuth Trueman, CEO of Robotron Industry during the IWC (Interstellar War Conference)

Well that’s a quick recap but that’s the idea (But, in his defense, he had to do quick and catchy given the stakes of this conference). Don’t worry, we are going to explain you every little details you have to know about these much talked about blueprints.

But what is this blueprint thing?

Basically, blueprints are just plans which allow your factories to build the units you will have to deploy on the battlefield. On this precious piece of paper is written everything your factories will need to know: what they have to put where and which resources they’ll need to build it (It’s ok, you don’t have to care about it, your factories will do it by themselves).

RobotronIndustry_BLuePrint_Tankweb

But I rather warn you right now, at Robotron Industry they’re not really charitable. You will have to pay for your Blueprints, and let me tell you it will be expansive! In addition, these big industrialists have found the perfect trick for these blueprints, and to keep going richer and richer: They limited the number of uses! But fortunately for you, you will be able to buy contract extension for your favourites blueprint. Aren’t they sweet?

How will it be helpful to you? Oh really, you still don’t understand what is happening here? Well, don’t expect Robotron Industry to sell you anything else than the “basic” form of their precious blueprints at the beginning. Yes this means that you won’t have definitives versions of the blueprint when you buy it. You’ll be able to upgrade your vehicles but sadly you will have to pay even more if you want to have the more powerful units in the game. Yes: PAY, again and again! Son of a…of a defective rusty robots! Wait. It’s ok, isn’t it? You already knew we wouldn’t provide you plans to build mass destruction arms at the same price as a scout plan anyhow.

Don’t worry, Robotron industry have well planned all of this, the price of the upgrades you’ll add to your units will be scaled to their strength. And you can’t say that they don’t have a conscientiousness because if they sold you fully upgraded blueprints you won’t be able to construct the corresponding units anyway, because you would probably be lacking of needed resources. See? Eventually big industrialists are nice to you, they care about you, and your base (and your wallet of course).

Well let’s talk more about this famous upgrade system. So your basic units will be upgradables by two different ways: you can choose to specialize them in their primary role, or you can choose to add this unit another role which it is usually not able to fulfil.

Let’s imagine your tanks: You’re probably using them every day but you are a bit sceptical about their destruction abilities? You can transform them into really bulky ones with better armour-plating and bigger cannon in order to inflict more damages!

Or if you are more an adept of precision strike and fast attack, you could choose to upgrade to a tank that will be faster than ever, with a better radar range and with which you’ll be able to plan recognition.

Don’t forget Michel

RobotronIndustry_BLuePrint_Engineerweb

Ah, I almost forgot! If it can make you feel better, you need to know that the Cartels you are working for will nicely provide you your first blueprints… well, not exactly. Actually, they will lend you some money so you can buy them (the blueprints, not the Cartels!). Which means that you have to think deeply on what you’re going to spend their money. Because let’s confess it would be awesome to have a laaarge amount of fighting units, but if you’ve got no engineer to build the factories which will be used to build your units, you won’t be able to build this army and we agree that would be a shame. So, please, choose wisely. Will you do that for me ?

Well, well, well. I think you know everything you have to know about these magnificent blueprints supplied by the marvellous Robotron Industry and I hope you will buy lots of them so you could crush your enemies and bring peace (’cause of course, you’re the good guy) into the whole galaxy and fortune to your Cartels.

Ah! And for the few sceptical in the back: No I don’t earn any from the sells of blueprints.

Hæternal (trainee @ Insane Unity)

A new website appears

Logo_WinThatWar

This week, we’ll just make do with a small announcement.
No big technology related blathering nor plenty of beautiful pictures today, but we promise to get back to that very soon.

Win That War! website grand opening!

Nope..today, we announce you that WinThatWar! website is now online. Universe, Roadmap, Team…some pages will need to be reworked later, so we could provide you more details about the game’s background little by little.

support devblog

Meanwhile, we hide a little surprise for you on the website. That’s not so much complicated to find, so you don’t need to train your 6th sense before visiting winthatwar.net !

Have a nice weekend, under the sun or in front of your computer, as you prefer.

About RTS engine determinism

Hi everyone!

This week I’ll write about a topic which may seems a little bit austere, but truth is that it can easily become quite fun: testing

How to test a game?

When we talk about test, it may refer to several things. In the case of WinThatWar!, we distinguish three test levels:

  • unit test
  • integration test
  • test in real conditions

Test in real conditions

Let’s start with the last one, it’s the simplest: the best way to test a game is obviously to play it. It allows you (and me also) to find out unexpected issues, not only bugs, but problem of use as well (ergonomy, feeling, gameplay possibilities…)
When you’re coding a game, you can’t stop telling yourself that you really need to improve it and you forget to play it “seriously”. That’s why, at Insane Unity, we schedule regular test sessions of WTW, that we intensified when the release is about to come out.

The problem is, after a while, we know the game really well, we play the same way again and again by force of habit, and because of that we’re becoming unable to hit the broad side of a barn. That’s why we are constantly looking for new users. Newbies allow us to easily find out ergonomy issues and to make a game which will really be easy to play. Talented RTS gamers allow us to estimate how hard to master is the game, and they bring out balancing issues and the efficiency level of the interface.

Once again, I take this opportunity to thank you all, all the alpha-testers. If you weren’t there to help us improving the game, WinThatWar! would be of a much lower quality than it is today. That’s your game too!

IMG_20150523_121101

 

Unit test

Unit test responds to a very simple problem: not to go round and round in circles everytime you’re coding something, undoing what was already working.

Before comitting any change in the code, the developer have to execute tests that will check if every module’s basic fonctionnalities work well. For example, some path-finding tests check that two groups of units can cross without striking each other, some others exist to check that our maths library’s convertion functions produce the expected result, etc.

Generally speaking, a unit test is written BEFORE coding the function it will satisfy. It’s called TDD.  This is one of the fundamental practices of agile development. Unit tests are very useful to “re-factorize” the code, in other words to deeply overhaul it without changing its functionality, in order to get it ready for the add of a new feature, or to make it simpler and less subject to bugs.

If a dev ever commit a change that “broke” one of these tests (called regression), he received an e-mail from our buddy Tim (that’s the name of our integration server) that gently insults him, and keeps doing so as long as the problem isn’t solved.

 

Integration test

Finally, the integration test takes place between the two other kind of tests I just wrote about. While unit test limits itself to test a module, integration test consists, as the name suggests, on making all the modules working together.

At Insane Unity, that means make 4 AI playing in 2vs.2 every night. Here again, Tim is in charge. Forward, we’ll check that we meet the expected balancing (for example, that AI lvl 5 always beat AI lvl3 in less that 10min.) But, for now, we’re using these tests for two things:

  • check there is no crash during the game
  • make sure our simulation is desterminist

 

RTS engine determinism

Determinism, WTH is that? Once again IT engineer gibberish…actullay a program is called determinist if it provides the same result every time it’s launch with the same starting conditions. It may sounds a bit “dumb”, but that’s not that simple. When you launch a program twice in a row on a modern computer, that’s never exactly the same starting state. So, if you ask your computer to do several things at the same time, it can choses, on its own, to launch the tasks in a different order every single time.

So what? Is that really a serious problem? Yes! When two players launch a RTS game, the world state isn’t sent by the network: it would take too long. Instead, we just send every player’s commands. Starting with exactly the same initial situation, and if we apply the exact same order, at the very same time, every players actions, we manage to keep exactly the same state, the same “reality” on every device.
But here it is, if one of the computer choses to execute the operations in a different order, the reality of every player will start to split, and that where the troubles start.

The first  versions of WinThatWar! were massively using parallelism to take part of the molticore modern processors. We quickly realised theses kinds of optimizations didn’t get on well with the network mode of the game. If you want to explore further, you can read this excellent article about Age Of Empire.

So, from now on, everytime we use multithreading, we have to make sure the operations order have no impact on the final result. And how to be really sure about that? Of course, we asking Tim for help! I told you that Tim plays WinThatWar! every night, at a rate of ten per night. That’s not all: it plays every game twice in a row, starting from the same seed and checking that every step of the world simulation is exactly in the same situation during both of the two games.

From now on, if you test a LAN pre-version of WinThatWar! with some of your mates, and if you suffer a crash, be curious and go get the log.txt file to watch it’s written on it. Now, you should know what that “Simulation out of sync!” message means. 😉

Etham

Return top