## Thursday, December 27, 2018

### Word puzzle generation

As planned I have an algorithm to generate some puzzles. It finds common words that use a combination of letters and arranges them to maximize the number of word intersections on a grid.

So many puzzles can be generated with just four random letters. One of the first puzzles it generated included the word "assess"... emphasis on the additional 's'. With that said, I would prefer not to ship a game with such an unpredictable algorithm, so I would manually approve each one to feed back into the source as hard-code.

Alternatively, I could feed in words and have it spit out puzzle layouts with letter sets. There are many possibilities on how to proceed. For now, I would prefer to keep this first word game simple.

Daily challenges could just pull from a large and challenging list (nobody would notice repeating puzzles).

I have a pretty firm idea of what I want to create. Most of the effort will be polish. I consider this smaller project a "break" between the marathons of Match 3 Fantasy and Zombie Guard 2 because it is less content heavy.

## Wednesday, December 26, 2018

### Early ratings

Match 3 Fantasy has been updated again, fixing more issues including ones introduced in the big Unity engine update.

 Early ratings of Match 3 Fantasy

Early ratings are positive, so I am thrilled. The benefit of having over a dozen finished games is that it removes a lot of pressure. In my experience, sometimes I win some, sometimes I lose some. I continue forward, as a better developer than I was the year before. I predict the rating will drop as more bugs surface and features are requested.

## Wednesday, December 19, 2018

### Word games?

As mentioned in a previous blog entry, I considered making a Zombie Guard 2. But as I go through the Unity asset store, I found some wonderful art packs for other kinds of games. I am leaning towards making a word game instead.

Time to go on a shopping spree! Long gone are the days I would sit down and draw these. It is just no longer cost-effective, and I would rather write code and create games more efficiently.

Having art from the beginning allows for all kinds of interesting game ideas to emerge. I can drag and drop pieces to help come up with new ideas while listening to audio packs.

I am convinced that I could easily write some brute force algorithms to generate necessary puzzles for word games. For starters, all I would need to do is copy-and-paste a dictionary of common words sorted by category and run some algorithms offline based on game rules.

## Monday, December 17, 2018

### Match 3 Fantasy

Match 3 Fantasy has been made available to the general public! The first update already has been distributed - adding in more bug fixes, a new hammer trinket, and the gorilla hero.

Will it succeed? Only time, and more updates will tell. As a puzzle RPG, my fear is the game is too casual for the RPG audience, and too complex for the puzzle game audience. The app is being approved by Apple for iOS; it is already available through Google Play.

The name intentionally was chosen to be optimized for search results.

Ads are still king for revenue. But as the game continues to get larger through updates, I may rip out ads and in-app purchases and distribute at a fixed price for PC and Mac through Steam.

Onward...

I'm probably just going to make a Zombie Guard 2 for project 16. The demand is there, and I could still push design by offering weapon crafting features and extra content to extend the game. I have acquired a great deal of experience with the Unity engine, so it will have much better special effects and general usability than its predecessor. Although I'm tempted to use real-world locations for international appeal, I fear it may do more harm than good due to tension between rival nations.

## Sunday, September 30, 2018

### Match 3 Fantasy

This evening I held the closed beta of Match 3 Fantasy, uploaded to the Google Play app store.

As I played it, I recognized all the hard work that cohesively came together. The long sessions invested was worth it. I also regained ambition on my career during this solo journey across foreign lands.

I feel very confident continuing to use the Unity engine. I already know what I want to work on next, but for now I still have work to do on Match 3 Fantasy and Zombie Guard.

 the updated website

I will gradually expose the app worldwide. I continue to work-full time on it.

## Sunday, August 26, 2018

### New Heroes

Three new heroes have been drawn and animated. These as an addition to the other three ought to be enough for now.

Not shown are some of the disastrous sketches. Apparently drawing a polar bear is really challenging, so instead the cold based hero is a penguin akin to a Spartan.

## Monday, August 20, 2018

### New ratings for Zombie Guard

