Making an Idle Game Pt VI

It has been 3 weeks since I first published my game on Kongregate and the first two weeks were really exciting and crazy.

This post is pretty long so I have divided it into two parts. In the first half of this post I’m going to talk about the technical stuff (things going on behind the scenes) first and the other half will be about the game (the fun stuff!).

After publishing my game, there was an issue I met with immediately. Some people were losing their save files. It’s actually a small percentage of people, but because there are many people playing the game, a small percentage, say even 3% of 10,000 people, is still 300 people. And this was what filled the comments section and was an issue I had to address. I had to find out why this was happening!

For those that aren’t aware, my game is published on WebGL. It turns out that unlike the WebPlayer, which is able to write to a hard file to your computer, WebGL on the other hand is using IndexedDB to save the game’s data on your registry, and some people were losing their savefiles because indexedDB is not compatible with some browsers / computers. It’s a small percentage, but it quickly sent me into a panic mode.

I had to have an alternate way to save the game data.

Cloud Saving

I had previously looked into Playfab, which offers a cloud saving service. Here’s a flow chart I drew to try and understand how it works.

Blog157.png

Despite my valiant efforts, I was not able to understand it completely and therefore unable to implement it. (I try not to mess with things I don’t understand because it usually leads to havoc). So I decided not to do cloud save before releasing the game since I did not anticipate problems with saving. With the game growing though, this was no longer an option, but a mandatory feature.

Working with my friend, he helped me to implement Cloud Saving. Of course, he didn’t want to do everything for me as he wanted me to learn, so he showed me the ropes and it got me started. Eventually Cloud Saving was added to the game.

PlayfabListener.gif

That is my Playfab dashboard. Those animated “rows” going to the left are real-time updates of people who have just logged in and connected to the cloud service. They can upload or download their saves from the cloud.

This also makes it easier for me to restore peoples’ save files. If for some reason somebody is unable to access their save file, I can download their save from the cloud myself by retrieving their ID.

Prior to this, I had implemented KongregateAPI, so as long as you are logged in, the “Save to Playfab” button is enabled!

Then I send your data to the cloud!

Blog109_1.png
Tada!

In the meantime, there were also a small percentage of people who are unable to even play or load the game due to WebGL errors, or were facing out of memory issues. I published the game to WebPlayer eventually, but it was too late. Kongregate replied me with a (very late) email saying that transitioning to the Unity WebGL+WebPlayer option would cause everyone to lose their save files.

So instead, I ended up hosting the WebPlayer version of my game on Dropbox and put the link in the News box.

But now there was another problem – if people wanted to migrate from the WebGL game on Kongregate onto the WebPlayer game on my dropbox, or vice versa, they had no way to do so without restarting from scratch!

This was why there had to be a second way to backup data. And therefore this leads me to the…

Import / Export feature

There are 3 steps to export your save file

  1. Convert your save data to a string
  2. Encrypt it
  3. Send it to the player’s clipboard via Ctrc+C

You might think that the hardest steps are probably steps #1 and #2, right?

So wrong. Step #1 is literally one line of code. The thing is, on WebGL, there is no way to access your system clipboard, so that means Ctrc+C and Ctrc+V does not work in WebGL games. You can see this in games like Perfect Tower, which makes you download a .txt file and Endless Dream which creates a HTML box on top of the game.

Unlike Flash which has access to your system resources, accessing your clipboard (and a lot of other things) is not something WebGL allows, due to security reasons!

Thus, I had to use a HTML overlay to implement the import/export box. If you play the WebGL and WebPlayer versions of the game, you will notice the import/export feature looks different:

My friend taught me a bit of HTML and showed me how to use it. How it works in WebGL is this:

Blog139

When I press the ‘export save’ button in Unity, Unity sends a message to the HTML wrapper. This in turn calls the export box to appear. So basically, Unity is saying “Hey HTML! Open up the export box!”

