Javascript – my experience

Recently I’ve been working on a project that is Javascript based. I’ve never done Javascript before, but I know PHP pretty well, so how hard could it be? It’s just another language designed for building web pages, right?

Yeah, my own casual arrogance here just bit me in the ass big time.

Javascript is to PHP what C++ is to Basic. Javascript carries within it several paradigms that you just have to get your head around.

There are some that are relatively easy, and now I know about them, I do actually miss them when I go back to C++ or Objective C – Promises are a case in point.

Promises are where you can ask Javascript to do a bunch of functions, one after the other, and feed the results of one into another. It’s really useful for doing back and forth with a webserver, for example. Normally I have block code indented to do it, and the XCode debugger fails in those situations. With Promises, I don’t have to worry.

I’ve had to get my head around the concept of local Javascript and server side javascript. I had no idea that javascript websites physically download javascript code to the client in the background. That was a stunner.

But all that being said, because of what Javascript is – basically a thin access layer to data structures, with some logic thrown on top – writing JS can be a monumentally frustrating experience.

The fact is, JS is abstract. Very abstract. You can call functions using variable names. All data structures are, effectively JSON objects (which makes sense, since JSON actually stands for Javascript Object Notation). You don’t serialise anything, and being able to see inside data structures can be…problematic, to say the least.

The entire language is something that it’s extremely difficult to work out, just from looking at code; you have to already know the language to understand what is going on, because it’s all so abstract. It’s almost as impenetrable as Perl.

How it integrates into HTML is another of those things that either you know or you don’t – it’s nigh on impossible to work out why anything is done the way it is just from looking at samples.

Javascript strikes me as being an extremely powerful language, but it has a cost of entry that is far far greater than those of traditional languages, even for an experienced programmer. It’s equal “Oh, that’s cool!” with “What the HELL is going on here??” moments.

I suspect more familiarity will help. Either way, it’s been a learning experience…

Posted in Game Development, Web Dev | Leave a comment

Adventure Book

So I promised to talk about Adventure book.

Just over a year ago, I spent a couple of weekends building a do it your self adventure book engine in IOS. All UIKit. It’s very simple – book definition as XML, the usual.

The idea was to get three sample books written and pitch to the BBC for the Doctor Who license, as another arm of the 50th anniversary celebrations.

Suffice to say, whilst the BBC in LA were interested, they basically said “But no chance” – not because they didn’t want to do it, but because it was narrative, it meant that Moffat himself would have to be in on it. And that getting any attention from him would be like “finding rocking horse crap”. So I asked about how the current novels and comic books were being done, and he explained that the pathing for them for approvals within the BBC was different; this was a game and given the lack of success for other games released (The Eternity Clock, for example), extra scrutiny is being given to those kinds of things.

But, the comic people – at this point IDW based in San Deigo -did have a digital license and possibly I could get this through them. So, as luck would have it, I was in town for the Doctor Who convention that weekend, and lo and behold, IDW was there! So I showed them what I had, they liked it, but then they asked if it could be more ‘comic booky’. I completely understood what they wanted, and so I spent the last year adding Motion Comic features to Adventure Book.

It’s now a fully fledge Motion Comic book creator, with all tools built into the app for generating content. To be clear, it’s not any kind of image editor or anything like that. It allows for import of images, then you can associate small scripts to them – rotate this much, wait, fade to 0 alpha, etc. The idea is that you lay out your content in the IOS app – getting totally accurate preview (there’s even a scrubber bar in the tools!), save it out and the app even packages it up, ready for it to be posted as DLC.

You get images / sounds / fonts etc in to the app either by using the built in web server – the app gives you a web url address, and if you go to it, you can see an Upload page, which uploads the content to your device OR you just use dropbox, which is actually easier.

So anyway, this thing is pretty much done. There are a few small bugs I need to fix – particularly in some of the editing tools – but functionally, it’s all there.

And I’ve no idea of what to do with it. IDW has since inked a deal with a competitor, and I just don’t really know what to do with this app…


Posted in Animation, Game Development | Leave a comment


OK, so unsure if I should do this – I could see potential clients being upset by the fact I’m working on something for myself. I’ve already had one get very grumpy about the fact that I asked questions about IOS engines on a forum I am part off, when he felt I should have been exclusive to him. I did point out that what I do on my own time is up to me, and we had words about me not being ‘owned’ by him, but whatever.

Really I just want to share the experience I’m having. I’ve been working on a couple of projects – one for about a year now, and the other I’ve just started.

The other one – Adventure Book – I’ll detail in another post. But the new one, GameBreakers, is fascinating to me.

It’s basically NFL Football with friends. Played asynchronously on mobile devices, using card packs to determine the plays you have available, players you get to use, staff you can use and so on.

Now my initial design for this was (and still is) pretty simple. So here’s what I did. I put together one of those .pdf UI flow things, using Balsamiq (which is seriously awesome. Worth paying for.) and then I built it all in UIKit on IOS devices.

Now I was really surprised at just how fast I am able to build UIKit stuff now. I mean, I’ve done two weekends and some evenings, and pretty much every page is now there, populated and actually drawing data from internal data structures. It’s ugly as sin mind you, but every page has every button, I know what goes from where and why, what info I am trying to present and all the rest of it. Once I know this, the back end DB structures pretty much write themselves. Plus, I get to hand it to an artist who will then know exactly what buttons go where, and they can design me a ‘style’, which I’ll need and god knows I’m not an artist. I’m not a fan of redoing work either, so if I can give them something that already works and just say “Make it pretty, but don’t change anything in layout”, then that’s a plus for all of us.

There’s some worry on my part that I don’t know enough about football to do the stats / play calculation justice – I worked on a Fox Sports app once, and my part was to draw the events of what happened in plays, in real time, with arcs and balls moving around the field – and it’s WAY more complicated than you think it should be. But I also know I have a ton of friends who live and breath football and can advise, so less worried about that.

Tonight I should have the proof of concept done, then I’ll start thinking about back end DB integration. I’m going with PlayFab – the spun off company from Uber, – and so far I have no regrets about that decision.

I am surprised at how fast this has come together though. I suspect that has more to do with the ease of using UIKit than any particular brilliance on my part though.

Tomorrow, I’ll talk about Adventure Book.

Posted in Game Development | Leave a comment

VFX and the Oscars

I was in the movie VFX industry for a few years working for Bob Zemekis on a Christmas Carol and Mars needs Moms – then I worked for OOOii for a year, who are involved in VFX development that is on stage. They generate all the computer graphics you see on screens in movies like Star Trek.

I used to literally work next door to Rhythm and Hues, just off Jefferson in Los Angeles. I know lots of people who have passed through their doors.

So this whole Hoo Haa over VFX has gotten my attention, and I have to say, I have some thoughts I’d like to share over this.

The first is this – to all my game developer friends are saying “Fuck VFX – we already have this problem and we make it work” – I say you are missing the point. We need solidarity here. They are suffering and for pretty much the exact same reasons that we as games industry indies are. That’s a reason to be empathetic, not surly and disapproving because they get attention and we do not.

Yes, VFX is ‘more’ sexy than what we do (unless you are a 12 year old boy and we aren’t going there), but so what? You love what you do anyway. I know I do.

The fact is, VFX crunches even worse than we do, they get no slice of the pie once their work is done, and their people expect to be laid off when a movie is done. They have even less job security than we do.

Sorry – should have posted this a year ago, just found it in my drafts folder.

Posted in Animation, Movies | Leave a comment

Valve Strategy Analysis

So, I’ve been watching with great interest lots of the Valve announcements and maneuvering in the industry and other people commenting on what they are doing and why they think it is. So I wanted to add some of my own thoughts to this.

