Game development: reducing scope (traffic simulation)

One of the tricks of game development, especially that done by small teams, is reducing scope of each feature or element to a minimum necessary level. It is critical to make efficient use of developers’ time since there is only so many cycles available, and the longer a project goes on the more likely it is to get cancelled or postponed. The more games you get under your belt the more you start to care more about this kind of stuff.

To give an example of this – one of the core elements of my latest game in development is a series of connected roads with cars running through them, a little like what you would see in a modern version of a SimCity-type game. Starting several weeks ago, I experimented with several different ways to implement this “traffic simulation” element in my game.

Initially, I started with the idea that I would use Unity 3D, since that would allow me to show a very realistic simulation of cars moving through a network of roads. I was inspired by the mobile game Does Not Commute, which uses a 3D engine to good effect.

However, after learning a little more about the Unity 3D workflow, I realized I would be spending a big chunk of my time on the graphics and other 3D elements, which would make the core gameplay elements (behavior, logic, rules) take that much longer to do. Though the end result might look quite attractive, I had doubts that I could finish the game on my own if I took this route.

So for the time being I decided to make the game 2D. My next decision was whether I should use a physics engine or not. I’ve been interested in physics engines myself for some time, having made very simple ones years ago, so I decided to download and experiment with a few different frameworks, including Box 2D. In only a few hours, I was able to get some test programs running and there was a surprisingly rich set of functionality for the free frameworks I tested.

But again, I posed the question to myself – do I really need detailed physics simulation? Is having cars collide, spin out of control, and follow a physically accurate path really critical to my game’s core gameplay? While this would be a cool feature, I eventually decided this was overkill, and again reduced the scope of my traffic simulation efforts.

At this point I entered into prototype development, spending my evening hours making a bear-bones traffic simulation where each car was resented with only a handful of properties such as color, location, and speed. I got this working and am now experimenting with different game objectives, and creating stages to see what is actually fun (and challenging) – the most important aspect of any game.

If things go well and I feel I’ve made an entertaining prototype, I can continue to polish the visuals, or even consider going back to 3D. With a proven game idea, the risk for failure would be greatly reduced.

If I had determined that simulating cars as individual entities was not a critical element of my game, I could reduce scope yet again and simulate at a coarser granularity. For example, in the original SimCity game (which happened to be the first game I purchased with my own money), traffic was handled by road-piece granularity, where a stock animation was selected based on the traffic density of that area at the given time. You couldn’t follow a single car around since they would appear and disappear if you looked closely. While a system of roads was important in building an efficient city, tracking an individual car from point A to B wasn’t necessary, and players had more to concern themselves with. Also, I believe the original SimCity was only made by two or three developers. In more recent versions of that series it seems that cars are modeled as individual entities.

I’ll post some more about this project as things progress.

Programming Trick: Speeding up your recursive loops with a creative technique

Lately, I’ve been working on a new game project which is very different than all the other ones I’ve done so far. I’m planning on waiting until it gets a little further before I write about it in detail on this blog, but I ran into an interesting technical challenge and I’d like to discuss how I solved it.

To implement the game mechanics I need a graph of nodes, with various connections between each node. I have a need to find the shortest path between two nodes, where the path is calculated by the sum of the length of all connections as part of the path.

I started out with a simple recursive algorithm that started from each node and worked backwards to find all possible paths to get to it, and used a map to store the best connection to move, given a certain intermediate node and a certain destination node. This worked really well, although after around 13-14 iterations on a graph with many connections it started taking over a second to compute and them getting exponentially worse.

One option was for me to search for a more proper algorithm to find the shortest path, and I am sure this has been perfected by  programmers over the last few decades. But I had a secondary requirement to also store all non-optional paths as well, so some of those algorithms probably wouldn’t suffice.

Looking at my recursive function, I realized that there really wasn’t much going on in terms of sub-functions it called that do any significant calculation. If there was, I could try to optimize those or cache up some result. But the question remained – what was taking up all the time?

