Archive for the 'Performance' Category

Much Faster CryptoJS SHA1

May 17th, 2014
Spencer Nielsen Follow snielsen42 on Twitter

400px-SHA-1

SHA1 is a pretty crucial part of my current startup, Ultralink. We need (relatively) decent uniqueness calculation and change detection, and need to be able to do it really, really quickly on a lot of content. We picked SHA1 because it’s widely supported, simple to implement, and fast. For the portions of Ultralink that run in Javascript, we needed to include CryptoJS, a third-party library. CryptoJS appears to be the go-to library for cryptographic functions in Javascript, and seemed to fit our bill perfectly. Development was humming along and everything was fine. When we would occasionally do performance passes and stress tests on desktop web browsers, the SHA1 calculation wasn’t even on the radar for perf offenders. Once we started taking a look on iOS devices though, specifically Mobile Safari, it became a completely different story… (more…)

CloudFlare as a DB Read Cache

September 14th, 2013
Spencer Nielsen Follow snielsen42 on Twitter

cloudflareBadge400

CloudFlare is a popular, DNS-level proxy service that has layered on tons of useful features over the years like asset optimization and denial of service attack mitigation. Probably the most prominent service they provide though is caching. This caching functionality is primarily geared towards webpage content. Out of the box, CloudFlare’s caching settings work great and it intelligently decides what kind of files to cache (images, css, javascript) and what not to cache (html or other files that could contain dynamic content). You can tune CloudFlare’s settings to fit your specific needs and do a lot to lighten the load on your server. I started to think about all the interesting things I could do with a distributed caching layer that sits in front of my servers. I was designing the back end of ultralink.me at the time and thought: “Gee, CloudFlare might actually make a pretty decent read cache!“.

Now I have to start this article with some caveats. Using CloudFlare in this manner will not solve all your problems or even be appropriate in many cases. But if you do have a certain kind of workload and can expose the interface to your database in a specific way, it can really do a lot to absorb your database read traffic. (more…)

iOS Caster Now Has 60beat GamePad Support

January 6th, 2012
Spencer Nielsen Follow snielsen42 on Twitter

Here’s demo of the new 60beat GamePad with my friend Mike‘s game Caster HD. I added support to both Caster/Caster HD and the update has been submitted to the App Store for approval. It shouldn’t be too long before the update actually hits the App Store. (UPDATE: Both updates are now live on the App Store!)

In the video I demo the controls starting with the cursor. The Mac/Win/Linux version of Caster has game pad support for the in-game cursor and so it was easiest to just hook into that. You don’t need to worry about switching between touch and game pad controls. Caster has no on-screen control overlays and both control styles will work concurrently so you just plug in and go! No setting switch required.

After getting into the game I demonstrate the settings for the camera movement which is controlled by the right analog stick. The start button will pause the game and give you access to the options menu. There you can tweak the camera sensitivity and invert the axis if you want.

A lot of the other controls are doubled up so you can use whichever you prefer. The left analog stick or the directional pad control walking movement. Button 3 or R2 will jump. Button 4 or the R1 will fire. Buttons 1, 2 and L2 will rotate through the different weapons. By holding down L1 you initiate a dash when moving.

(While I’ve got you here, be sure to check out my new 3D physics shooter Invader Zurp if you haven’t already. It is a ton of fun and there is nothing else like in on the App Store. 🙂 )

Zurp 1.0 Postmortem

December 15th, 2011
Spencer Nielsen Follow snielsen42 on Twitter

Last September I wrote a blog post introducing Invader Zurp which revealed a little of the back story on how I came upon this new game idea after it’s first 2 months in development. Fast forward to 3 months later and Invader Zurp had just hit the App Store! I thought it would be useful to sit down and review the last 5 months of development, kind of plan out where I want to go from here and go over the events and insights that I thought were most influential during development.

The Story So Far…