Valve is probably going to abandon the GreenLight process and go with opening up Steam for submission via API, with little to no curation and then open the Steam Front End up for others to create store fronts.

That’s a mouth full. Lets go over it bit by bit. So Valve has Steam, which is a purely digital distribution method for games. They introduced it years ago and now it’s the defacto independent (ish – we’ll get into that later) PC digital distribution method. EA and others are still playing catch up with Origin and so on.

The thing is, getting a game onto steam is a bitch. Valve has been particularly opaque about the whole process todate. You send them the game, and they either say yes or not. That’s it. No back and forth, no transparency as to why they may reject you or what you can do about it. Either someone at Valve (and you’ve no idea who) likes it, or they don’t. And you can’t pre-do this either – they only operate on a game with considerable content. So you are out the time and effort to make the game before Valve will even tell you if you can be on their platform or not.

Now this, needless to say, sucked. And Valve knew it – they didn’t want to be the bottle neck for getting games onto the platform. They realised that what they were doing sucked, but as it was, they were taking developer time away from making games to approve these games; the reason there was no transparency was purely because they didn’t want to get into a back and forth with developers that would be even more of a time suck than steam approvals already were.

So they created the GreenLight process, which basically moved the process of them approving, by crowd sourcing it. The gamers who would buy the game would basically vote on which games would make it into Steam. Sounds great on paper – the monkey is off Valves back and the gamers only have themselves to blame if shitty games make it into the store.

But, as anyone who’s ever had to deal with crowd sourcing will tell you, this isn’t going to work. Gamers are basically both graphics whores – so pretty pictures will be approved over something like Flow – and they are also dominated by a vocal minority. Greenlight has basically become high school, voting on the prom queen.

Valve is not stupid. They see this, and they recognize the mistake made here. But what can they do about it?

Now, secondary to this, is the concept that Valve is going to go into the hardware business. They are going to produce a Steam Box. Why? Because, well, why not? A SteamBox in terms of physical development is a no brainer. It’s a low spec PC in a nice box. It’s not hard to produce – look at Oyua. But why bother at all?

Well, to a certain degree, because Valve have to. Windows 8 is coming – and Gabe has ranted on about how terrible it is. Well, yeah, it is terrible. For Valve and their Steam ambitions. Microsoft is finally going the closed, walled garden route – mainly because Apple has made so much money doing so and Microsoft need to compete. So Windows 8 is going to be particularly Steam Unfriendly, because Microsoft doesn’t particularly want Steam on there. They want their OWN app store, not Valve’s. They aren’t taking 30% of the Steam revenues – Valve are.

So Steam is likely to find it hard going, going forward. They aren’t particularly welcome on OSX since OSX has it’s own app store, Windows 8 is going to have it’s own – where do they go? Well, they make their own channel, on their own hardware. They use Linux (Remember all those “Linux is the salvation of developers?” statements from Gabe? Well, what those really mean is “Linux is the salvation of Steam”) since a) it’s free and b) it’s not owned by a conglomerate who is all about creating a wall garden and shutting Steam out of it.

So basically, Steam has no choice but to own it’s own hardware, going forward, if it’s going to retain the success it already has. But it does get better. If Valve makes this bet, the hardware costs go down over time, AND it can fairly easily get integrated into other platforms, like TV’s. Look at the Raspberry Pi. That’s a complete computer on a chip, and that costs $35 – and it’s pretty much Steam Capable. Imagine that built into your TV, running Steam. So the long term prospects are pretty good here, and it’s not hard to see why Valve are eyeing the hardware route.

Now the whole issue of curation is a problem – Valve doesn’t want to be in the business of judging your game – they also want as much content on steam as is possible, (and preferably exclusive content). A curation system imposes friction on the process (as anyone who has every submitted anything to Apple will know) and does NOT stop crap from getting onto your system – again, a wander through the appstore and google play indicates that.

So what to do? If you abandon curation, your platform gets flooded by crap, and gamers get pissed off that they can’t find the quality when they want it. Apple and Google are already grappling with this problem (although it’s a nice problem to have).

But is it really the worst thing? Having lots of shovel ware on your system? Well, actually, contrary to popular opinion, no.

One of the lessons I learned on The Sims and working on Quake based products is that Free Sells. What that means is that if there is a lot of Free product, it doesn’t matter what the quality is – the fact that there is a lot of free product is enough to drive people to buy your product. They think they are getting a lot for free, and that is attractive. It doesn’t matter if 99% of that free product is dross. It’s Free, and that’s what counts.

Valve knows this. In order to compete with Apple and Android and, to a certain extent, Oyua, they have to have a LOT of content to choose from in order to persuade people to put that new device under their TV. So, from a certain perspective, abandoning the curation and opening their platform to anyone works. Now a certain contingent are going to be pissed at this, because for them, the value of steam is that it is curated. They know what they are looking at is good. This will not be the case going forward.

But to a certain degree, this is a solvable problem (as we’ll see in a moment), because this is actually a problem of finding the good stuff, not the fact that the crap exists. And also, if Valve is really going to compete with Apple and Goggle and Microsoft, they have no choice. They HAVE to throw those gates open to allow more content and not burden themselves with the problem of judging it all.

So, ok, now we have a store full of large amounts of shovelware and some gems. How do you find the good stuff? Addressing this problem, Valve has had a master stroke of daring and audacity.

They aren’t going to solve it.

You are.

The idea is that Valve is going to open the Store API’s so that anyone can create their own front end for Steam. Oh, all transactions are still done through Valve and Steam – you’ll just be able to request all game information, and then display it, based on any filters you choose to put in place. So if you filter and only display games YOU think are good, eventually you earn the trust of gamers, and they’ll come to you to find out what games they should be looking at. Think of it as the movie critic effect. Those people who consistently filter out the crap and only display the good will get repeat visits, but those games are still actually bought through the Steam APIS (presumably there would be some kick back mechanism from Valve to the forwarding front end, so you get 5% of the sale, Valve gets 25% and the developer gets 70% – this would make sense since it incentivizes the great unwashed to provide Steam Front Ends). This means there are now multiple ways to get Steam games and multiple filters out there in the world for gamers to find what is good and what is not.

Now this is very smart, but also a heavy bet – because if no one does pick up on this, Steam is now no better than the Appstore of Google Play to find stuff relevant to your interests, and at that point, why would anyone bother with a specific SteamBox under their TV?

After all, Google Play wanted to do the same thing with Google TV – they had the devices and persuaded a few TV manufacturers to put their hardware (which again, was peanuts) into the TV’s, and it has NOT taken off. Why? In a word, content.

All of these front end stores require two things. 1) a frictionless, easy method to both find and buy games and 2) the content to actually buy, preferably exclusive content. Valve needs both, and while they have a massively good start with Steam as it is now, they need to evolve it. With 1), they are hoping you, the web savvy gamer, will help and with 2), well, the only solution there is to throw open the doors and cross your fingers.

I think that, from a personal perspective, this is an enormously ballsy bet. I can completely see why they are doing it and frankly, they are turning a potential platform killing event into an opportunity to, if not own the living room, be a large competitor in there.

I gotta say I applaud this. I think there are several things that Valve needs to be doing to make this more of a success – for example, they need a couple of Steam Evangelists, to get out there to websites like Evil Avatar, Kotaku and so on, and persuade them to build some of these front ends – they are the perfect place that already have gamer credence, and they also have the design and web skills to actually pull it off. Valve is notoriously insular, so it’s questionable they’ll actually do it, but if they did, it would help stack the deck on this gamble.