Looking at the function again I saw that I was passing four different arguments into it. If you have ever studied assembly, you probably know that there are several instructions just to push and pull each of these to and from the stack, and since the function is called so frequently I thought that maybe this added up to a big chunk of the total time.

I decided to test my hunch by making all the parameters into global variables. I purposefully didn’t use class variables since I knew there would be extra lookups required, translating to extra work for the CPU.

It was a bit of work to make this transformation, since for non-pointer variables I had to manually save the state before calling the recursive function, and then re-set it. But this was only for two of the variables since the other two were pointers anyway which were supposed to change (one was the map which stored the nodes that had already been traversed so far, and I already had code to adjust that when returning from the recursive function).

The resultant code was a bit harder to follow, but the performance was significantly better. For the test case I was using I was able to get several more iterations before it got significantly slow (>1 second), if I remember correctly to at least 19-20 iterations.

If I keep adding nodes and connections eventually it still gets slow again, but I will probably put limits on these anyway so I may be safe with this solution for the time being.

Although I enjoy designing games from a high level, after many years of coding I still enjoy these types of algorithmic challenges, and the satisfaction of a well-tuned function.

Mobile Game Development: learn your weaknesses and strive for consistent quality in all areas

Having taking a few iOS projects from conception to release on the Apple Apple Store, I’m starting to discover patterns in how I go through the development process. I plan to use this information to tune how I handle future projects, resulting in efficiency improvements as well as a higher quality result, hopefully leading to a larger user count.

I recently became more aware of the stages I go through in a typical project. I start development in what I would call a “creative” stage, where I am thinking of new ideas and enjoying the implementation process, as well as the iterative design that goes along with that. At some point when the project far along enough, I start to feel the need to just release something – what I’ll call the “get it done” stage.  I think this stems from my fear that other things will come up in my life and not have time to finish the project, or that I’ll just get bored of it and quit partway through, similar to why I would be hesitant to start reading a long novel.

The “get it done” stage is dangerous because the remaining tasks are done quickly, with lower quality than things done in the “creative” stage. For example, I usually create my app’s icons near the end of the project, and rush to just get something that looks reasonable enough. This is a bad idea since an icon is an extremely important part of the overall marketing presence of an app, and some people have even claimed changing only a game’s icon resulted in a major change in the download rate. Another example of this is creating a tutorial, as well as general visual polish.

For my next project, I’m going to try to get myself to think more long-term, and not jump into the “get it done” stage until the product is nearly ready to be released with high all-around high quality. It may be appropriate to rush to the finish line if there is a hard release date you are aiming for, for example to coincide with the release with a new OS version. But in cases where no such deadline exists, there isn’t much value in pushing things.

I am not sure if it is an appropriate comparison, but this reminds me of when I used to train in running to shave time off my mile. I measured how long it took for each 1/10th of a mile, and I found I got the best result when I had a good balance between these times. As opposed to having one or two areas where I sprinted and exhausted all my energy, a consistent good speed gave the best result. I feel that app development is similar, in that a consistent push through all areas is the best way to get a well-rounded product.

If I feel like I am too busy to make proper progress on a hobby project, rather than rushing it to release I’m going to try to just take a break. Odds are that I can just continue where I left off, whether it is a week or a month later.

The exception to this discussion is if you are working on your first mobile app or game. In that case I think it’s OK to just get something on the store, since you’ll gain valuable knowledge going through the entire process for the first time. For your second project, you can slow down and properly plan things out using your newfound knowledge. If you are worried about a low-quality app giving you a bad reputation, you can always pull it off the store at any time.

Mobile Game Review: Does Not Commute

Does not commute, by Mediocre AB, is a game for the iPhone/iPad which was originally released on April 15, 2015. It recently won an Apple Design award and was listed in a special category in the app store, which is where I discovered it. I only played the iPhone version so this review is limited to that.

The game has a pretty unique concept: your objective is to drive a series of vehicles through a city, each from a starting point to a destination point. The interesting part is that as you begin controlling the second vehicle, the first vehicle starts taking the path you choose at the same time, and each successive car’s path gets layered onto the map until it becomes difficult to navigate and reach your destination in time.