So to recap the original blog post a bit, it was the middle of the summer (2011) and I had been working my brains out on Cannonade for the previous 6 months. I was a little discouraged at that point because progress wasn’t coming quite as quickly as I had hoped. Reception from my testers (just friends and family at that point) hadn’t been as positive as I had wanted either. I still had a very clear vision of what I wanted Cannonade to be and still believed that there is a ton of untapped potential for multiplayer-only games on iOS. But there was only so much I that could do as a one-man team and testing a multiplayer game can be quite time consuming. I took the family on vacation in early July and was able to step away from things for a while. It was then that I got an idea for a single player experience that distilled the core gameplay mechanic of Cannonade down to it’s essence. Thus Invader Zurp was born. Within two weeks I had modularized the Cannonade game engine, re-written the graphics sub-system in OpenGL ES 2.0 and had a working prototype. And it was fun! I found myself on very long “testing” sessions playing even after I had verified my fixes. I seeded the first alpha version in early September and wrote the introductory blog post. Then began the journey of finishing the game and kicking the darn thing out the door. (more…)

Application-Specific Bullet Physics Optimization

December 13th, 2011
Spencer Nielsen Follow snielsen42 on Twitter

In developing Cannonade and Invader Zurp I’ve invested a fair amount of time becoming familiar with the Bullet Physics Library and trying to milk every bit of performance I can out of it. Realistic physics simulation plays a crucial part in both games, and is also the performance bottleneck in the majority of gameplay scenarios for both. When trying to optimize for performance, I generally find myself using two kinds of approaches. One is a higher level algorithmic approach that tries to find ways to create less work or avoid work in order to keep things going fast. Once I’ve nailed down the minimum set of work that absolutely must be done, then comes the work of getting down and dirty to speed up the routines that actually do that work. When I first approached the problem of speeding up Bullet, I simply treated it as a black box (work that I wouldn’t be able to avoid) and explored what kinds of compiler configurations I could leverage to create the fastest possible execution of the physics simulation work. Later, after I had nailed down the gameplay mechanic for Invader Zurp, I was able to start specifically attacking the set of physics simulation work needed for the game, and whittled it down to a much smaller amount using some simplifications, accuracy compromises and psychology.

(more…)

Think Tank: Never let a good idea get away again!

November 28th, 2011
Spencer Nielsen Follow snielsen42 on Twitter

So I have these thoughts…a lot. No not that kind! 😉 I get these fun ideas for neat projects or crazy inventions as I am driving in the car, singing in the shower, lying in bed or even in the midst of coding. Really creative ideas that may or may not be realistically viable but worthy of entertaining nonetheless. I get really excited and start working it over in my mind. It feels like inspiration. Then something happens… Life resumes and I need to deal with the actual task at hand. No worry, it was such a compelling idea that I will surely remember it later when I have cycles to devote to it. And then I never think about it again. Or even worse, the next day rolls around and I all of the sudden remember that I did think of a cool idea the day before, but I can’t quite bring the memory into focus. Does any part of this sound familiar to you?

Write It Down

“No more!” I declared. Nothing gets remembered unless it is written down. Hmm, idea notebook? TextEdit file on the computer? I did the text file thing for a while but I kept forgetting that it was there or didn’t have access to it at the time. No worries… Evolution of the computer to the rescue! Transferred things to Notes.app on the iPhone. Not good. Too jumbled, un-organized, too much information presented in-general. I knew of the million and a half “getting things done”, task management, mind-mapping and brain organization apps/ecosystems out there. But I found most were too general for what I wanted and too heavy. Well, if you want something done…

(more…)

Invader Zurp Progress

October 27th, 2011
Spencer Nielsen Follow snielsen42 on Twitter

Above is some footage from the current Invader Zurp alpha (apologies for the bad exposure). As you can see, things have come quite a ways since I released the first video! There are a lot more visual effects, 5 music tracks from Monte ‘Trance’ Emerson, a new gameplay mechanic, an in-game currency system and tons of other little advancements. I must say that I feel like things are progressing quite nicely! I still have a ways to go though and so I am going to continue cranking away with my head down until it is finished.

What are your thoughts on how development is going? Let me know in the comments. Also, a huge thank you to all of my testers who have given me invaluable feedback on all the builds thus far.