They also need some Linux Evangelists on staff. All of this is precedented on the fact that they can persuade developers to write their games for Linux, since that’s what the SteamBox is going to be running, and that is not going to be easy, as Microsoft has found by trying to push developers into XNA (And giving up) for mobile. The whole point of the success of Steam is that it is windows friendly, and windows has the best developer tools (Sorry Apple and Sony, they do. This is a fact.) and windows has the biggest market penetration. Switching platforms is a massively risky thing to do, and despite assurances that “this will be easy, it’ll be like writing C++ code for IOS”, not a lot of developers are going to go for this without some help and coaxing from Valve. They are going to need a Dev Rel team there, and I’m not sure that a company like Valve is built along those lines.

The only thing I think Valve is doing actively wrong is by not spinning off Steam into it’s own company, or siloing it within Valve itself. Currently all developers at Valve can see all sales figures within Steam, and this is a clear conflict of interest. Activision and other distributors do not do this and Valve shouldn’t either – policy of internal transparency or not.

Still, the next couple of years are going to be majorly exciting to see what happens in this space, and if Valves bet pays off.

Posted in Uncategorized | 2 Comments

Virtual Currencies – a primer

Holding real money value in games is either extremely simple, some what complex, or You Are Asking For Trouble. One of the three.

The extremely simple paradigm is allow people to buy a virtual currency, and that virtual currency does not a) shift in value and b) can ONLY be used to purchase in game items. B) is obvious – you can buy skins in the hunting game and with those skins, you can buy ammo and binocs and better weapons and so on.
In terms of a), that’s slightly more complex, because if you shift the cost of an item for a period of time, you are actually changing the value of the currency they bought. So if on day 1 Binocs cost 10 skins, then you decide to run a discount on day 2 for the Binocs to cost 5 skins, then what you’ve actually done is change the value of what the skins currency will buy you.
Now it doesn’t strictly speaking matter, because the transaction is done, and even tracking this devaluation can get very very complicated if you have 20 things that you can buy with this currency and you run specials on 3 of them – tracking exactly how much you’ve devalued the currency can get tricky. It can get tricky anyway if you have several currency value packs to buy – e.g. $1 gets you 10 skins, $2 gets you 25 and $5 gets you 150. At that point the real money to virtual currency relationship is not constant anyway.

And, like I said, it doesn’t really matter anyway – there’s no use to which you need or can put that information anyway.

Then there’s the slightly more complex version of this – and that’s where you share currency across different games. This kind of currency needs to stored at a server level. The idea being the currency is stored at the account level, and you can use it across different games. Gree has this functionality and DeNA is working towards it.

The problem with this approach is it means your currency value needs to be maintained and balanced in scale across all games. For example, if game A uses 10 skins to buy Binocs but game B uses 7000 to buy ammo, then your scale is completely out of wack.

Then it gets more complicated still if you can earn currency in game or by 3rd party portal. Earning currency in game is pretty obvious – I shoot 5 animals, I get 5 skins. You can also earn currency by 3rd party portals. This works basically by you going into an ad portal like Tapjoy, and assigning value to users clicking on ads in your game – so if they click the ad in game, they are awarded X skins for doing so. Obviously you are just awarding those skins on your end for nothing, but remember the ad portal is paying you real money for the click through. Most ad portals that offer this feature allow you to set the currency value at their end, and they offer an API that communicates with your game to tell you that a user has done something that generates in game currency, and you can add to it.
NOTE – Apple does NOT like this functionality and will ban you if you implement it on a game on Itunes. We have to comment out this ability on our IOS games.

There’s also the relatively complex issue of deferred cost liability that can arrive here. Most of the time video games such as the like we make will never have this problem, but the larger you are, and the larger you fan base, the more this actually becomes something you have to track.
So what is “deferred cost liability”? Well, its like this. If I buy virtual currency, I, the gamer, pay you, the developer $1 for 10 skins. Now that transaction is done. You bank the money and we are done. But, those 10 skins are now out there, and have not been redeemed against anything. What if it costs you, the developer, when I do redeem them? That average cost of that redemption is “deferred cost liability” – the act of me buying those skins created this, whether or not it’s ever incurred.

To put it another way, think or Virtual Currency as Olive Garden Gift cards. When I buy the card, I give Olive Garden $30 for the gift card. They bank the money, thank you very much. But when I _use_ that gift card, it’s going to cost Olive Garden the cost of my meal I use it for. Now, the cost of that meal isn’t costing Olive Garden $30 – more like $15. $30 is what they’d charge me, not what it actually costs to put it on my plate. So the deferred liability for that gift card is $15. When I bought that card from Olive Garden, they made $30, but they also generated a $15 cost that may well happen down the line. But what makes it more complex still is that a percentage of gift cards will NEVER be redeemed. Lets say only 80% of gift cards bought are used. That means the deferred liability cost per gift card is now 80% of $15.
However, you cannot _really_ know either what meal someone is going to buy with the gift card – to know that the deferred cost _is_ actually $15, nor can you know what the percentage of redemption is going to be. Both are estimates and as such, prone to being wrong.

In video game terms, you have to look at what it costs a video game developer if someone uses some of their virtual currency. If they simply buying Binoculars, well, that’s zero cost to you. Indeed, most IAP is going to be that way. But if they are now downloading DLC data from your server, well, now you have the cost of them using your server – downloads are not free. So how do you calculate that? If you have a large enough user base, it starts to get easier (or at least more predictable), but for smaller games, well, it’s harder. Not that most games will even care – you pay for the dlc server in a bulk amount, it comes out of the games profits, you move on. But for larger corporations, deferred costs can be large and scary and you generally want them to be predicted to be as low as possible – there are tax implications from having a large amount of unsecured debt coming down the line that you aren’t aware of.

You can also usually do things like either gift currency or items bought with the currency to other players. This generally doesn’t affect currency value and is just a nice feature – but the next feature you can offer does affect value.

Allowing the user to sell items. The moment you add this feature, you’ve now created an economy that you don’t 100% control. Up till now, you, the developer, have complete control over what currency is actually worth. It costs this amount and buys that item for that amount. Done and dusted.

But the moment you allow users to sell items on their own auction block, the actual value of the item (and hence the value of the currency) is no longer in your control. The Item Costs X equation now goes out the window, because users can set their own prices (Oh, you can force them to use the same prices as your store does, but at that point, unless the item is extremely rare, all you are really doing is shuffling around who gets the money – you aren’t affecting value or giving players a _reason_ to sell anything).

At that point, currency and item speculation can start happening, and the value of your currency changes. And the only way you, as a developer, can affect this is by affecting how much currency goes into the market. But how do you do that, if people can just buy the currency in the first place? You have no bank interest rates to vary, since no one is lending anything in your game. The only way you can really do it is limiting the amount of currency people can buy and changing the ratios of what people can earn in world.

Then you’ve got the cross platform issue that you might or might not want to do – I buy virtual currency on Android, can I use that on IOS? Strictly speaking, there is no one to one correspondence on currency to dollar value, so it’s not like Apple can track exactly what 30% they missed out on by you not using their IAP system. However, while it is technically permissable right now – there are some restrictions on it, but it’s not been very clear policy wise what these restrictions are (I hear different things from different people about what their experiences have been when they ask Apple.), it’s not a wise bet to make. If you make this kind of system and then Apple suddenly decides that no, you shouldn’t be allowed to do that, what do you do? How would you split the currency value that you have as a player across two platforms? The only way to do this is to track what is bought on which platform from the start, so if you need to suddenly split currency availability based on platform – Gree does this.
It’s a very unclear situation and one fraught with Apple suddenly getting The Hump.

So it can get quite messy in terms of managing your Economy. Second Life had two full time guys doing this, with a myriad of tools at their disposal to determine what was going on in world and what they might be able to do about it.

