March 2014 blog archive

This page contains all the blog posts from march 2014. To read the most recent blog posts, click here.

30/03 - flagship scores

The flagship is fully customizable, so that means there needs to be some mechanism that allows to control the strength of what ships can be created. On one hand, players will receive a starting 'score' of 300, then gain 20 extra every level (there are 80 levels until the soft-cap, 120 until the hard-cap, more about that in future blogs), this score limits how strong the flagship can be. On the other hand, the stats and abilities of the flagship all have a score, which is added up and which can't be higher than the score limit of the player. Thus, leveling up allows players to build stronger and stronger, or increasingly more flexible flagships.

The tricky part is of course making sure that every ability has a proper score, which reflects its relative strength compared to other abilties. In a sense, it's not too different from what the AI does when it needs to figure out the best target for an ability : it goes over the stats of the target and applies a score to them, that way the AI can compare different targets and pick the one most suited for the current ability it needs that target for. The flagship scoring system is a bit simpler : all abilities will be divided in several groups, and each group will have a single formula. Each individual ability, depending on which group it belongs to, gets two or more values that get plugged in the formula to generate a score.
Some examples :
The passive ability 'resist' has a value A = 0 and B = 5. The play ability that allows cards to generate energy when they enter play, has A = 5 and B = 5. Both these abilities belong to the group that has 'A + B * X * X' as formula, where X is the strength of the ability.
So resist 3 has a score of = 0 + 5 * 3 * 3 = 45. Resist 1 has a score of 0 + 5 * 1 * 1 = 5.
If the play ability above generates 1 energy, it has a score of 5 + 5 * 1 * 1 = 10. If it generates two energy, the score is 5 + 5 * 2 * 2 = 25.

Next to the abilities, there are other aspects of the card that can be changed : the image, color and horizontal flip of the card, but these don't have a score tied to it. The attack (score = A * A * 3) and defense (score = D * D / 4) do have a score. Then comes the card cost, which is a special system, as players don't have too much control over it. The game will take the sum of the ability, attack and defense scores and calculates the ideal cost (right now, 1 energy for every 100 score, rounded up). If the player has chosen a single color card, the game will automatically assign 80% of the cost to that color's energy type and 20% will become random energy. If the player has chosen a dual color card (i.e. the second color is not artifact), then the split will 65%/35%. The player can't affect this step, but can choose to add a few energy or remove some. Why would you want to increase the cost of your flagship? Because it lowers the score of the ship - not by much, but it might be enough to push your ship under the max allowed score.
The energy cost mechanism works a bit as a balancer this way. And to test it, i have applied the entire scoring mechanism to the hardcoded cards that the game currently supports.
Here are the results :

Cardname abil score cost mod final score
Vector 100 0 100
Nagato 198 0 198
Akata 298 -9 289
Breaker 402 -36 366
Hiraga 817 -45 772
Venom 199 0 199
Tarogi 78 -3 75
Firewing 240 47 287
Solar Harvester 47 10 57
Solar Plant 32 6 38
Power Plant 43 9 52
Flare Spire 37 -1 36
Cruise Missile 164 -7 157
EMP Missile 33 -1 32
Star Battery 65 -1 64

The first column in the above table has the card names, the second has the score, which is a sum of the ability scores and the attack/defense scores. No balancing as a result of card cost has been applied to that column. At first sight, these scores look quite representative of the cards. I realize that the number of cards in the game right now is rather low, but these formulae aren't set in stone, so the numbers are likely to change over time.
Let's look at Tarogi, a relatively low-power ship. It has a score of 78, yet a cost of 2 energy. According to the system i explained above, the ideal cost for this card would be ceil(78/100) = 1 energy. Since the cost is two, this ship gets a bonus, in the form of a lowered score. The 3rd column shows the bonus (or penalty) as a result of the cost balancing mechanic. The 4th column then shows the final score. In case of the tarogi it's only a bonus of 3, this has to do with the fact that the ability score of the ship is so low and that the difference between ideal and actual cost is only 1 energy.
Now, look at Firewing, a rather powerful card for it's cost (it's an elite card after all). Firewing has a score of 240, not that much more compared to a Nagato, but then again, the Nagato is quite strong as well, just in different ways. But where as the Nagato's score lines up almost perfectly with it's cost (ceil(198/100) = 2), the Firewing is actually too cheap according to the mechanic (ceil(240/100) = 3). As a result, the game will apply a penalty to this ship's score (i.e. the score goes up). In this case the penalty is 47, bringing the final score to 287. You'll see that 47 is a lot more than the 3 in case of the Tarogi, that's because penalties are calculated according to a much stricter system compared to a bonus. Lowering the cost of a flagship will always increase the score of the ship a lot more than the bonus you'd get from increase the cost.