The code to open the boxes are not in the game, but in a separate file called index.html which I upload along with the game.

And when you want to import a save string, HTML will tell Unity “Hey, I got the player’s save string! Load this now!” and HTML sends Unity the save string to import. The key thing here is that both HTML and Unity needed to communicate with each other on two different “platforms”, which was something I found hard to do by myself.

Another difference between the WebPlayer and WebGL versions of the game is that there is no loading screen in the WebGL game.

Blog66.png
But there’s one in the WebPlayer

This is because WebGL doesn’t support multi-threading.

The above are some of the technical and boring parts of game development – the things that I don’t see myself working on when I’m making a game. You might think making a game is all fun and games (pun intended), but these, along with optimizations are some things you will need to care about when making a game. If you’re a technical person, you’ll find this fun, but I’m not really one so I found this to be the more tedious part of game development.

Anyhow, onto the game itself! Here’s the exciting stuff.

I’ll talk about some of the stuff that I’ve added to the game in recent weeks, then talk about what I am working on and stuff that will be implemented in the future.

Auto Buy Mechanic

Meet Bushie!

Bushie.png

Bushie here, is going to be part of a sub-feature in this game. He is a monster, but I suppose you can tell he may not be hostile. I think at some point I had ideas for having a pet, but I didn’t want to explore it yet.

I was working on a lame and boring auto-buy feature. It’s a panel with some words telling you that every few seconds, the game makes an automatic purchase for you.

Blog156.png

This screen doesn’t look very interesting, does it? It also does not have much link to the game.

But is there a way to make it better? Tie it in with the ascension system and the game itself rather than be just a separate “feature”?

Most games would probably add a button called “Auto-Buy”, and clicking it toggles it on or off. But I wanted to try something more interesting, so I decided to create this character called Bushie. He is someone you can encounter after a mini event so you actually have to earn him rather than it being an automatic unlock from just simply achieving X ascensions. Once acquired, he hangs out in the shop and can offer to purchase things automatically for you.

Blog155.png

Just by introducing a character, the auto buy mechanic becomes more integrated into the game. I was inspired by this and so I added an option to feed Bushie to upgrade him. I also gave him a sleeping state.

BushieSleeping.png
Sleeping Bushie

So rather than calling the feature “Auto Buy”, I later renamed the title of the panel to “Bushie”

I have been reading the feedback for this game and understand that some people are finding it a hassle to upgrade the heroes’ skills and spending the EXP after a few ascensions. In the future, I may extend the auto buy-ops, I mean “Bushie” to do more things. This is one of the things in my priority list for Quality of Life improvements. I have a To-Do list, which has several categories of things I need to do. It’s super long, and sadly even though this is high on the Quality of Life list, there’s even MORE stuff that’s more important than this that I have to work on, so it ended up being pushed down by other things.

Priority: 2/5

Achievements

Blog163.png

Many people have given feedback on the Achievements system, with a top comment having several upvotes even talking about it.

Blog166.png

I plan to give Achievements a miniature overhaul. I disabled several achievements in an update some weeks ago because of absurb requirements and my lack of judgement. (Reach zone 500, anybody?)

Blog162.png
Zone 500? NOPE!

Upon deciding that I had to review my achievements, and that I had not given sufficient thought to it, I created my own excel of the list of achievements in the game. This will help me for when I get to work on revamping the achievements.

Blog115.png

Priority: 4/5

Story

Blog146

When I made this game, I had no intention of adding a story. But as the game progressed, I had lots of inspiration and ideas (I’m a really idealistic person) and I enjoy writing a lot. I love to write and I think adding a story subconsciously ended up being a kind of thing for me to do.

When adding the second guardian, I wrote a storyline script of the events leading up to it and what occurs and how it links to the story already in the game.

Blog148.png
Guardian story script drafts

It has the dialogue planned out, so it kind of becomes like a director’s script, where it states which character says what and what happens in the game when this dialogue is occuring.