I'm glad to say the big update for Zombie Guard was a success. The rating has increased and there were only minor issues that have already been resolved.

 New rating (left) based on 41 reviews

This started as a minor update, and ended with more features than anticipated. I began to see more possibilities and just went with it.

Stability also has improved. Crashes have reduced 20% on graphics and input systems. Of course all I had to do was download the latest version of the Corona engine.

### Fire... Fox

Given the five types of elements, I needed an animal specialized in fire. A mythological phoenix came to mind, but seemed too tricky to draw and animate as a chibi (mini) character. So, here is a Fire.. Fox. Partially designed as the magician class of Everquest without any summoning abilities. This creature can hurl a powerful fireball, enchant weapons to deal fire damage, and give a fire shield for armor and returned damage when struck.

The staff through a custom "ModelAttachment" script is not being placed correctly. The weapon should be placed behind the arm, as specified in the draw order of Spine. It works correctly for the other heroes. One of many unforeseen problems to address.

## Wednesday, August 15, 2018

### Treasure Hunt Challenge

In order to break up the monotony of battles, there will be mini-game challenges to gather resources. In this one called Treasure Hunt, after a match is made, one cell (typically the latest one moved) of a contiguous block will be upgraded to the next type and the rest are removed. A match can be made mid-air with that upgraded cell, before it even falls to the bottom. There are a limited number of turns, and a match-4 or greater awards one extra turn.

It makes a lot of sense when played. There are many strategies too.

 "Treasure Hunt"

I had to rewrite the algorithm a few times until I got it completely correct. I use basic AI to play the game for me in fast-forward mode. There was a rare bug I fixed where cells would annoyingly overlap one another.

## Sunday, August 5, 2018

### Big update for Zombie Guard!

It is about time. A much needed update for Zombie Guard is on the way! Three new weapons, a new level, and multiple competitive survival modes.

Working on this update is a delicate task. I must be very careful not to make mistakes that could destroy the saved progress of many of the current players. I plan to serve the update to a small percentage of users, gradually increased to 100% if there are no reported issues.

But fortunately, this update does fix a notorious bug that has existed from the very beginning. Thanks to a fan, I was able to reproduce it. It turns out equipping landmines as the primary weapon would freeze the game going into any mission.

In the future I am a bit tempted to make a Zombie Guard 2, in Unity, with much better special effects, audio, music, and features. Zombie Guard is made in Corona, which these days is a less supported engine that I do not recommend.

## Tuesday, July 10, 2018

### Items!

Each time a match-4 or greater is made, an item is created in place. These are intended to speed the game up. Skills need to be placed on marked cells at the expense of harvested gem elements, so an explosive for instance, effectively clears cells while harvesting resources in one go. Even better, an item can trigger others as a chain reaction if lined up properly.

The type of item created is determined randomly. All unlocked items can be added to the range of possibilities. Perhaps for strategy, opting only for one particular item would be suitable. It all depends.

## Thursday, June 21, 2018

### Ancient Artifacts

Here we go, ancient artifacts for long-term playability. These are permanent bonuses for successive runs, in order to progress a tad further each play-through. By entering the portal, all progress is lost except ancient artifacts and energy to further upgrade them. For example, one ancient artifact can increase all red damage, and another one reduces the cost of upgrading items for all successive play-throughs.

 Holding the staff button on the bottom upgrades the selected ancient artifact.

The numbers take into consideration the targeted language. In English we use commas to separate thousands and a period for decimal places. Some languages interchange these two symbols. Other languages use apostrophes too. This was fairly trivial to handle because C# allows this change through the CultureInfo class.

A feature like ancient artifacts and language localization are two critical features missing in Zombie Guard. That app will get some updates soon, after I am finished with this one.

I started debugging the app through my Android phone and the SDK. It is really motivating to hold the game in my hand, rather than poke at my laptop screen within the Unity application.

 The game being debugged, connected to my laptop

I feel like I've doubled my skills with Unity during this month in Canggu. After I reach beta, I want to invest some time researching some open source Unity games and script packages in the asset store. There are so many little tricks in this engine and C# that I have accrued from here and there.