Like i said, none of this is set in stone yet. This will be a system that, similar to the AI, will be needing occasional revisions to make sure that it remains balanced, especially when new abilities are added to the game.

The table above is generated by the game, i didn't calculate it myself. This shows that the calculations can be applied to any card and not just the flagship. There are two areas in the game, besides the flagship, where this can come in handy :
1. in the random deck generator. In HD3, harder decks are created by increasing the number of elites in the deck and by increasing the upgrade level of cards. Now i can technically have the generator look at the actual card scores, so it can create decks with mostly low-scoring cards and gradually add in more and more high-scoring cards to create more powerful decks. The amount of commons/uncommons/elites will still play a role as well of course.
2. in the custom card generator. In HD3, this generator has essentially very little control over the powerlevel of what it can create. Mainly because the sheer number of cards this generator can create is so huge. There's little point in trying to fix it. If there's one card that's overpowered i could change the generator so it would no longer be able to create this specific card, but at the same time, 1000s of other combinations will be affected by the change as well.
As a result, custom cards can be crazy overpowered (or just plain crazy). Adding in this scoring system can allow the generator to keep the powerlevel of cards it creates in check. If the generators creates a card with a score of a few 1000 and yet a small cost, it's clear something is wrong, so the generated card will have to be discarded in favor of a new attempt, or it needs to be given a proper cost.

These formulae and related mechanics have been implemented in the game already. Right now i'm working on the screen that allows players to edit their flagship.

23/03 - HD3 Flagship

The flaghip in HD3 is a fully editable ship card that serves as player avatar and has a few special abilities that can be unlocked. This will be the major new mechanic i'll be working on for the coming weeks.

There are 3 large groups in which all the mechanics related to the flagship can be ordered :
1. The flagship is in essence a normal ship card and functions like any other ship card, but has a couple unique mechanics. More about this below.
2. The flagship is fully customizable, so there must be some form of editor that allows players to edit their flagship. Since things must remain balanced, all abilities need to be given a score, so that the total score of the flagship can be controlled and tied to the level of the player. Some abilities will have to be excluded, both for mechanical and balance reasons. An example of a mechanical ability is the auto ability 'the acti of this card gets +1'. It's clear that combined with some actis, this ability does nothing, but with other actis it can be completely overpowered. Abilities like this exist on hardcoded cards because such cards are made with balance in mind, so this ability would not wind up being combined with an acti that would make the card too powerful.
3. The flagship has various roles in multiplayer, and most things related to multiplayer are not going to be added in the earlier alpha versions of the game. Next to being your avatar (with the possibility of players being able to display medals or badges as a result of achievements on this avatar), your allies or friends can use your avatar to aid them in battle. There's a lot involved in this seemingly simple idea, so for the time being, i'm completely leaving out anything related to multiplayer for the flagship.

The first group of mechanics has been implemented for the most part. The flagship shows up on the opening hand when you have selected a game mode that supports it (screenshot 1). During combat, this ship sits in a seperate part of your hand (screenshot 2). It can't be discarded by any player and it doesn't count towards the max number of cards in your hand. When the flagship has been brought into play, the image in the opening hand changes (screenshot 3) and when the card is destroyed, there's yet a different image (screenshot 4). When the flagship dies, it never goes to the scrapyard, so it can't be recovered. If the ship were to be returned to your deck however, it instead goes back to your hand right away. Basically the flagship can only exist in 3 states : 1 - in your hand and ready to played, 2 - in play, 3 - destroyed and no longer available for this duel.

The second screenshot shows a new passive ability, called 'assemble'. As part of the balance of a fully customizable card, the card's attack and defense values bring with it an automatically calculated 'assemble' ability. The higher the attack and defense of the ship, the higher the value of this ability. So what does assemble do? This is the in-game description : Assemble X : for as long as assemble is larger than zero, this card can't be played. While in hand, assemble is lowered by one at the start of each of the card's owner's turns. This card must spend X more turn(s) in hand before it can be played. Note that the very first turn of each player does not lower the assemble counter of cards currently (which is intended to keep cards in the opening hand from getting a free extra assemble counter decrease).
Outside of the flagship, there are currently no cards planned to have this ability, but that might change in the future. There are some interesting things that can be done with this ability. There could be large ships with a slightly lower cost, but with a reasonable high assemble so that they can't be played too soon. There could be actions that randomly give a number of cards in the opponent's hand some assembly counters. There could be an environment that does the same, and so on.

Another (minor) thing that might become clear for the screenshots is the fact that the game now supports card image colorization and horizontal flip. The flagship that i've made for testing purposes, uses the Vector card image, but colorized and flipped.