I think when making a game like this, you kind of became a miniature movie director / story teller too! Well, this game doesn’t have much special effects. But for my tower defense game, it actually had some effects where I played around with the game’s camera, zooming in and out of certain key elements of the map (like focusing on a boss monster) and some other story elements.

The game’s story script began sometime when I was creating the ascension system. I’m pretty sure you can tell this from the game. You probably noticed this when you first ascend – the feel of the game changes.

Blog151.png
“That colour scheme…,” said my friend when he first visited the Crossworld.

When entering the crossworld for the first time, the entire battle UI is hidden and there are black strips on the top and bottom of the game. Your attention is suddenly focused on the characters in the middle of the screen and you aren’t allowed to interact with anything else except the character “dialogue” screens. Then you look at where the enemy is supposed to spawn but instead, notice someone new. The game makes a very clear distinction when it’s in “story mode” versus “battle mode”, which was very important to achieve the feel that I wanted – immersion into the story.

There is only one scene that was tricky to do – transitioning from story mode to battle mode while in the crossworld.

Blog150.png

When visiting the crossworld and transitioning to story mode, the screen fades white. But a particular scene does not follow this rule – when you are in the crossworld and fighting the guardian. The transition is a bit more abrupt compared to the gradual white fading effect.

Blog149.png

So far, this is the only scene in the game where a monster can spawn in the crossworld. Speaking of the guardians, I have been planning on what to add to the guardians.

Guardian 2

I have a document (GDD) listing of the planned abilities for the guardians, which are heavily subject to change. Warning: This picture below may be a spoiler.

Blog142.png
Planned Guardian Ability List?

Adding new guardians and abilities is a pretty big feature and it will take a huge amount of time. I have begun working on it a bit but it’s not going to be a feature that I can release soon.

Blog147
Guardian of Riches + Guardian of Eternity?

Priority: 4/5

Weather Effects / Special Bar

One of the things I explored out of fun was weather effects.Blog121-Snow.png

Featured above is a basic snow FX. I want to give the snowy area a special bar to charge up and when filled, you can make it snow. Snow will fall from the sky for a short duration. This removes the negative “frosty” debuff which reduces your mana regen and gives you a positive buff which increases your MP Regen while it is snowing. The description for the buff could be something cool like “Your heroes are having fun in the snow! MP Regen increased!

It will only work when in the snowy area and is a bonus to this area, so people don’t find that it is a chore to have to keep running back to the snowy area to get the buff, then run back to the highest zone just to be able to defeat the boss.

This is just an idea and has not been implemented. It’s a very low priority feature since it does not add much to the game.

Priority: 0/5

WebGL Game not running in Background (technical)

Note: This point is a bit technical, so you may want to skip to the next point if you don’t want to read this stuff.

For those that do not know, this game isn’t built on Flash (it isn’t a Flash game), it’s built using Unity and published as a WebGL game. You may have heard of the Unity WebPlayer, which Chrome has already dropped all support for, and so are other browsers. This is why the WebPlayer version of the game may not end up on Kongregate in the end.

Unlike Flash and WebPlayer, WebGL games and applications are stopped by the browser when they are unfocused, for security reasons. When a tab is unfocused, the browser stops it from eating up your computer’s resources, which is a problem with Flash when you run several things at once.

Blog164.png
Something crashed! Nah, it’s just a screenshot.

I don’t know about you, but back in the days where everything used Flash, I used to remember having my shockwave flash crash often when I ran a lot of stuff in the background – and is one of the many reasons why Google and browsers are removing flash and plugins. The web itself is evolving with the removal of “old technology” like flash and WebGL/HTML5 is where the web is heading toward now. Yes, WebGL is actually new technology that isn’t full ready for games yet, which is why there are some memory issues which some people have been encountering. The removal of Flash is a sad thing for me too because I have a flash game that I have not released yet.