Honestly though, at this point, unless you are farmville, it’s extremely unlikely that anyone is going to get to this point of economy manipulation.

But then we get to the really scary part. When you can take virtual currency out and convert that to real money.

This is where Second Life is above what almost anyone else does in virtual worlds and virtual currencies. At this point, you are actually a complete economy, and you have to start dealing with all the implications that come with that. For example, you have to deal with The Mob, who will use your system as a money laundering operation. This happened to Second Life, and they have a whole suite of tools to track this stuff, as well as ongoing liaisons with the FBI and the treasury. They ended up limiting the amount of money you can take out of Second Life to the same rules as an ATM – $300 a day max, and even then only if you’ve provided proved credentials.

At this point you are basically operating as a bank – carrying a balance that is transmutable into real world funds – (much like paypal does) and strictly speaking you should be under the banking authorities. But, like Paypal, banks aren’t enforcing this and neither are the feds. Another hole in the banking laws.

If you allow multiple currencies to buy into your system, you also have to deal with currency speculators. I buy virtual currency with Canadian dollars, then sell in Francs, because the exchange rate works for me. Remember, your cost to currency value has to be set externally, and you have to decide which is your anchor currency – ie which one you set the absolute Virtual Currency Value to Real Currency (e.g. 10 skins = $1) and then all the rest will fluctuate based on their currency-to-the-dollar ratio, which changes daily (or hourly in some cases).

As if that’s not enough, then you have to deal with taxation. When and where are your users taxed? Are they taxed using Virtual Currency when they buy something? In which case, how do you work out what that virtual currency is actually worth at that precise moment? And worse still, which real currency are they taxed in? If I’m in France, I do business on a server in the US, who’s tax juridstiction am I in? Both countries will argue “theirs” because both wants the revenue. What do you do then?
Do you tax someone purely on when they take money out of the virtual world? Again, am I being taxed in the country who owns the currency I take out in? If I am in Spain, and I work in Pesos, but I take the money out in Euros, who is taxing me, and where? And if the taxing is taking place outside of MY country, how is that other country going to enforce it? Or even have the mechanism to do it?

You can see how messy that gets. I built an international billing system for Second Life and ran into all these issues – the Fed in the US desperately wants to tax virtual worlds, but can’t figure out how to do it, when effectively the Linden $ is a global currency. None of the countries can, so when I left, nothing was being done. Every 2 or 3 months the Feds would come to Linden Lab with a “new Plan” for taxation, and we’d pick holes in it, send it back and they’d go back to the drawing board.

Sorry – big assed post there. For most game developers, 90% of this is not something to worry about, and if it does become important (like deferred cost liability tracking), you’ll be large enough to pay someone to do it.

Posted in Game Development, MicroTransactions | Leave a comment

Micro-transactions, DLC and IAP – a primer.

Recently I saw a facebook post about a friend mentioning that he was seeing people complain about MicroTransactions in Dead Space 3 – people were complaining that this is a full price game, so why should they have to spend more $ on stuff in game?

And it’s a valid point – why should they?

Before we get to that though, I’d like to talk a little about what MicroTransactions, DLC and IAP actually mean from a developer point of view, and how they are used to generate cash for the developer.

So, MicroTransactions is a catchall term for any in game purchase the game offers you – required or not. The idea is that the game offers you a really easy way to spend very little to gain some item or experience, or potentially to just buy a virtual currency (there’s a long post about virtual currencies coming up at another time).

IAP is In App Purchase – generally this is where you buy an item (E.g. Binoculars, a new weapon, extra shields etc) that aids / enhances your game playing experience. The concept here though is that you are buying something that the game already has within it – all you are really doing is just unlocking something that is already there. The game may allow you to earn it through game play, but is offering you a way to purchase it early, so it’s there for your use before you have enough game time to earn it.

DLC is, by definition,extra content. This is content created posted the game shipping – and almost always requires you to actually download something new. New levels, a new skin, new sounds, an new mission etc. Usually games that offer this are designed so that new content can be created later. DLC is purchased in the same way that items are – either by direct money purchase (where you go through the Apple IOS purchasing system / google IAP purchasing system) or by in game currency (e.g. XBox Live Points). If a virtual currency is used, some of that virtual currency may have been earned in game or been awarded – it means that there is a cut out between the item you are getting for the game and the means by which it is paid for.

So the whole concept of MicroTransactions is that the actual cost, to you, the player is minimal and it appeals to the impulse purchase. The idea being “It’s only $.99 and I can build castles almost instantly, instead of waiting an hour. A dollar – my time is worth that”. Now this only works if the purchasing method is what we call frictionless – ie extremely easy and as close to one click as is possible. Both Apple and Google have spent a lot of time getting their purchasing systems down to as little interaction as possible, although to some degree some is necessary just in order to stop people accidentally buying $99.99 worth of items.

Ok, so we’ve defined it. Now we need to talk about how it’s used, because that has practical bearing on the point under contention – ie is Dead Space bad for including this?

Generally, MicroTransactions are used in one of three ways. Friction, blocking and enhancement.

Blocking is the term used when you hit something in the game that requires a purchase in order for you to proceed. The most obvious the case is “You’ve finished levels 1 & 2, now you have to pay to play level 3″ or “You’ve played free for 4 hours, now you have to pay for another 4 hours” or “Now you have to buy a paid account to continue”. Lots of websites take this route – where you get 10 free emails before having to pay for a full account in order to continue. Blocking can be indirect and less obvious though – for example, I am playing a hunting game. I am given 50 bullets up front, but once they are gone, I cannot shoot the gun any more. I may, perhaps, have been awarded another 10 by the game for marksmanship, but effectively it’s cost me 50 free bullets to buy me 10 more. Once those are gone, there is no way to play this game except by buying more bullets. That’s a blocker, because there is simply no way around it. No matter how well you play, you will run into this wall.

Friction is where the game employs either completely artificial or inherent systems that slow down game play and progress. For example, waiting for your crops to grow in Farmville, or putting down Tiny Towers while you wait for the building to earn enough to add another floor. Both of these employ time as a friction – you are barred from progressing until the time goes past. But you can pay to remove that restriction and progress instantly. Time is not the only way that games employ friction – another, more sneaky, way is to limit equipment usage by count – you get to use the scope on the sniper rifle 5 times before it’s useless and you have to buy another one. The whole point here is to impede player progress – while still giving them enough game play that they just pay to continue the experience.

Now I mentioned Artificial or Inherent systems – there is a difference between the two. An inherent system is one that is part of the game world, is understandable and obvious to all. Running out of ammo in a shooting game is an inherent part of game play. Running out of gas in a driving game is another. Its understandable and obvious and a natural part of the game. Even, to a certain extent, some of the time friction is understandable – it does take time to build a building or to grow crops.

Artificial friction is restrictions and restraints that are 100% imposed by the game developer for no other reason that to make people pay. The example of the sniper scope is such – sniper scopes do not only work 5 times then break. You buy one once and it should work forever. But since this is a high value item, the developer chooses to limit usage and effectively put a tax on.

Enhancement is where you offer an item for sale that enhances the experience, but that is strictly speaking not required for game play. It may add purely visual enhancement (“I have gold armor! You do not!) or it may add actual game value (“My gold armor blocks 2x more attacks than yours does”). This is where you are buying a physical usage item that other people do not have. It’s different from friction in that friction is about the act of playing the game; enhancement items are about changing the event of playing. Friction is “I have overcome progress inhibitors” – enhancement is “When I _do_ play, my playing is either more effective than yours, or I am visually more unique than you are.” Friction is “I don’t have to wait for my crops to harvest” – enhancement is “I used a fertilizer that is not generally available, so when my crops harvest, I get 2x the return.”