If you are able to help all vehicles reach their destinations before time runs out, you get to go to a new area of the city which is effectively a new stage. On the way you can grab items to increase your remaining time, and use the rewind mechanic to retry the path of a car, though you loose some time in the process. Each vehicle has a little different steering, and there are upgrades to can get to improve things like traction. Hitting other objects damages your vehicle, which makes it start smoking and slow down.

The strongest point of this game by far is the graphics, which are done with an extremely visually pleasing top-view rendered with 3D and heavy use of lighting effects, such as headlights for each vehicle. The models are pretty simple but generally good enough, except for some of the lakes which look badly designed. The visual effect during the rewind function is pretty cool looking, and the intro pages are also very nicely designed. Above all, the entire game has a very distinctive visual atmosphere.

I enjoyed this game for around an hour but eventually started to get bored with it. One of the reasons is that the control of vehicles is pretty limited, such that you can only turn left or right, with no braking or acceleration. Also, I found the top-view much more disorienting to drive than a typical first-person view, though I understand why they chose the former to fit with the concept of each car commuting simultaneously.

Does not commute tries to give a personality to each character by giving a short textual description of what is going on in their life and why they are in a hurry, but I found that underdone and insufficient to make me care about any of their lives.

Having said that, with stunning visuals and a very creative concept, this is one of the better games I’ve played on mobile in the last few months, especially considering it’s a free game (with some In-App purchases).

Game Review Web Sites: it’s a dog-eat-dog world

For my latest mobile game I’ve been advertising on many different web sites whose primary purpose is to review and showcase games or apps. It has only been a few days since I did this so I don’t have much data yet, but I hope to eventually post about whether it was worth it to spend my time like this on advertising.

While I was searching for sites to post to, I discovered a few interesting things about this area of the net. Among these was the level of competitiveness between the various sites, and how these harsh conditions make for a pretty high closure rate of such websites. I realized this because roughly one-fourth to one-third of the sites I tried on a list from a few years ago (see this post) were completely gone. Others had changed their name, or began charging for even a basic listing.

I find it intriguing how an over-crowded and hyper-competitive mobile app market ends up creating a hyper-competitive market for websites advertising these same apps. Ironically, these sites have to market themselves using many of the same techniques, via things like SEO and using forums to advertise. Ultimately, all of these web sites must earn enough money to support their hosting and development costs via some form of paid advertising, such as charging for reviews or expedited listing.

The smaller a review site is, the easier it will be to get your app on there, but the less useful it will be because of the smaller amount of traffic to that site. Everyone wants to submit their apps to the sites with all the hits, and submitting them to the minor sites is less important. You can see some of this in my brief look at some page view hits when I advertised my previous game, where there was over a 10x difference between the site with most hits and least hits.

The funny thing about all these sites is that I think the average user doesn’t even know about them. I’ve been getting apps for iOS for years now, and until recently I’d say 90% of the apps I got were found directly on the Apple App Store, or because I heard about it from a magazine, news site, or word of mouth. Of these, discovery from the App Store leads to a very biased selection (with many games that make me want to scream “why is this popular?!?!”), but as a user it’s just so easy to do, instead of fishing through hundreds of review sites.

I think the fact that iOS apps can only be sold directly through the App Store is one reason that people are less apt to try out other stores, since you’re not going to find any good deals there. Compare this with how you can find various PC or console games in online retailers at varying prices, including used copies.

I’m starting to get the feeling that these app review sites may not really be worth my time (except possibly the most popular ones), though I don’t have enough data to make that judgement yet. But I’m quite confident that a really great app or game doesn’t need to be advertised on 1,000 different sites to become popular.

Mobile game poll

It’s been about a week since my latest game for the iPhone, Dokusen: The Art of Domination, has been released. I am planning on writing more details about how the game is doing in the App Store, but for now I’ll just say it is doing much better than my previous game based on the data from first few days.