With the mechanics related to the flagship being a regular card, completed, the next step is to start on the editing of this card. Luckily the game only has a small set of abilities currently, so giving all abilities scores based on both their effect and strength (and in case of actis and actions, also their cost) might not take too long.
The screen where this card editing will happen will be tricky. Those who have made custom cards in the challenge or campaign builders in HD Xyth, will remember how many buttons the card editor had. The HD Xyth editor limited cards to having 3 abilities (one of each type), now, there's technically no limit to the number of abilities (8 for practical reasons), and on top of that, a card can have multiple abilities per type. Keeping in mind that this game also needs to be easy to navigate and use on tablets, which usually have much smaller screens than desktops, it's clear that making a good editor layout will be a challenge.

16/03 - HD3 mechanics

Another quiet week - from next week onwards, things should be back to normal. When i said a while ago that all the abilities for cards had been included with the game, that excluded the actual mechanics for passive abilities. These now function fundamentally different than in older versions of HD. A passive ability is basically a trait of the card that's always present, but previously these were actually turned on and off when needed. When a ship with resistance took damage, it was as if this ship's resistance turned on right before this damage arrived and then turned off again when the damage had been processed. For some passives (like resistance) making sure that these are on all the time, greatly simplifies everything that has to take this passive into account, which ranges from the actual board, to AI simulations and calculations. For other passives, things actually get quite complex, and the newly added 'shield' passive is such an example.

The next thing i'm planning to add to the game is a large, new mechanic. There are 3 completely new and detailed major mechanics that are planned for HD3 :

In essence this is an extra ship card for your deck. It also serves as your avatar (mainly for multiplayer related purposes). What makes the flagship stand out is firstly that it's fully customizable. You can choose any non-legend card image of a card that you have collected at least once. You can change the attack and defense values and the abilities on this card. Of course there are limits to this editing. Abilities and attack/defense values will be given certain scores, which all add up together. This total score can't go above a certain maximum, which depends on your level. Another element is that this flagship is always available for being played. It sits next to the cards in your hand, but it can't be discarded, nor does it counts towards the maximum number of cards you can have in your hand. When this ship is played and it gets destroyed it also doesn't go to the scrapyard (and thus it can only be used once per battle). The big challenge with the flagship is balancing these individual ability scores, beyond that, it's simply just another card.

These are sort of deckmods that you can apply to your deck. Each skillgem only affects a small set of cards at once, however. There are two general approaches to this idea. One is that skillgems are permanent and craftable. This means the components can be collected and players can choose which types of skillgems they want. Since they are permanent, they start off relatively simple, but can be upgraded to become more powerful. More powerful gems have a higher 'complexity' score and the sum of all these scores of the gems tied to a single deck will be limited to a certain amount, again, tied to player level. The other approach is that skillgems are one-use only, in this case, there might still be a crafting system tied to them, but it won't be as in-depth since it doesn't make too much sense to spend a lot of time creating the perfect set of gems for a particular deck, only to be able to use those for a single duel.
What makes this mechanic tricky is the fact that this is a completely new type of item, thus there must be seperate browsers and editors to look at these, craft them and add them to decks.

These are shipcards again. Every card in the game that's not a legend will eventually have a mercenary version. These are slightly stronger versions of the cards that can be collected. The original role and abilities of cards will be mostly preserved, but the mercenary version might be stronger, or might receive an extra ability, and so on, this will likely be random. So a single card can actually have multiple mercenary versions of itself, with varying strengths. They can't be added to a deck just like that however. These cards are single-use. When you decide to use one (and you can only use one per duel), the card will be shuffled into your deck at the start of a game. If you don't end up launching this ship at all, it won't get used up and you can still use it in a future duel, but the moment this ship enters play, it will be removed from your collection. The idea is that these are relatively rare, but powerful cards that can give you a bonus during more difficult duels. Since they are one use and limited to one per deck, they can't become overpowered and won't replace the regular set of cards.

Right now, it looks like the single-player elements of the flagship are easiest to implement, mainly because there currently only is a small number of abilities in the game, which will need to receive scores. The multiplayer components however are more complex, but these can't be added in before plenty of other supporting mechanics have been finished first. The screen that allows to edit the elements of the flagship will likely be quite and undertaking as well.
Gems are complex due to the large number of possible combinations that are planned but also since it introduces an entirely new type of item into the game.
Mercenaries are possibly even easier to add in than flagships as these are not planned to have any multiplayer aspects and they also don't need to be edited or crafted by the player, so there won't be any extra screens that need to be set up (except a browser perhaps). On the other hand, content-wise, there's a lot of stuff that needs to be prepared and balanced for this mechanic. I don't know yet if it'll be better to add these early on, or wait until there are more cards in the game.

09/03 - Small updates

As said last week and as expected, there wasn't much time to work on HD3 this week, so i ended up doing a various smaller updates and fixes.