Caster for webOS

October 6th, 2011
Spencer Nielsen Follow snielsen42 on Twitter


Want to buy Caster for webOS? Click Here

Caster History

Much like Amit Singh and his Hanoimania, I regularly attempt to port my friend’s game Caster to as many platforms as I can. Because of some good language and API choices upfront (C++, OpenGL 1.X, SDL, etc…) the Caster codebase is very portable. That portability combined with its relatively humble (for these days) performance needs has lent the (currently still unified) codebase to easy porting. This multi-platform journey began many years ago before Caster was even released. Caster was still in early development when Mike approached me with the idea of maintaining a concurrent Mac build. At that time Macs had not yet moved over to x86 processors and so the most difficult part of the process was reverse engineering Valve’s Half-Life model format (which Caster uses for animated character models). The Half-Life model format was a binary, in-memory format utilizing offsets which meant that while loading it was quick and simple (just read it into memory, no processing whatsoever) it was unfortunately dependent on little-endian byte order to work. Other than that and a couple of other issues, the Mac port was really straightforward. So before release, Caster was solidly supported on both the Windows and Mac platforms. After release another guy helped out with the Linux port of Caster and so at that point we now had the major desktop operating systems covered. Over the years we added slightly different versions for the desktop platforms to adapt them to specific distribution avenues like Steam and the Mac App Store. The first port that required major reworking was iOS. That adventure was chronicled in my post Caster for iPhone: A Postmortem. Mike and I had the opportunity to give a presentation about what we learned at GDC Austin ’09. Later on as the Android and webOS mobile platforms took shape, I started to look into porting Caster to those platforms as well.

(more…)

Invader Zurp

September 12th, 2011
Spencer Nielsen Follow snielsen42 on Twitter

So for those of you on my Cannonade TestFlight profile, you might have noticed that I havn’t seeded a build for about two months. I have a good explanation for this.

Lets rewind back to right after my last Cannonade seed build. I was on vacation at the time and had the opportunity to stand back from Cannonade and evaluate things from a different perspective. Sometimes I don’t think I seek out those opportunities to just sit and think as much as I should (just thinking sometimes makes me feel a bit lazy for not doing). At one family gathering I observed my older son playing Fruit Ninja on his aunt’s iPhone. I was aware of Fruit Ninja and knew that it was a definite App Store success. As I watched him play I thought to myself “That just one play mechanic. One. Repeated, millions of times over and over and over.” This is the typical MO of most games that are successful on the App Store. Simple, easy to pick up and well implemented with good production values. With Cannonade I am trying to break new ground on the App Store. I still believe that there could be a place for deep multi-player experiences on the App Store and I think that Cannonade is on the right track. But watching Fruit Ninja got me thinking. Did I have a single, fun gameplay mechanic that I could repeat millions of times? The core fun mechanic of Cannonade is “Knock Your Friend’s Castles Down.” Maybe I could modify that to just “Knock Castles Down.” Even knocking down dumb castles was fun in and of itself. Maybe I could repeat that experience millions of times and put out a more limitedly scoped single player experience? I decided that it would be a really fun exercise and that I would put Cannonade on hold for a few months while I brought this new single player game to market. I call it “Invader Zurp“.

(more…)

iPod Touch Server

June 11th, 2011
Spencer Nielsen Follow snielsen42 on Twitter


Top-down view of the Aoren Software datacenter in the living room corner.

Why, you might ask? In my case the answer is simply because it is my only alternative. In development of my game Cannonade there quickly arose a need to be able to replay my user’s completed games and validate the results with exactness. In order to obtain that level of exactness, my games must execute with complete determinism. Unfortunately the implementation of floating-point match according to IEEE754 can actually vary somewhat between x86 and ARM processors. This means that if I replayed a game that two of my users played using iOS devices on an x86-based server, the results of the replay would very quickly diverge. Thus I am left with no choice but to set up a dedicated iOS device to wait for notifications of the matches that it needs to replay and validate (a process I call judging). An iOS server you might say.

(more…)

Entries (RSS) and Comments (RSS).