Back to the point. Not having my game (and an idle game at that) run in the background means that you’ll have to put my game in a separate tab to keep it running. I can’t prevent the game from running slowly in another tab because it is the browser that restricts it and it’s very difficult to find a workaround. It’s basically impossible to make a WebGL game run in the backround, but there is a tricky way.

Many WebGL idle games I know solve this by putting a time stamp when the browser loses focus, and when it regains focus, secretly give you resources according to your gold per sec multiplied by duration away. This makes it look  like the game is actually running while you are away.

This is a challenge to do here though due to the fact that there are several factors that affect your EXP/Gold per sec. Buffs, active attack skills, passive skills, guardian upgrades, DPS, survivability are all linked and connected to how fast you kill. I would have to basically simulate the combat system and may still not be able to accurately get your gold per sec.

This brings me to my next point.

Time Capsules / Offline Progress

Blog152.png

Time capsules was a mechanic I made in the first week after I realized that my game, being on WebGL, is unable to run at full speed when unfocused.

If you didn’t read the point above on why this happens, I’ll summarise it: Basically, this happens because the browser is restricting the game’s FPS, and there is nothing I can do about it. Flash and WebPlayer do not face this issue because they actually get a lot of control over your computer, and is actually a pretty big security flaw that web browsers want to move away from (thuis the deprecating of NPAPI support and the WebPlayer).

Anyhow, because of this, it has made my life super hard and working around this is pretty challenging.

There are two things I’m working on (albeit this is taking a long time because of how boring it is to actually do it, and how difficult it actually is).

Solution #1:

Improve the current offline progress and try to simulate the actual combat system.

Blog158.png

Real progress is seriously hard to emulate. A lot of things happen when the game is running. Buffs are running, skills are cooling down, your character attacks, the monster attacks, your characters regenerate HP, MP, cast skills, cast buffs, gain and lose boosts. It’s extremely challenging to simulate all of this offline. I can’t tell if your character is going to die against the boss you’re fighting based on your stats alone. I need to know what buffs you have, what level they are, do they have cooldowns, have enough MP to maintain, and also take into account not just HP regen but also the priest’s healing amount and interval to determine whether or not you will survive the current boss fight before simulating it. It’s way too difficult.

I’m not sure if there are any similar games I can look at who have tried this – Tap Titans doesn’t have monsters that can retaliate and yet their offline progress uses a very simple calculation. Something like

Blog159.png

is easy to do when you do not have variables like skills / buffs / MP coming into play. Sadly, I might have made offline progress overly complex because of the way this game was made.

Trying to improve on this will take a seriously long time to get right because of the complexity of the battle system. Which is why… I have Plan B.

Solution #2 (Plan B):

Gain time capsules while offline. You can selectively choose what to spend the capsules on – skip zones, gain huge amounts of gold/EXP, or even “time travel forward”.

Blog160

I think a number of players managed to try this feature when I accidentally made an update which did not reward offline progress. I ended up compensating some people with Time Capsules to help restore around 8 hours+ of lost progress.

Blog161.png

The Time Capsules feature still needs a lot of work though and it might not be better than what the game already has.

Ultimately, trying to accurately recreate your progress offline is not my goal. My goal is to simply make a way for you to progress while the tab is away.

Skipping Early Zones

I’ve been reading a lot of comments from people. There are those who want to see more things to do in the game (active play), and there are those who want to see automation in the game. I feel the game should ideally have both. In this point, I’ll talk about some of my plans for automation.

Idle games get repetitive over time. And having played many idle games myself, I know this to be the top reason why I quitted most of them. As such, I hope to introduce some kind of automation for the things in the game.

I’ve covered auto-buy above above so here, I’m going to cover the monotony of ascensions. The problem with ascension lies in how repetitively boring the early zones are because you grow so strong that early zones are just a time waster.

