What I'm Working On

Like I said in my previous blog post, I get asked this question a lot. So what the heck- I'll show some stuff off, even though it's incomplete!


That's lingo for "too long; didn't read", for the uninformed. This is what I've been working on today and last night. The Star Reaction tutorials are a little wordy, and I had been trying to trim them down. There was just so much critical information that the player actually needs to learn though! I finally reached a point where I couldn't cut anything else out... but it was still too long. Not only was this annoying for people playing the game, but a lot of the points mentioned in the tutorials are things you could probably figure out on your own. After watching my cousin play the game, I had the brilliant idea to add a "skip tutorial" button! Why didn't I think of that before? If you press it, it will bring you to the second half of the tutorial level- the part where it doesn't hold your hand, and you're supposed to use what the tutorial taught you to solve a simple puzzle. The cool thing about it is that if we have an impatient player who skips the tutorial, and then they fail the second half of the level... it'll bring them back to the first half, with the tutorial!

Dual Stick Shooter

If you've been reading my blog throughout the years, you'll probably have seen pictures of a game where there's a little spaceship shooting at enemies. Like the one above! That's a dual stick shooter, named for their use of the two sticks on the controller- the left stick for movement, and the right stick for aiming/shooting. I first got into dual stick shooters with Super Stardust HD, a PS3 game that was as addicting as its name sounds. It would have been right at home in an arcade, sucking up my quarters! The thing about this type of game that attracted me was the fine control it gives the player. Instead of being able to only move in four directions at one speed, now I can move in ANY direction, as fast or slow as I want! Instead of being able to only shoot forward, I can attack in ANY direction! It's completely different from any other type of game- pure, top-down perspective action that relies on the quick reflexes and finesse of the player. Go check out a video and see what I mean.

I made my first dual stick game in college in 2009. The first time I hit compile and held the controller, I was enthralled. I just sat there moving my little spaceship around and aiming its gun. It was awesomely different from anything I had made thus far. I knew that I wanted to make a game out of it. Fast forward to 2011, and I've made a dual stick shooter for my thesis! However, it would never reach the level I wanted it to. I didn't have a game engine, the code was a mess, and using Blender to make the levels was clunky and bad.

Convenient, but clunky and bad. It does some things I need it to do, but not others specific to my game.

Now, I'm back in action. Over the past month, I've been working on a new dual stick shooter in my free time, when I'm not working on Star Reaction. These pictures show the result so far!

I've been working on my pixel art. Right: before. Left: after. (Counterintuitive, I know.)
I'll write a bit more in a future post about how I'm using pixel art in this game. Look forward to it!

This is a complex object being edited in ObjectMaker, my in-house editor. It's a wall turret enemy.
The smaller pink boxes are collision bounding boxes, which are completely editable.

Even though the wall turret's gun is a class unknown to ObjectMaker, its data can still be edited in ObjectMaker thanks to "ClassInfo" files, which I write manually. (Though the potential for auto-generation is there.)

The wall turret can then be placed in the level. You can also see the polygons that define the level's collision.

The wall turret is now functional in the game!

So basically, this is a proof of concept. Bolt (my game engine) and ObjectMaker have matured to the point at which I can actually use them for complex things like making enemies and editing levels.

I whipped up this slightly more complex enemy in just a few hours the other day:

It closes when the player moves towards it. When the player moves away from it, it opens and chases the player while attacking! Its two "wings" are destructible, and overall it was a fun enemy to make. And I made it in just a couple hours! I mean, drawing it took a while. But after I had the graphics, I went from zero to functional in no time flat. In fact, I created the enemy's datafile in ObjectMaker *before* I wrote a single line of code for it in the game! ObjectMaker has really come a long way since I wrote about it last. But that's a tale for the next update...


See the discrepancy in those numbers? It's such a serious issue that I spent the entire last week optimizing Star Reaction. I mean, it still runs at around 60 frames per second, right? So what's the problem? Well... the problem is that it's idling right now. The game is literally doing nothing- there's no input from the player. Guess what's going to happen when the player starts matching stars and creates a lot of particles? Those numbers are going to go up! It's going to take more time to process more logic and draw more things. On desktop, this isn't an issue. The numbers are comfortably small. On Android, it slows down. All those microseconds wasted on every frame add up to real time and real delays!

Optimization has been a long road for Star Reaction. The first time I tried Star Reaction on an Android phone, I used my ancient Samsung Galaxy S from 2011. Yes, that's ancient in phone terms! I remember I got 1 FPS. It was awful! I made a couple changes, but I just couldn't figure out what was so ridiculously slow. In a stroke of genius (so humble) I tried unplugging my phone from the computer after the game was running. Instant improvement! It went from 1 FPS to... 5 FPS. But still, I had identified a major issue- if I wanted to use this phone for testing, I should unplug it after transferring the game! After optimizing all the obvious things, I still only got about 15-20 FPS. I remember thinking "I'll never get this game to run on a phone."

Now that I thought about it, I remembered that I have that phone right here! (I've since gotten a new phone, but I'll get to that in a bit.)
I pulled it out and tested the last version of Star Reaction it had. It was a version from all the way back in April. There have been 12 major updates since then! I ran the version it had, and it averaged around 40 FPS idling in Endless Mode. Not bad, eh? After some major optimizations earlier this year, I got the game from 5 FPS to 40 FPS. Progress! Unfortunately, actually playing the game brings it down to 20 FPS again.

I tried the most recent version of Star Reaction, and the situation is much improved. It idles around 50 FPS, and playing the game brings it down to 30-40 FPS... which is still what I'd call basically unplayable. But that's okay, since I don't plan to support phones that are 3+ years old. On the website, I wrote "Modern phone, Android 4.0 recommended."

Anyway, the numbers you saw above were taken from my new phone- a Nexus 5. It's literally one of the most modern Android phones in existence, and yet it runs the game roughly 10x slower on average than my computer. After running a bunch of different tests, I concluded last week that the reason it's so slow is not necessarily the work I'm doing every frame, but rather the overhead cost of doing that work. Straight from the Android Developer site: "Virtual method calls are expensive." Obviously, I'm not going to change the structure of my game engine to remove all the virtual calls. They're one of the most powerful things about programming languages like Java! I use them all the time. I did cut back on what I could though, and I'm proud to say that I'm done optimizing the game. At this point, it's as good as it's going to get without a total rewrite. It runs well enough on my modern phone, and phones are only going to get better in the future. So I'm not going to worry about it anymore!

Anyway, if you got this far- that's what I'm working on! See you next time.