## Tuesday, June 12, 2018

### The Cloister

I added a new zone called "The Cloister". It lingers with arcane and cold magic. It is populated by the undead and supernatural creatures.

Arcane magic (purple) is pure and it is the only elemental type that cannot be resisted through armor. It can even deduct a percentage of life, so it can be rare but rather destructive. Meanwhile the apparitions wielding lanterns can temporarily blind heroes, preventing basic attacks and skill activation. This is a dangerous zone, so a strong offense to kill swiftly will be a viable strategy.

 The Cloister (the path will be fixed)

Each of the three current heroes now have a third skill. The frog with his/her "Cold Vine" skill can now bring any enemy to the front while inflicting nature and cold damage.

Yellow topaz gems used to represent pure physical damage. It never looked right and would clash with the orange coins. I replaced them with white gems, which makes a lot more sense given the purity of physical damage.

## Monday, May 28, 2018

### Monkeys and rewards

Lettin' it rain...

 Rewards given at the end of a battle

I used the monkey art from Gassy Goat, by animating him in Spine and exporting for Unity. He delivers all the goods at the end of a successful battle. These rewards are predetermined, and include the in-game currencies of coins and fruit, and different keys for unlocking loot.

 Reward chests with keys. I just noticed that I need to change the color of the explosions.

Loot is unlocked by using keys of the five elements. Certain heroes, skills, and equipment can only be unlocked by a particular elemental key. For example, the frog and all of his weapons and skills are found exclusively in green chests.

Hmm, so eventually, players will accumulate all weapons, skills, and heroes, leaving nothing left to unlock, correct? Yes. But, there is a hard cap on the maximum upgradeable ranks of each of these (currently 12). The enemies however, have no cap on their maximum rank; the game eventually gets too difficult to continue. At that point, there will be an option to "ascend" by resetting the game for permanent reward points to invest into bonuses for the next playthrough. If I do this correctly, then it should allow unlimited playability and a competitive leaderboard.

Speaking of monkeys, recently I explored the private monkey park here in Ubud, on the Indonesian island of Bali.

 A macaque deeply contemplating his metaphysical existence and the meaning of life. Or, how to jump onto my shoulders to conspicuously steal snacks out of my backpack.

I am completely nomadic now, renting different Airbnb accommodation each month from here on out. Ubud for one month, Canggu for the next on an extended visa. I have noticed many other digital nomads here in Ubud, typically found in some of the incredible cafes scattered downtown. The food here is healthy and the scenery is gorgeous. I will write more in my next entry.

## Thursday, May 10, 2018

I found and purchased some vertical maps and more background art from a Korean company on the Unity asset store. These are a great fit for the map loadout screen, where battles and minigame stages can be selected.

 Vertical maps (21+)

 Backgrounds pack (20+)

The vertical maps are seamlessly tiled vertically. At first I was looking to work out a license for some dungeon-crawler maps, but that fell through; I'm glad though, the vertical scrolling maps have more variety. Based on these assets, I can intentionally design and create appropriate enemies to go with them.

The difficulty of a battle can be voluntarily increased for additional risk and rewards. I went back and forth between the editor and Clip Studio Paint, splotching down rough doodles on top of the empty game screen and then finalizing them. Overnight I decided I was satisfied with it, so I exported everything and then spent the day scripting it.

## Monday, April 30, 2018

The "loadout" is underway, which contains the higher level features to purchase and upgrade equipment, skills, open reward chests, etc. I wanted to have multiple currencies in addition to the usual coins. Well, shiny gems were not a wise option, because those are abundantly matched for temporary resources to activate skills. Instead I chose cherries, peaches, and radishes to barter with the bunny merchants. The food can be grown and harvested over multiple play sessions, which makes more sense than random chests and coins in this freemium game. Bunnies favor food over gemstones, so it's a twist on the value of objects in this fictional universe akin to Defend Your Nuts and Demons Down Under.