Actually wait, the root of the problem lies with ascension itself. It causes more problems than it seems – repetition in upgrading skills etc. I’ve realized how easy it became to repeatedly ascend to gain quick rewards, but that is very hard to change now. I should have made ascension something really cool that you don’t do often, but I guess I didn’t think far enough and now everybody is ascending repeatedly because it is the most rewarding way to gain gems.

Rather than trying to solve the problem with ascension itself though, there seem to be a few requests to skip early zones.

Blog165.PNG
This is the most recent comment regarding this matter

I have drafted two ideas. The second one is already a locked feature in-game where only a fraction of players had access to.

Idea 1) A guardian upgrade: After X ascensions, start your character off at a later zone, and maybe have their items leveled up (eg, Lv 100 sword)

An example implementation of #1:
Lv 1 ability: Start at Zone 20, with Lv 100 in Weapon,Chest,Lv50 in Shoe, start with priest acquired
Lv 2 ability: Start at Zone 40, with Lv 200 in Weapon,Chest,Lv100 in Shoe, start with thief acquired
– So on and so forth

Idea 2) The ability to allow skipping of early zones at a heavy price

Implementation of #2: Time Capsules
– Warp forward 10 zones with 5,000 TC. (eg if you use this ability at Zone 11, you will warp to Zone 21, but you do not get any rewards – no gold/XP/gems)

Plans?

I don’t know what works best at the moment because before Implementation #1 can be done, the game needs more guardians. Preferably this is an ability that fits on the Guardian of Time, supposedly the 4th Guardian planned for the game and sadly is still really, really far from complete. I have not even done much for the second guardian yet!

Implementation #2 heavily relies on the offline progression system which I am still trying to resolve as mentioned above. Either way, it will take a long time before this can be done because of how dependent it is on other features that are not ready yet. Rushing this into the game is also something very risky and hasty to do.

I predict a big problem where starting at Zone 40 gives you so much XP from the first boss kill that it makes upgrading skills a chore – something I have to think about and fix before I can even release this.

Priority: 1/5

Since this is a quality of life upgrade and there are other, more critical issues with the game (like job balancing, achievements reward not good enough, etc), I have to focus on other content that will eventually allow this to be implemented – guardians / time capsules / skill upgrade automation, etc. It’s not that I don’t want to allow people to skip zones, but there are other things missing in the game of higher priority that need to be addressed and I only have a few hours each day to work on stuff. Prioritising what I can and cannot do is critical to making the game better for everyone.

Cheat Function

This is not much of a feature, but I thought I should share this. When testing the game, I wanted an easy way to give myself gold and EXP, etc. Sort of like a debug panel, but there wasn’t really an easy way to set values from the game itself, so I made my own in-game debug panel!

Blog144.png

It comes in handy when people lose their progress too. Without this, I have to manually type a lot of code. I have my own codenames for the debug panel, so I can type “2301$” to give myself 2301 gold, “300G” to give myself 300 gems, and typing “70Z” unlocks all zones up to 70, etc. It’s really useful in helping to quickly restore peoples’ gems or lost progress.

Blog145.png

You can see I put a lot of miscellaneous buttons too – get 100 gems, get 50 enchanted gems, visit Starry Dream (crossworld), meet guardians, unlock achievement, etc, to help with game testing.

In addition, I have a cheat function to force a savefile to have ascended stats, so with a click of the button I can set a savefile to have ascended once, unlock the characters, gone through all the tutorials, zones and start out with enough gold and EXP to do a lot of things:

Blog143.png

That’s all for now!

There are a couple of other things I’ve worked on for the past 3 weeks that I wasn’t able to cover in this post.

One of the things I partially addressed was a UI issue in the game. In fact, I will one day overhaul the game’s UI. I had an interesting discussion with one of my friends at work and he has helped me to draw out a new UI layout for the game. I’ll see if I can talk about it in a subsequent post.

So that’s all for now!

 

 

 

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s