Several dialog boxes for the combat screen have been added, these allow to check the contents of the scrapyard or get more details on the stats of the base (retaliation, repair, resist, mitigation). The combat log and the player overview windows have been added as well. The latter is something that will be more useful in games with more than 2 players. This panel shows for each player their HP, number of cards in hand and in deck and the number of ships and structures in play, as well as the team this player belongs to.
The card images for all cards currently in game have been added as well, so there are no more placeholders (except for the icons for acti abilities on cards).
The buttons on the sidemenu that's visible during combat have been activated as well.

All small things, nothing too exciting, but stuff that needed to happen sooner or later anyway. But with these things done, i've run out of small updates for now. I could prepare the next big mechanic over the coming week (i expect not being able to do much coding then either), so i can get started on it the week after that. But, i haven't decided what this mechanic should be yet. It's likely that i'll have to work out multiple mechanics on paper first, to figure out which of these depend on each other and in what ways. Then i can decide in which order these need to be added.

I could also add in a few more cards. HDx has almost 500 cards, so all the steps involved in adding one card to the game will have to be repeated for all of these cards. This changes over time since there are many cards that use abilities that are present on other cards as well. So if i start with Human cards, then Ca'anian and so on, by the time i reach Technomancers cards, the vast majority of abilities have already been added. In general, adding a new card starts with adding the raw card data to the game, this is a set of numbers that describes everything on the cards, such as attack and defense values, abilities, rarity and image. Then i have to check which abilities are not in the game yet and make sure that the game has code to properly handle the effects of these abilities and the AI is capable of interpreting the strength of these abilities. The complexity of individual abilities differs greatly - for some cards there's almost no work involved, for others unique new mechanics need to be added to support their abilities. When cards have abilities that require targets, the part of the game that figures out which kind of targets need to be made available when you activate such an ability might need to be updated as well, to support this new ability. If a card has abilities that didn't exist in the game yet, these need to be tested of course. Finally, the card's image needs to be added to the game as well.

02/03 - Game over complexities

Due to unforseen events, last week was kinda hectic, so i didn't get to do much work on HD3. I expect the coming two weeks to be similar, so i'll likely focus on smaller updates for the current stuff already in the game, rather than starting on completely new mechanics.

I mentioned game over detection in the previous blogspot as one of the elements i was going to work on next. I quickly realized that things were going to be a bit more complex compared to HDx and HDs. In older versions of HD, game over detection is simple : the game just needs to keep an eye on players that reach zero base HP (when decking is a loss condition, having zero cards in your deck when you need to draw, simply sets your base HP to zero). Since there are only two players, the player whose base HP is zero, is the one that loses the duel.
In HD3, the plan is still to have up to 4 players in a game, and on top of that, those players can be in teams. Its clear that in such games, a single base going to zero HP doesn't always result in the entire game being over. Example : take a game with 3 players, of which the two AIs are allied. If one of the AIs is defeated, the game goes on, but if the player is the first to get defeated, the game must end. In this game, the player will be in one team and the two AIs will be together in another team. Determining that the duel is over is quite simple : if all the remaining players all belong to the same team, they are the winners. This works in regular 2-player games as well, since there will be two teams with one player each. In the above example, the game can thus end even though there are still two players alive (the two AIs). In a game with 3 players, each in a different team, and thus all enemies to each other, the game will only end when there's one player left.

Detecting when a duel must end is thus relatively simple, but there's a completely new element now compared to older versions : when a player is defeated, the game must temporarily pause to show a base explosion or similar visual effect and then be able to properly continue after this animation has completed. Unlike individual card explosions, where the game can continue without problems, there are a number of things that can complicate matters. The most obvious example is when the player that just died was the one that's active. Lets say this player does something during their main phase that brings their own base to zero HP, or one of their cards causes this during their upkeep. The game pauses, shows the explosion animation, and then it must continue. But since the active player is now no longer part of the game, the current turn must stop and the game must start the turn of the next player.
In older versions of the game, there's no difference between game over for a single player and game over of the entire duel : when any player is defeated, the duel is over automatically. So far the new setup is working well, but i can only test it for regular two player games as HD3 can't handle games yet with more than 2 players.

There are other elements related to game over with multiple players that still need to be figured out. For instance in a 'free for all' game with 3 players, where you and two AIs are each in their own team. If you end up being defeated first, there are still two AIs in the game who will now fight against each other. In this case, the player should ideally be given the option to exit the duel earlier (or perhaps an option to speed up the fight between the two AIs, that would be fun). In a game with 4 players and two teams of two players each, you'll end up having an AI ally and two AIs that work together against you and your ally. Should you be defeated first, you still have your ally that might win the game for your team. In such a case, you should still get some reward (but not as much as if you survived the duel for instance). Another option is to give the player control over this AI, so the player isn't merely a spectator.