Once this is complete, then I am that much closer to a beta release on Google Play.

The weapons are used automatically when gems of the hero's color are matched. Skills are used by placing its respective pattern on the battle board. The three red dots connected by lines in the skills loadout depict that all three enemies are targeted by toxic rain. If there is no connecting line, then only one enemy is targeted. There are still some missing features, like the gem cost of the skills and its pattern. Plus the weapons loadout is a bit of a mess, so I might just make it look more like the skills loadout by reusing most of the same code.

#### Update:

Here is the improved skills loadout with gem costs and pattern. The cost is exaggerated for sake of illustration.

I threw in a new skill for the panda too, because most of the work is just filling out some data that specifies it; the systems in place take care of most of the work. It is not entirely data-driven because I have to specify what the computed gamma value does based on skill level, and, reflect it in the skill description as well.

 Most of the code of a new hero skill that applies a beneficial buff.

## Wednesday, April 11, 2018

### Gameplay footage

I put together a quick clip of the battle gameplay. The recording is not the best quality, but it should at least demonstrate several features of the game.

I made a couple design changes prior to the recording:
• Each hero (left) will do a basic attack if their assigned gem color is matched on the board. Previously they would simply roll a percent chance to attack, following the enemy's turn. This change speeds up the battles and feels more action oriented.
• All creatures have green (poison) armor of 500 points for sake of demonstration. This armor is impervious, so will not affect the creature's life points until the armor is destroyed by incoming attacks of its color. Simple and easy to understand. Previously I only had physical and magical armor amounts, which would reduce incoming damage by a percentage; some creatures could be immune to specific elements. It was unclear and very confusing.
I'll have to add a feature later to help color-blind players discern the gem colors and their assigned elements. Color deficiency affects 1 in 12 men, and one in 200 women (source).
• Orange: physical melee and range based attacks. Swords, bows, maces.
• Red: fire.
• Green: poison and heals.
• Blue: cold.
• Purple: arcane magic attacks, beneficial enchantments.
Now, I get to clear the main board and work on the main screen that contains all the features like character customization, inventory, stage selection, and upgrades.

So many possibilities. I will buy more art through the Unity asset store to help me with this task. I may want to have a map for stage selection and some large packs of metal or wooden interface objects like buttons and scroll screens.

In addition, I need to contemplate how to extend playability of the game. Zombie Guard is flawed in that the game is way too easy when going back to previous stages to collect all the outstanding loot. It basically dead-ends too, without advancement to harder difficulties once all the stages are beaten.

## Saturday, April 7, 2018

### Easing curves for game balance

To my casual readers, you may skip to the below section on Final Thoughts if the math here seems a bit intimidating.

For Unity you can download my Easings.cs script that borrows from tween.js on GitHub. A delegate for exact choice of easing function can be passed into your custom scripts.

### Lerp and easing functions

I have been using easing functions extensively for many years, usually for animation. Easing functions are just curved functions for values $t$ from 0 to 1.
Linear is boring, but sometimes necessary to interpolation. Meaning, a value changes gradually - neither speeding up, nor slowing down as time $t$ goes from 0 to 1. Linear interpolation $lerp$ is a convenient function to compute this linear value:

$lerp(x_0, x_1, t) = x_0+(x_1-x_0)*t$.

Where $x_0$ is the initial value and $x_1$ is the final value as $t$ goes from 0 to 1. These values can be colors, vector positions, numbers, etc.

 Easing functions, from easings.net

To understand these functions, just choose one and slide your finger from the left and gradually to the right. If the point on the line is closer to the bottom horizontal line, then it is closer to the initial value. If it is closer to the top horizontal line then it is closer to the final value. Some functions can even go beyond the bounds of the initial and final values.

If we have a fireball in a game, then perhaps we might want to have its movement towards its target begin slowly, and then pick up speed until it explodes. In the second row of the figure above, are cubic functions. Notice how $easeInCubic$ would be very suitable for the fireball's movement. On the other hand, $easeOutCubic$, may seem a bit strange, where the fireball shoots quickly and then seemingly slows down before it explodes.