It’s a definite but subtle difference – it’s possible to play the entire game with purely enhancement but no bypassing friction methods, for example.

So, we’ve defined the terminology. What of it?

Well, this is really where the rubber meets the road. The definition and balancing of MicroTransactions is where most games fail, and why IAP has such a bad rap with so many gamers – and it’s why people are genuinely upset over MicroTransactions in Dead Space 3.

The problem is this – the mobile market has taught many gamers that games should either be free or cost $2.99. The trouble is that this is not economically viable in terms of production costs. Games are not free to make and build. They cost time and effort and skills, and you need to sell a lot of $2.99 games to make up the often tens (if not hundreds) of thousands of dollars sunk into the development (for example, the IOS darling Infinity Blade, from Epic, has over half a million dollars worth of assets in it. Think about that. Half a million dollars. Who has that amount to invest in a game selling for $2.99?).

Plus, this kind of sale is a once in a lifetime sale. You sell that game exactly once – the player gets to give you money once. Even if they think the game should have sold for $10, they can only give you $2.99, and only once. Obviously there needs to be a mechanism whereby the player can continue to contribute.

What makes this even more imperative is the Android Piracy problem. The fact is that, because the platform is so open by design, it’s incredibly easy to pirate apps and games. Unless your game uses an external game server to run the game, chances are you WILL be pirated on Android. The better the game, the more the piracy will occur. It’s just too easy. So again, what is needed here is a way to avoid single point of sale and bring in $ from players over time. Make your game free in the first place and the whole piracy issue suddenly works for you, getting the game into more players hands, instead of against you.

But the problem with all this, as I mentioned, is balance. So many developers are resentful of the fact that they are out on a limb for tens if not hundreds of thousands of dollar, and can’t charge for it. So what they do is make way too many blocking MicroTransaction requirements, or employ too many friction systems, or make those friction systems way too punishing.

Players don’t react well to constantly being asked for money – even if it is in dribs and drabs of $1 and $2 – in order to continue their playing. They also do not appreciate being constantly gouged – as they see it – based on wholly artificial restrictions in the first place.

The best games do it incrementally and have very few, if any blocking systems. Now, friction systems can _become_ blocking systems if the player isn’t skillful enough – the example of ammo replenishment is a case in point. Lets say that the game awards bullets based on marksmanship, and as long as you are over 50% on target, it’s awarding you enough bullets to keep playing. The moment you drop below 50%, it stops awarding you. Too long at a sub 50% level and you’ll run out. Suddenly the friction of being required to be better than 50% has now become a blocking MicroTransactional requirement. This is generally ok, because the player will recognise that it’s is his deficiency as a player that is causing this.However, if it becomes obvious that the game has changed it’s ability for the player to become accurate (suddenly targets are further away, or wind starts moving the bullet trajectory), then all bets are off, since the players ability to make the 50% rate is now affected in ways he cannot compensate for. So while, ostensibly, this is still a friction system, it’s really become a blocking system quietly, behind the scenes.

If this happens too early, players can get disheartened, and they Will Complain. It’s a very tough balancing act.

What’s more, having several friction systems operating at once makes it difficult to ensure that they are balanced. You don’t want 10 of them all hitting at the same time and requiring 10 different IAP buy in’s to continue playing.

Then there’s the aspect of full price games – which is where we get back into the original point under question. Is it ok for a full price game to ask for MicroTransactions? They’ve already taken a full price – $60 – for the game – why am I being asked for more $? Well, in the case of games like SkyRim and the ilk, generally MicroTransactions are for either DLC (in which case this is extra content, so it’s not covered by the original $60) or it’s for enhancements – usually of the purely cosmetic variety. The moment the enhancements make any significant difference to game play – particularly if multiplayer is involved – then it becomes more of a issue to players. I don’t want to buy a game, then get on a Multi-player game and have my ass handed to me by another player with a gun I cannot have in my game because I haven’t spent another $50 buying it.

Personally, as long as the MicroTransactions are for purely cosmetic or DLC, or for small items that aid in single play, I could careless. More power to the developers, frankly.

The moment you introduce something that unbalances the game – particularly in Multi-player modes,- I think someone needs to sit and have a good think.

Destroying an IP’s long term value for a quick buck now is not strategic thinking, but unfortunately, for a lot of hand to mouth developers, this is how they survive. And it sucks.

Anyway, next up is a review of Virtual Currencies – how they work and what the issues with them are, from a developers point of view.

Posted in Game Development, MicroTransactions | Leave a comment

Movie Review – Silver Linings Playbook

I’m a member of Bafta. This means that, around Christmas time, I get movie screeners – for ‘my consideration’.

It’s quite interesting seeing what movies the studios think should be deserving of an award. We get sent things like The Hobbit, but would never see Jack Reacher or This is 40 (which is what I’d actually like to see). Still, we do get quite a lot of great movies to watch, and sometimes stuff I’d never pay to see at a movie theater.

Silver Linings Playbook is one such movie. It stars Bradley Cooper, and I have to admit I’m a bit of a Bradley Cooper fan boi – even as far back as Alias, where he got his start.

And generally, I think he’s chosen projects that are compelling and good vehicles for him – until now at least.

So lets get the review out of the way. Silver Linings Playbook is not a good film. Why anyone would imagine this is deserving of an award is beyond me. Technically, it’s badly made. The editing is terrible – some scenes start literally as someone shouted action, and suddenly every one moves with that terrible artificial purpose. The camera work is beyond understanding – technically it’s ok, but in terms of direction it’s unfocussed and breaks camera positioning rules without understandingwhy those rules exist in the first place. You can only break the rules effectively when you understand under what circumstances you should do so – the director here – David O. Russell – clearly does not. The whole thing looks very like ‘Movie Students First Movie Out of Movie School”. There are elementary mistakes, continuity mistakes, terrible direction, scenes included that do not progress the story, or, indeed, make much sense at all.

And further to this, the combination of writer/director here means that not only we don’t get good camera direction, we get incredibly stilted and unbelievable dialog. The principle characters actually sit down and explain the back ground of the movie to other characters who plainly already know all this stuff, and as a result, it’s a very obvious attempt to give background when there are plainly better ways to do it. I can’t honestly believe that Bradley Cooper wouldn’t have seen that in the script, but that probably gave way to the fact that Robert DeNiro is in this movie. I’ve _got_ to believe that the reason Bradely Cooper attached himself to this was because of Robert DeNiro. Which does beg the question of why Robert DeNiro is in this movie. I can only imagine he owes someone a favor, or they have pictures of him having sex with a horse – one or the other.

DeNiro basically phones in the Angry/Bewildered Dad dialog and has a bunch of fairly normal but relatively pointless exchanges with other characters. It’s a shame because he’s way better than this.

But you know what? I could forgive all of that if the movie were interesting. Unfortunately, it just isn’t that interesting. The characters are definitely ‘real’, but ultimately fairly predictable and just not people that induces emotion on your part, except for repeated glancing at the watch to see how much longer the movie is going to be on for.

The fact is that Bradley Cooper does his best with his mentally-unbalanced-but-holding-on-purely-through-his-own-delusions-about-his-future-with-his-exwife character, but ultimately the character arc just isn’t interesting enough to make you care enough, certainly not to overlook all of the other issues with this movie.

That’s not to say there aren’t some interesting scenes – the whole Hemmingway-book-at-4am thing was quite fun – but it’s just not enough to save what is effectively a pretty tedious and not-well made movie.

Then you put on Lincoln and wow, the flaws in this movie suddenly get magnified 10x. Which isn’t really fair, but as a movie watcher, I judge it my job to watch a movie and get involved. If you haven’t grabbed me 20 mins in, then you may well have made the movie YOU wanted to make, but you certainly haven’t made one _I_ want to see, and I would consider that a failure on your part.