In order to get some feedback on the game to help me improve it and future games I create, I’ve created a simple poll.

If you have a iPhone device, you can check out the iTunes page here and download it if interested. Or if you are not looking at this page on your mobile device, you can just search for “Dokusen” in the app store on your iPhone.

If you can’t or download want to download it that is fine too, but please consider taking the poll to explain why that is so.

You can also check out the game’s app preview video here.

Apple Connect App provides incorrect download statistics

I check my app’s download statistics on Apple’s Connect app pretty frequently, and was surprised when a weekly total for my latest app was significantly less than the daily count from a few days ago. I tried restarting Apple’s app, but got the same figures.

Starting to get concerned that the figure reported a few days ago was mistakenly inflated, I checked the download statistics on the iTunes Connect site (under the Sales and Trends area), and was relieved to find the aggregate numbers there were close to what I had seen in the app for the daily numbers. The numbers in the App Analytics page are all still zero, probably because the app has only been out a week.

I have no way to verify for sure which number is correct, but the odds are that the aggregate numbers being displayed in the Connect app. In my case, the numbers were over 10x smaller than they should be, which is a pretty serious bug.

If this doesn’t correct itself, I may send Apple a note since it’s pretty bad a bug this basic could escape unfound by testing. But maybe it only happens in a rare situation that doesn’t effect most users. Though the numbers are slightly different for my apps that have been out for several months, the difference is no more than 10 downloads.

If a company like Apple can’t provide accurate download statistics, it might be wise to consider using some 3rd-party SDK like Flurry which should give a more accurate count, plus much more information on how your app was used. I haven’t tried this myself, but am considering it eventually.

If anyone has noticed this bug please let me know.

Mobile game development: putting finishing touches on visuals and sound

For my latest mobile game project, I decided to spent more effort on the overall player experience, in particular the visuals and sound. After I worked out the basic gameplay rules and level design, before releasing the game I went back to put some of these finishing touches on.

For the experienced mobile game developer, these types of things are second nature, but for the hobby game developer who is still learning the ropes it can take some time to shift one’s thinking to be player-centric. These refinements also contribute to the game’s overall appearance and can result in more downloads if they are showcased in screenshots and app preview videos. Ultimately, one of the best types of marketing is a game that markets itself with appealing graphics.

In this post I’ll highlight some of the visual improvements I did, followed by some audio and sound ones.

Visual

  1. I used a star field animation rather than a plain background on the screen behind the game board. This took some tweaking to get right, and I ended up using different layers of stars to add depth, with colors and speeds set accordingly. For example, stars that are closer move faster and are brighter looking. The stars also fit well with the ‘meteor’ element which is introduced into the later levels.
  2. I added an animation at the beginning at each level where the tiles fall into place from the left and right sides of the screen.
  3. When a game ends, the tiles fall away off the screen.
  4. Touching and holding the screen causes the tiles in the same column and row to be highlighted up. This has to be done since the actual square being clicked on is usually not visible because the user’s finger covers it. The color of the highlighting is white for valid spaces, and red for invalid ones.
  5. I spent a great deal of time tweaking the animation for when tiles expand or ‘grow’ outwards. I ended up with using a random timing for when tiles appear, and this gives the game a certain chaotic feel I thought was fitting. Also, rather than a tile suddenly appearing, the color grows quickly from the center of the tile.
  6. I added a white square showing the last tile placed by each player, since it’s easy to forget.

Sound/Audio

  1. I added background music which had a retro feel to match with the visuals, and a high-energy feel to make the game more exciting.
  2. I added sounds corresponding to winning or loosing a game.
  3. I added a sound signifying that the user tried to place a tile at an illegal location.
  4. I added a sound for when the tiles fall into place at the beginning of each level.
  5. For each tile appearing as part of the expansion process, I play a chime-like sound that gradually increases pitch.

For the app preview video, I found another high-energy song which I really liked so I used that instead of the game’s actual music. I also shut off the sound effects since I thought they would be distracting. But the visuals are all intact, so if you are interested you can check out the app preview video here.