### Game Balance

I use these easing functions extensively for game balance as well. In my game, weapons can be upgraded from ranks 1 to 10. At rank 1 it is the weakest, and at rank 10 it is the strongest and does the most damage. The easiest solution would be to just write the damage values manually.

 Morning Star

For example, the damage of a morning star for each of the 10 ranks could be manually coded like this:
$[1, 3, 5, 18, 13, 23, 50, 83, 88, 92]$
But this gets confusing! It is too many numbers to work with. Plus, it is hard to immediately see the difference between each rank. Notice how the damage can go from 50 to 83, which is a 63% increase. That is massive and throws off the balance of the game. Also the damage at rank 4 is greater than rank 5.. oops! These errors can occur easily if we write the damage values manually.

 Fail.
A generated graph of the damage of the morning star quickly illustrates the flaws.

We need a better solution...

In my game, weapons have an initial damage of $d_0$ at rank 1. In addition, a multiplier that determines the final value $dmul$, where for example a value of 4 would mean the damage at maximum rank would be $d_1 = d_0*dmul$, four times the initial starting value. Easy! The damage for the morning star now can be specified by just two values!

So, let's give it an initially large damage $d_0$ value of 42, but a tiny $dmul$ of 1.25, so fully upgrading it only provides an extra 25% damage increase.

The linear damage of the morning star for each rank would be $lerp(d_0, d_1, t)$ where $t$ is:

$t = (rank - 1)/(maxrank - 1).$

The linear damage increase is a bit unfair because a weapon casually upgraded to rank 2, would completely outshine a new weapon at rank 1. The game balance would feel off. In addition, upgrading from ranks 9 to 10 would provide the same damage increase as upgrading from ranks 1 to 2.

$easeInCubic$ looks like a good choice. So, the revised damage of the morning star would be:

$lerp(d_0, d_1, easeInCubic(t))$.

Similar to how damage is calculated, the cost of upgrading needs to be considered as well. Suppose we use the same curve, $easeInCubic$. This would not be balanced because it would be too easy to upgrade anything to around rank 7!

I think $easeInOutCubic$ would be an interesting choice for the cost of upgrades:
 Better!

The cost for sequential upgrades always increases, but ranks 4 to 6 would have the largest increases in cost. This would be suitable because most weapons could casually be upgraded to around rank 4 until the costs get awfully pricey. Ranks 7 to 10 are where the costs are very high, but would be very rewarding due to the drastic increase in damage; there is an incentive to max it out.

### Final thoughts

Balancing a game is a continued struggle. As written above, I have chosen an approach to help adjust the difficulty of my current game in order to feel balanced and rewarding to play. In-game currency is used to upgrade weapons from ranks 1 to 10. Here is the ideal mindset a player should have while upgrading these weapons:
• Ranks 1 to 4: "Oh, these were easy upgrades. It feels like I am rich. I upgraded everything to rank 4! I like the slight increase in damage and I am not certain which weapons are my favorites. I just found some new weapons that still look powerful even at rank 1, so I will try those out too."
• Ranks 4 to 7: "Woh, these upgrades are starting to get expensive! I must be more careful in how I invest my money. There does not seem to be a noticeable improvement on damage by upgrading these, but the enemies are starting to get really tough too."
• Ranks 7 to 9: "All these upgrades are so pricey, but the damage is going way up now! It looks like the damage at rank 10 is twice as good as rank 7 so it is worth it!
• Rank 9 to 10: "Well, it was a struggle to upgrade it to rank 9, but looks like it is totally worth maxing it out because it is the largest increase in damage of all the upgrades! Now I can choose something else to max out."

## Saturday, March 31, 2018

### Milestone reached

There I sat today, in one of my favorite cafes in Chiang Mai called Ombra. It is decorated with American and European antiques. Organized, to avoid seeming gaudy or noisy. It feels like visiting someone's home. Alternative rock plays in the background, from a hidden speaker near the unplugged record player. A typewriter sits on a display desk, near books and records of classic rock bands. The hot cafe lattes contrast with the cold air-conditioning. I realize hours have passed, when my laptop alerts me that its battery is running low.