My $0.04.

Posted in Movies | Leave a comment

Video games, Gun control and Mass Murder.

So yeah, this awful awful thing happened. Can’t escape it and nor should you really want to.

It’s an indictment on our civilization in the western hemisphere and it says a lot about us as a culture.

Now it’s happened – Again – there is finger pointing. As there usually is in the media, there is a need to appropriate blame and try and work out some silver bullet fix that will stop something like this ever happening again. We, as a culture, want to blame someone (which is hardly surprising, given the heinousness of the crime, and the natural anger and outrage to which everyone is subject over this).

Now targets like the NRA are easy. They campaign relentlessly for gun ownership and fight ANY legislation aimed at curtailing their ‘hobby’. Assault weapon bans are easy.

There’s also a mental health blog post going round titled “I am Adam Lanza’s Mother” which details the trials or raising a socially maladjusted child, be it from mis matched brain chemistry, social maladjustment or neuroses. There’s a lack of support for mental health that is lamentable in this country, and worse still, a belittlement of that condition.

Then there’s the inevitable Fox News finger pointing at the evils of Video Games, since we are obviously training and desensitizing the psychopaths of the future.

So what’s to blame? Where do we point the finger? What can we change?

Well, unfortunately, it’s not that simple. For each of these issues – and they are all issues – there are problems.

Lets take Mental Health first. The first thing to say is that Mental Health in the US (and in other countries) is shockingly bad. The actual care isn’t so bad, but the events and tracking leading up to being committed are. It wasn’t always this way, so why is it now?

That’s a pretty easy question to answer though. Money. The medical care system in the US is For Profit. Insurance companies are a for profit endeavor. Health care is an on going process an often just as expensive day to day for care as being in regular hospital. And guess what? Lots of mental health issues cannot be ‘cured’ per-se. They can only be managed. That means the costnever goes away. How do imagine the health companies view this? Think that’s something they want to sign up for? Hell no.

During the 1980′s, in his tenure as Californian Governor, Ronald Regan closed lots of the mental healthcare facilities in CA, because they cost so much to run. Think about that the next time you see a homeless person in CA, because most of them used to be housed in these facilities.

Mental Health care isn’t going to get a revamp or look over until we find some other way of paying for it that isn’t For Profit.

Then there’s the fact that the linked article above isn’t as germaine to the actual Connecticut shootings as it might originally seem. Sure, what the lady is complaining about is relevant to our culture, and she does have a point. But most g0-mad-with-an-ak47 shootings are NOT performed by people who are trackable, with warning signs that are easy to see. This blog post details it nicely

The fact is that while there needs to be far greater help for those with mental illness, it wouldn’t stop massacres of this nature – well, it might stop some, but there are those out there who are very good at hiding their own psychoses (like the nutter who shot up the movie theater in Colorado) or whom just suddenly snap. You cannot just lower the filters of what is a warning sign because in that case I guarantee every person who’s reading this blog would be put away at some point or another. We’ve ALL had moments of high stress where we’ve reacted badly and had other people looking sideways at us.

So, while Mental Health needs a good deal of work, it’s only one piece in the jigsaw.

The next is gun control.

Yeah, we need more of this. I don’t think there’s a question about that. There’s NO NEED for ANYONE to need 47 guns at home. There just isn’t. The general public is in no need of semi automatic weapons.

Really, the second amendment needs to be repealed completely – it’s from a bygone era designed to ensure that America could fight back to the UK if they tried to invade. It was designed to create groups that could assume police and army like stances, before there were any. There are both police and armies now. It’s un-necessary and frankly, dangerous. But – there is an entire class of people out there who are both afraid (and we’ll get into that in a bit) and also knowthey don’t matter. And they don’t. 95% of the US population is interchangeable and can be replaced and the world would keep turning and nothing would change. That’s the sad reality (and to be clear, I’m in that 95%). That’s a terrible thing to carry around and the fact is, holding and shooting a weapon is the opposite of that feeling. It makes you feel like the world would pay attention. You have a weapon, and the world would sit up and take notice. And for most people, that feeling is enough – but it’s such a powerful feeling that they will _never_ allow you to remove their guns, because then they trulywould have no self respect.

Now to be clear, that’s not every gun owner – but those who need to own 5 guns at home? I have serious questions about how big they think their penises are, and how afraid they truly are – both of “the gubermint takin’ over”, “The black people down the block coming to rob them” and “I don’t matter and if you take my guns, I really _won’t_ matter”.

And this is why the 2nd amendment isn’t going to go away – because the NRA has their finger very accurately on the pulse of this fear and resentment feeling that quite a lot of western civilization festers.

While we are there, lets also deal with this “I need guns for defence” specious argument. The fact is that no, you don’t need guns for defence. The majority of guns at home will never be shot by those owning it, even if confronted by armed robbers. Most of us do NOT have what it takes to take a life. In fact, stats show that you are 3 times more likely to be shot by your own gun if you have one in your home than not. Here’s a link making that point.

And that’s assuming you can actually get the gun out. Most people will simply not react to a shooting situation the way they imagine, based on all the movies they’ve seen and games they’ve played. So yeah, here – go watch this – it makes my point for me.

And lastly, lets also deal with this “More people get killed by cars – we should ban cars” BS. Yes, that’s true. The trouble is, cars are NOT designed to kill people, and guns are. There’s no apples to apples comparison here at all. If you took all cars away, the US would grind to a halt. If you took all guns away, it would just become safer. So yeah, that argument is a waste of time.

So ok, if we can’t repeal the 2nd amendment, what can we do? Well, we can do several things to help.

  1. Ban automatic weapons. The public doesn’t need them and nothing good can come of them having them, except certain people feel their penis size is OK.
  2. Ban all clips that contain more than 8 bullets. Why would you need more than 8 bullets anyway?
  3. Improve purchasing restrictions on weapons. I have to take a test (both written and practical) and have my eyes tested before I can get a drivers license. Why is that not the same for gun ownership? I can also have my license taken away for bad decision making – why is that not the same for guns? There needs to be a psych eval for a request to own a gun – that would at least highlight some of the nutters who want a gun for nefarious purposes.
  4. Remove the concealed carry right. NOTHING good comes of this. When the congress woman in Arizona was shot, there happened to be a gentleman nearby who WAS carrying. He came upon the scene of the actual shooter being sat on by a member of the public, who was holding his gun to keep it away from the shooter. That individual who was carrying was a split second away from putting a bullet in the member of the publics head, because he mis-read the situation. Concealed carry is a bad thing – of that there is no question.
  5. Remove the right for home stored weapons. You want to own a gun? Fine. It’s locked up in a gun club. As has already been demonstrated, you having one at home is dangerous and you are more likely to be shot by it than use it.
  6. Pull the NRA’s teeth. Lobbyists need to be refused access to senators and congress people – remove the access and the money goes away.

Now that would help a go some way to removing the availability of guns to those who snap. It won’t stop all of them – but short of repealing the second amendment, nothing will. At this point, all we can hope to do is make it more difficult.

Then there’s the media. Movies, video games and the news networks.

I’d like to separate the two – movies / video games and the news networks, because in my mind, they do two separate things.

The news networks push fear. Fear sells. Their stories are ALL about “Are you at risk from the new strain of Nuclear HIV? Story at 10!” – if it bleeds, it leads. That’s Selling By Fear. It’s no wonder that so many people want to own guns – the news is ALL ABOUT the latest shooting and all the drama and blood they can drag up.