Hobby Game Developers: to use version control or not?

Version control, sometimes called source control, is the process of using a program to manage multiple versions of a software project, typically saving things in a remote database or similar structure. There are many version control packages available, including CVS, ClearCase, Perforce, and Git, the last of which has risen to great popularity in the last few years.

There are several advantages to using a version control package, with some of the major ones being:

  • All changes are backed up, so if data is lost or accidentally erased on your machine you can recover it.
  • By looking at the various revisions in the system, you can follow the flow of changes. This can really help out in triaging bugs for complex projects.
  • You can work on several different versions in parallel and do an automated merge at some point to join the code from two or more versions. This comes in handy if you have a stable version that you are submitting to the app store, and a an experimental one with unfinished changes. In team projects where a single source file or module can be worked on by several people at once, this is even more important.

For any project that has more than two or three people, I’d say that source control is a necessity that can save hours if not days or work, especially for complex projects. Most of the projects I worked on in my day job used some form of version control.

However, for a hobby developer that is working on a game by him or herself, the advantages are much less. I’ve tried to use Git for one of my hobby projects, but ended up never needing it. This may be because of some habits I have developed over time. For instance, when I am going to make a major change to a function I often will copy that function, and keep the original one. This makes it easy to go back to the original if I end up breaking something, or decide the refactor I was attempting is not worth it after all. Also, I typically make sure my code is buildable every few minutes, as opposed to writing hundreds of lines of code for hours, and then trying to build. If you get a compile-time failure in that scenario, it can take quite a while to figure out where things are broken, and source control can potentially help there.

Instead what I do is simply zip my entire project directory and email myself once a day, so I have both a basic backup and ability to check previous versions. But I’ve almost never needed that, I do it primarily for peace of mind just in case my machine’s HD crashes – something that has happened more than once.

If you are on a Mac, you can use the Time Machine feature which will allow you to look at older versions to see what changed. However, unless you buy something like an AirPort Time Capsule or similar external storage solution, you are not protected against data lost. I just bought one of the capsules the other day, and it was pretty easy to setup.

If you are doing hobby game development by yourself, you’ll have to weight the pros and cons and decide what is best for you. If you don’t have experience with a software version control system, it’s probably a good idea especially if you consider making software development your career. I’d recommend Git since it’s popular, free, and you can set it up initially using just one machine (and expand to a remote machine later if needed).

Even if you are working on a hobby game with a handful of people, depending on how well segmented the work is you may not need a source control. For example, if one person is working on art, one on coding (implementation), and one on testing and story, then you may be able to craft a workflow which doesn’t require source control.

One more advantage of using source control even if you are working alone, you always have the option of easily sharing your code with people around the world, especially if you are using an internet-based system such as GitHub. This makes it easy to grow your team if things go well.

Are you hobby game developers out there using source control?

Mobile gaming and the importance of marketing

If you have spent countless hours trying to market your game and already understand the value of marketing and advertising, then this post isn’t for you.

However, if you tend to focus on content creation, leaving advertising as a mere afterthought, then you might want to keep reading.

I consider myself a fairly logical-minded person and until recently I held the mistaken idea that popularity and sales is primarily based on a product’s content – things like features, materials, quality, etc. If I devote a few years of my life to making the ultimate game, upon release that game should perform wonderful, since after all it’s a great game that deserves to be downloaded, right?

Not quite.

As I think more about products are made, marketed, and sold, I’ve realized that the content itself is only one of the factors that contributes to a product’s success. The more competitors out there, and the bigger the potential audience, the more a product must be advertised to have a chance to make it big.

Part of me screams out “but this just isn’t fair!”, but I have to accept this is reality. It’s been known for some time that human consumers are not robots, they aren’t always “logical” and don’t always but the “right” products. Instead, they are influenced by so many things, including the “image” of the product (hence celebrities are commonly used to buff up a product’s image) and what their friends and family think. Product naming, packaging, positioning – there are so many factors outside “what’s in the box” that influence whether we buy something.