Other days I may visit the London Tea Room, which is like sitting in the lobby of Fawlty Towers.

The spacious cafe called CAMP is open 24/7 on the top floor of the nearby mall. The usual selection of Thai food vendors are just one convenient escalator ride down.

But back on track, I deployed a build of my game to my Android phone and then left Ombra. It looks and sounds great, thanks to my shopping sprees in the Unity asset store and sonniss.com. This game has a lot of potential if I keep at it. Here I am holding it up in my apartment, before going out for dinner around the corner:

Unlike my previous titles, I plan to go for an early release, but continue to nurture it full-time. It will get the attention it deserves through additional characters, items, features, and things requested by the community. The first version probably will only contain 50% of the anticipated total content to allow for flexibility.

## Monday, March 19, 2018

### A mini debug tool in Unity

There are many ways of creating a tool to debug a game. Console commands on run-time is a common one. In-game rendered menus is another. In Unity I have been using a simple game object that has a script that exposes check-boxes which act as either toggles or buttons (they automatically get unchecked). It's sufficient for my needs. It's like having a handy dandy remote control with a bunch of options to speed up testing.

The inspector of the single debug game object in the Unity scene will look something like this:

And the script is as simple as this:

 using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EPDebug : MonoBehaviour {
public bool toggle1;
public bool toggle2;
public bool option1;
public bool option2;
public bool option3;
[HideInInspector] public static EPDebug instance;
public void Awake() {
instance = this;
}
public void Start () {
}
public void Update () {
base.Update();
if (toggle1) {
// do stuff each frame
// other game objects can check this variable too
}
if (toggle2) {
// do stuff each frame
// other game objects can check this variable too
}
if (option1) {
// do something once
option1 = false;
}
if (option2) {
// do something once
option2 = false;
}
if (option3) {
// do something once
option3 = false;
}
}
}  

I have a toggle that has the game print out verbose information regarding game states and whatever information suits me. I use the button options for creating spontaneous game objects and invoking commands like giving some in-game currency. This debug menu can be extended with number fields to change global variables too.

## Sunday, February 4, 2018

### Big upcoming milestone

I am working towards an important milestone of this project - a fully playable demo. It will showcase an entire prearranged battle to demonstrate the general gameplay. It will be fairly polished, with special effects and audio that I plan to purchase in large commercial packs. From there, it will just be a matter of going into full production on the rest of the content and features, like the hero classes, enemies, and areas.

I have been contemplating some of the design features...

### Damage Types and Defense Stats

The damage types are: physical, fire, cold, poison, and arcane. All creatures tend to focus on one or more. I considered defense stats for all these, but as a player, it gets unnecessarily complicated quickly: "This creature has half the cold defense as fire, but my fire spell does x more damage, should I use that or poison at wait.. what was the poison defense again? It is a goblin, which is green, so is that more or less resistant to poison? Screw it, I'll just attack with fire and pretend it was the ideal strategy."

...So, instead, defense stats only will be physical and magical that groups all the elements into one. In order to create distinctions between the elements, some creatures in particular areas can be completely immune or resistant to one, such as fire. It ought to force the player to utilize different heroes at different areas, rather than just blindly grinding away on a select few.

### Weapons

Each of the player's heroes can wield an interchangeable weapon for basic attacks and passive bonuses. I considered having an inventory system with procedurally generated weapons and a crafting system. Instead I am just going to individually draw and author five named weapons for each class type, depending on the desired play style. The specific names will be easier to translate, rather than procedurally generated ones with names like: "Cruel Swift Dagger of Burning Flames". The grammar would not hold.

### Upgrades for Skills and Equipment

I almost always use a five-rank upgrade system in my games. Instead I may extend to ten, requiring rare and limited reagents past rank five. Otherwise there is too much incentive to just dump everything into one specific upgrade that ends up skewing the difficulty curve too much.