Movies / Video games don’t make you afraid. They glorify and desensitize. When you have syndicated Television shows (Syndication means you sell your shows as a large block of 100 episodes or more – and it helps if each episode is individual, because more than likely the shows will be shown out of order) where one week, a character gets a gun shot wound and is close to death, but next week, he’s fine with no ill effects, it’s no surprise than an entire generation grows up thinking that a gun shot wound won’t stop you – you just have to grimace and carry on. None of these tv shows / movies show the reality of being in a fire fight – of shock and pain and on going medical problems due to a gun shot wound.

Video game are the same – there’s a argument that movies / TV and Video game are ‘just holding up a mirror to society’ – that they depict is just whats going on in society anyway. However, there’s a lack of understanding that while that might be true, it also perpetuates those attitudes. That gunning down masses of people is all Just Good Clean Fun.

Now to be sure – I’m part of that industry and I don’t want to believe that we are responsible for training mass murderers – and to be clear, I don’t believe that. The fact is that if you are disturbed enough to go on a shooting spree, then playing a few games won’t significantly make that worse. People were blowing stuff up and on killing rampages way before Call of Duty was on the shelves.

But, having said that, we _do_ owe a duty to be more responsible with what we make and show. We aren’t the problem, but we do contribute. And contrary to what the NRA would like everyone to believe, Gun Control would go a hell of a lot further to stopping nutters going berserk with an M-15 than stopping Medal Of Honor being made.

So there you have it. The three prongs of what needs to change to reduce (and note I said reduce – you will NEVER entirely stop events like this from happening – that genie is not going back in the bottle) massacres of this nature.

Tell Biden I sent you.

Posted in Game Development, Life Musings | 1 Comment

Animation Systems 101

So, here’s a post I made on a forum – this is a basic primer on animation systems for video game development. The idea is that it should explain how they are made, what components are part of it

Animation Systems – a Primer

Bone based animations – at it’s root, an animation is basically just a bunch of hierarchical bone rotations (and possibly positions, if you want the capability to scale bones).

An animation file tends to contain several things -
The skeleton default pose – this is a list of bones, in tree order, with positions, when each bone is considered to have “no rotation” – the angles for each bone are 0,0,0 or the matrix is at identity. Usually this pose looks like the T Pose for humanoid characters, but really it’s whatever your animation guys think it should be. The only caveat is that all animation values you ever get are offsets from this original default position.

Then, for each frame of animation, you have a list of bones (in hirearchial tree order) with rotations (and as said, possibly new positions) of each bone. This can be represented in several ways. Simple Euler angles – although if you do this, you do have to indicate what the order of angle operations is (do you apply Roll first? Or Pitch?) – just like you do when creating a matrix from euler angles (which is the final step of the per-frame skeleton generation). Almost all systems use Quaternions for per-bone rotation because a) they are interpolatable (you can take two rotations, one for frame A and one for frame B and just do a linear interpolation of values between the two) which you cannot do for a pure matrix representation, b) they are smaller in size (3 floats for quat vector and one for rotation as opposed for 9 floats for a pure rotation matrix) and c) you can actually encode scale into the vector (ie it’s not normalized) if you want to lengthen bones.

For each frame you wish to display, it’s a very simple calculation to work out which frame you are inside the animation (well, between – usually you are between two frames – I’ll get to frame frequency in a moment), take the two frames rotation for any given bone and interpolate between it, based on percentage of closeness between Frame A and Frame B (Frame A is on time at 300ms, Frame B is on 400ms, we are at 320ms, so we get 80% of Frame A and 20% of Frame B. Bogus example, but you get the idea).

From this, you now have a quaternion for a specific bone. You just then generate a matrix from this bone, multiply that by the parent bone (remember, you are traversing a tree here, from root to extremity and it’s hierarchical, so you need to multiply by the parent to get an absolute rotation for each bone, rather than a parent relative one), and there’s your skeleton.


To skin, you have a mesh which is mapped to the skeleton default pose (as described above) and for every vertex you have two sets of values (beyond simple XYZ position). A list of bones that affect this vertex and percentages for each bone. Usually there are limits to how many bones can affect a given vertex (4 or 8 because of shader usage, but we’ll get to that later. For now, this is a software skinning system.)

So, for each vertex you need to do a transform. What you need to do is transform each vertex by each bone that it says affects it, and then blend together the resulting position based on percentage of the amount each bone affects it.
So if vertex 38 is affected by bones 3 at 20%, 7 at 15%, 9 at 15% and 10 at 50%, you transform the original vertex position by bones 3, 7, 9 and 10, then blend the result using the percentages given.NOTE – you need to blend the result of each of those transforms, not the actual matrices for each bone. You need to physically transform the vertex for each bone – giving you 4 positions, in this example – and then scale blend between the RESULTS, not the initial matrices.

Also note that if you have a per vertex normal, you need to transform that by each bone and do the same blending you are doing for the vertex position.

There are more elegant ways of doing this and generating one matrix to multiply the vertex by, but in my experience the work required to generate that matrix tends to outweigh just doing it repeatedly (particularly if you are using SLL instructions) and doing it that way. Others may well be cleverer than I am.
And you need to do this for every vertex.

That’ll give you your mesh.

At root, that’s the most basic dynamic meshed animation system.

Now it can start getting very complicated very fast.

Optimizing Animation Storage

Firstly, you can vary your key frame rate inside the animation. A key frame is every frame of animation inside the animation. So if your key frame rate is 30hz, that means that you have an actual frame of animation every other tick. 60hz means a frame per frame.
Most animation systems allow for variable rates – so the animation itself tells you “I’m 30hz” or “I’m 20hz” because some animations need higher frame rates than others – an idle pose can be 15fps no problem, but gun animations in an FPS (because they are up close and always on screen at full size) need to be higher and smoother.
Even though you are interpolating in software, it’s relatively easy to miss an extreme frame if you are at low frame rate (e.g. you miss the frame with the hand outstretched to it’s fullest in a punch because it falls on frame that is missed out because you are at 15hz) so your animation doesn’t look right. It also makes circular motions look wrong because you are interpolating between absolute positions – instead of a nice curve you end up with very angular animations.

So what can you do about this? Well, more advanced animation systems allow you to have variable rate frequency animation within the animation itself. So although the animation is set at 15hz, there are some extra, animator marked, frames within it to ensure that extremes of motion aren’t missed. Each frame has a time stamp on it so you know when the last frame and when the next frame are meant to be individually. This is more work for the animator but ultimately results in smoother and better looking animation.

Then there’s per bone LOD and compression – you might actually want to store the per bone quat as 16bit fixed point instead of 4 floats – halves the size and still gives you pretty good results, although less so for dramatic large motions.

Lots of animation systems also don’t store per bone values for every bone per frame. They may well have systems that, when generating the animation in game ready format, say “Hmm, bone 3 didn’t move more than X degrees between frame 10 and frame 11. I’m just going to ignore that and not write any value out at all”. This approach can dramatically reduce out the per frame data for a given skeleton, depending on what your low threshold is for “Any motion below this value, I don’t care about” (or your Epsilon Delta). However, this also can have the effect of loosing certain very subtle aspects of human motion by effectively smoothing them out. It’s usually what makes mocap look like shit – because someone is smoothing out very subtle motion to make the curves look nicer and make the data smaller.
It also has the effect of making the code for generating skeletons have to look harder to find the last / next Quat per bone for frame to frame interpolation, since you can’t guarantee it actually IS in any given frame – you have to keep looking for it in every frame back from where you are till you actually find one (there are ways around this, with caching of data from frame to frame, but it’s a hack to get around thrashing your CPU cache looking for animation data for a given bone).

Anyway, suffice to say there are lots of ways to be clever about bone storage.