Of course, there is no guarantee that marketing dollars will reflect to sales, which is why all all businesses that create and sell products have a certain degree of risk. You can think of it as an investment: If I invest X dollars on advertising a game that costed Y dollars to develop, what are my chances of making my money back? What are my chances of making significantly more than I invested? Without a doubt, a great game with a large marketing budget (assuming a competent and creative team of marketers) will have the best chances to profit.

Looking at popular products out there, I’m sure you can find cases where the top product isn’t always the best, but it may be a so-so product with a great marketing budget.

If you create an awesome game that is super addictive, there might be some chance it will go “viral” and spread to a global audience without aggressive advertising. But I think everyone agrees that your chances are always better with some type of marketing push, since without that your game will easily get lost in the sea of forgotten games that never got past a few hundred downloads.

If you work for a medium to large sized game company, part of your company is surely dedicated to marketing and advertising, but if you are a small team on a small budget, the importance of marketing makes your odds of success even worse. Apart from trying to find a person to advertise your game for free or cheap, you can try to become a marketing expert yourself, spending half (or more!) time just on this aspect. But this puts those of us who “just like to program” or “just want to make games” in a pretty tough spot.

Personally, I always get sort of a dirty feeling about advertising, because it essentially involves trying to convince or even fool consumers into believing a certain thing or feel a certain way. I’d like to think that straight out lies or deception will come back to haunt a product eventually (a sort of advertising karma), but I’m not sure if the world actually works that way. In any case, all I can do is try to keep my own marketing efforts from annoying people too much.

For example, it’s fairly common to use a blog to help get the word out about a game, app, or website, and this is clearly a form of advertising. I’ll admit that this is one of the purposes of this blog, which was originally created to be a support page for this game. But I don’t randomly spam people, telling them to check out my game. I feel that the practice of spamming – forcing your product down someone’s throat who probably doesn’t care – is one of the lowest forms of marketing on the Internet. Instead, I’ll read blogs about mobile gaming and other topics that interest me, and if I happen to appreciate an article I’ll give it a like, or even a comment. Some of those people happen to read my blog, and may even become interested in a mobile app I’ve written. This a kind, passive way to market a game without pissing people off.

With posting on forums to advertise a game, you can do things politely and only post in the appropriate areas in related forums at a reasonable frequency, or post all over the place any end up pissing off more people than not. The funny thing about spamming is that even with a low rate of acceptance (say 5-10%), the overall effect is still positive, whether it’s more people downloading an app, viewing an add, or purchasing some product.

Advertising a game is not just about where you try to push your message, but what your message is. Is it a single screenshot or a short movie showing off the cool graphics? Is there a list of features to just a short quip talking about the concept of the game? Or do you position it as “similar to so-and-so (popular) game”? You can write about your game on 100 websites, but if nobody finds the posts interesting your time will have been spent in vain.

I’ve used the terms marketing and advertising somewhat interchangeably in this post, but advertising is only one part of marketing. An important step that must be done before advertising is understanding the existing market (rivals, and what sets them apart) and identifying the demographic group(s) you want to advertise to. The better you can zoom in on to your target consumers, the more you can fine tune your advertising campaign. Trying to please everyone is a sure way to fail, since a 13 old girl with expendable income and a 60 year old man living off savings will have completely different buying patterns. When watching or listening to a commercial, it’s a fun exercise to try and guess what the target demographic is for that product.

Watching the initial presentations of Apple’s yearly developer convention (WWDC) yesterday, I was again reminded of the power of marketing and what a massive advertising budget can achieve. Generally there seems to be great polarization between Apple fanboys and haters, but I think it’s hard to disagree about the power of the marketing videos they have been able to consistently produce. Whether it’s about Apple trying to connect their products to the amazing legacy and history of music, or a group’s heartwarming attempt to help deaf children experience music for the first time using an iPad (Project Ludwig), their advertisements give us all something to think about.

[Credit: Featured image from Gratisography]