Then there’s blending. This can get really complicated, really fast.
So, you’ve already got per frame interpolation going on, so there’s blending going on already. What about blending two animations together? From a standing idle to walk? Well, it’s not really that hard. You just generate two skeletons (quaternion) for each animation, then blend between those two skeletons (using the exact same code you used for generating the interpolation between frame A to frame B ).

Although that does tend to suppose you are doing two full body blend. What if you want to run two different animations? One upper body, one lower body? Then what?
Well, now your animation system has to cope with the fact that, effectively, you might be running any animation on any bone (this is what Ghoul2 does) at differing frame rates.

You will also, probably, want to allow direct override control at any given bone too – so if you have a camera with a rotation bone for the root of the camera, you can direct it to where YOU want it to look, rather than where the animation does.

Again, not hard, but a fair amount of code to get right, and 85% of the time it will go totally unused.

But all this blending does come at a price, and I don’t mean CPU wise. I mean animation wise. The problem comes that animations are hierarchical, which means if you override one specific bone, it’s still starting it’s animation at whatever point the parent was at. So if you override a wrist animation, it’s occurring on the end of an arm that is controlled by something else. You might want to flip someone off, but the flip animation while running on the hand just fine, is running during an run cycle, so the arm is moving according to the run animation.

It gets worse. That the example of the upper and lower body above is a good case in point. While I want to have someone sitting in a chair, I also want that person to be following someone else around a room, so he’s constantly looking at them. You could override the bone at the bottom of the spine, but that’s not realistic – you just twist people around. What you actually have to do is override several bones in the back and twist them each a bit, so the torso rotates more realistically.

At this point you are now into very primitive IK – which is really outside of the animation system itself. The animation system should provide hooks that an IK system can use (like ragdoll) but shouldn’t be doing that work itself, because that means it has knowledge of the meshes / skeletons it’s rendering, which it shouldn’t.

Anyway, you get the point that it starts getting very blurry.

NOTE – there are some very cool things you can do with blending regardless of knowledge. Imagine having a baseball batter. Imagine you have two swings, one high and one low (at the same frame rate). You can run both animations on the batter with a provided percentage blend and what you get out of it is a swing that is at the exact height you want it, based on your percentage. So if the high swing at at 5 feet and the low swing is at 4 feet, a percentage of 50% will give you a swing at 4.5 feet. That’s actually a really cool thing, if you think about it.

Shader Skinning

So what about hardware skinning? Using a shader to do all that matrix math? That’s what vertex shaders are for, right?
Well, yes. However, there are two downsides to this. The first is that you don’t get to see the resulting mesh inside the CPU. If it’s all occurring inside the vertex shader, you don’t get the resulting mesh, which means you can’t be doing per-triangle collision detection against it (well, you can if you do the work on the CPU as WELL as the GPU and there are some higher performance optimization reasons for doing this too which I won’t go into now) – which mostly doesn’t matter but occasionally does.
The second is that now you have to break up your skin. Usually a mesh tends to be one large mesh, all referencing the same texture page. You might break it into two or three – skin being a different mesh / material grouping from clothing – but unless your game has a large runtime dynamic system which generates NPC’s or player characters from lots of smaller pieces, they tend to be 1-3 meshes.

However because of that, if you have a mesh that has a skeleton of 150 bones in it (which is very possible, particularly with articulated faces) you don’t know per vertex which bones that vertex might need; effectively you have to feed all 150 bones into the vertex shader running on that mesh. Which is too many – vertex shaders can’t take that many (that’s why I said there tended to be practical limits on how many bones a given vertex will reference). If any given vertex can reference any given bone (and all bones WILL get referenced by some part of the mesh vertex array) you MUST feed them all in.

The only way around this is to pre-process the mesh and break it up into smaller groups – where group A is known to reference bones 1-16 and you can feed 16 bones into a vertex shader easily. So for each mesh submission you feed in different groups of bones into the vertex shader (and often you’ll submit the same bone several times for different mesh arrays).

This breaks a render into several render calls, which doesn’t sound like much, but given you’ve effectively got about 2000 render calls per frame at 60fps, can make a difference. If you’ve got 20 people on screen, but now you’ve broken the mesh into 5 pieces you’ve just gone from 20 render calls to 100. That *does* make a difference.

Generally you don’t want more than 10 mesh render calls per mesh – and in my experience, those meshes that are about 2000 – 3000 polys with a skeleton of about 100 odd bones tend to come out around that – 7-10 mesh groups.

Other stuff.

Blending frames – generally, my experience has been to blend from one animation over about 200-250ms.

You can do some clever lod systems for animations based on distance – in Ghoul2, we did a camera to object distance and actually halved the rate at which we animated object based on how far it was. We just kept the skeleton / mesh around from the last frame and just re-used that every other frame. We probably could have gotten away with more if I’d really pushed it.

Other stuff you can do is just not animate all extremities – mark certain bones as “do no animate in low lod situations” – we did experiment with having different skeletons / meshes for low lod situations, and that really does work, however you can get cheap purely skeletal animation returns by simply not animating the fingers of a hand, for example. As long as you keep last frames around (or even just use the default frames bone settings) you are golden. Realistically though, unless you are doing a hell of a lot of blending, this doesn’t buy you that much, because skeleton generation isn’t that expensive – it pales next to vertex transformation for example.

Also, another thing that most animation systems have is a event track. This is a timed set of events that can occur over the length of the animation. So, for example, when a foot fully hits the floor, a “foot fall” event is generated. This could fire off a sound, or make a gun fire, or whatever.

What’s interesting is that the event track is actually processed separately from normal animations, because you may be doing clever shit like LODing the animations so not ever frame gets an update – however your DO need to do the animation track every frame because game events maybe happening off the animation (e.g. a weapon firing, or a punch connecting with an NPC).

Note though, event tracks can get a little tricky to handle. If you end up blending two animations together, but you have an event that’s right at the front of the second animation being blended (like fire weapon), what happens? I mean, you are still blending – you have no idea where the weapon is actually pointed at that point. It can get really tricky to know whether to actually fire an event or not based on blend state.

Similarly, the problem of internal motion within an animation can be handled with a per-frame motion track.

The problem is this. If you have a motion captured walk, the per frame motion in it is variable per frame. So, either you retain the motion in the animation itself (ie each frame moves further and further from the 0,0,0 starting point of the animation), which means you aren’t actively moving the object in the world per frame of animation, just moving them at the end of the animation to the new position in the world because the animation is looping OR you try and massage the animation so the motion forward is constant, so you can be moving your game object forward in the world at a constant and game controlled rate.

This is what most people do and where foot sliding comes from.

There is a better solution. Your pre-processor needs to look at the range of animation motion for the root bone of the object over the life of the animation (e.g. a complete walk cycle. It starts at 0,0,0 and ends at 100,0,0). From that you know the delta of the total animation (in this case, 100 in x).
Divide that by the number of frames (in this case 10), then subtract frame * delta from the position of the root bone on each frame.

This moves the animation roughly over 0,0,0 for every frame, offset by whatever little difference there is frame to frame to keep the ‘real’ motion in it.

Now you know what forward motion the average frame has, which your animation can then inform the game of. The game is moving the object through the world at the speed it was always intended to move at, and there’s no foot sliding. As a side effect, you can now increase or decrease that speed and then simply multiply the animation playback speed by the same value, and viola, you’ve made the animation walk faster but again with no footsliding. It’s really very simple.

It doesn’t work well with jumps, or anything that moves a large amount in the animation, but returns to the starting position at the end of the animation, but the way you sort that out is by breaking the animation in two, at the point of most extreme.

There’s a LOAD more about animation systems you can do, but that’s enough for now I think.

Posted in Animation, Game Development | Leave a comment