BLACKISH DEV BLOG Support
 

 

Unity: Animation-Events

AnimationEvents are a way to make sure that something happens at a specific point during an animation. You boss-character stomping and shaking the ground at frame 65? No problem… Frame 65 / 30 fps = 2.166 sec. Add an AnimationEvent to the AnimationClip and a function will be called every time this AnimationClip is played at the specified time!

var boss : GameObject;

//create and set up the AnimationEvent
var myEvent : AnimationEvent = new AnimationEvent();
myEvent.time = 2.166;
myEvent.functionName = "DoSomething";

//Add the event to an AnimationClip
boss.animation.clip.AddEvent(myEvent);

//Play the animation
boss.animation.Play();

Now simply add all the code you need to the function DoSomething in a script on the gameObject that contains the animation.

From what I can tell the function really has to be on a script on that gameObject and nowhere else. myEvent.functionName = “transform.parent.DoSomething”; didn’t seem to want to work…
The documentation points out that what actually happens is gameObject.SendMessage(animationEvent.functionName, animationEvent); - so I guess that explains why.
Update: Have a look at this new post for how to make it call a function on a different object (spoiler: I relay the message…)
4 Comments

gamegui.net

I started gamegui.net in my sparse spare-time while working on the interface of the MMO Age of Conan. Having a good and easily searchable database full of reference material saved me countless hours of searching the web when trying to find out how other games have approached similar tasks.
I haven’t gotten around to updating it much since I quit Funcom and started doing my own indie games, but it’s still there and maybe the world should finally learn of its existence…
If you find it useful and want to contribute – let me know! (At this point I want to thank my friend Simon at Creative Assembly for being the only other contributor so far :])
PS: And if you can help me with one tricky SQL problem, please let me know as well! :)
4 Comments

Software that’s making my life easier

Backup: Time Machine
File/Folder-Synchronization/Backup: Synk Standard (I hate to admit it, but this is a lot more comfortable than my home-made python-tool)
HD-Cleanup: DaisyDisk
Time-Tracking: Jobs (iPhone)
Finance: iFinance
Screencapturing: Screenium
Webserver: XAMPP (on localhost, for testing stuff…)
Not all of these are free but those that are not are worth the money.
If you’ve got any recommendations – I’m looking for a simple and cheap/free Wave-Editor for Mac to replace Audacity… (I don’t want to have to start up Logic Express for simple wave-editing…)
PS: I like Schwarzkopf hair shampoo
3 Comments

SPEEDLAP RED – Behind the scenes

A screenshot from inside Unity, showing one of the tracks of our upcoming futuristic iPhone racing game “SPEEDLAP RED”

Speedlap RED - Track 125

Leave a comment

Age of Curling: Thoughts about Online Multiplayer

Lots of people have been asking for online multiplayer for our iPhone Curling Game “Age of Curling“.

Here’s why it’s might not happen:
It’s a niche game with a fairly small number of players. Don’t get me wrong, while it made less in half a year than the few top apps make in a single day, it made enough to pay the rent for a few months, which makes it a success to me!
And I’m proud to say that it seems to be doing quite well on replay value – the numbers suggest that each day there are a few hundred people playing the game. But 500 people / 24 hours / 30 mins (let’s pretend each of them would spend 2 minutes in the multiplayer lobby) = 0.69 – So, on average you’d have a little over half a person in the multiplayer-lobby waiting for a game… Not very “multi”…
But here’s why it still might happen eventually:
It’s only the beginning of autumn, the number of regular (and overall) players will most likely rise quite a bit during Curling season.
And anyway, it’s all a matter of doing it right… With a scheduling system, push notifications and a weekly timeslot for tournaments it might well be possible to get together a whole lot of players on a regular basis. And I’m sure it would get some attention for that!
And now here’s why it still probably won’t happen:
It’s a lot of work. – I am very committed to expanding the game (and I’ll continue to do so as long as people are playing it), but I’m not sure if the goal can be to make it the be-all-and-end-all Curling game and if it kills me.
Age of Curling is a mobile curling game that’s fun to play with a friend while on a train. It’s a fun game to play while waiting for the bus. It’s not a 100% accurate curling simulation, it’s not an e-sport-league game.
Each time I sit down to add something to the game I should really ask myself: “What can I do improve the strengths of the game?”. You know… Do one thing and do it well… And there you go… I just told you the secret philosophy behind BLACKISH and how we’re planning to survive as indie game developers.
(this post was somewhat inspired by this talk, mostly from min 46 onwards)
4 Comments

Creating a bootable backup of the entire HD

Spent a bit of time upgrading an Intel MacBook Pro from OS X 10.4 (Tiger) to 10.6 (Snow Leopard).
We wanted to do a clean install and in order to not forget about anything we wanted to create a bootable backup of the entire internal HD onto a 2.5” external HD.
We formated the external HD to HFS+ (Mac OS Extended (Journaled)) (Partitioning Schema set to GUID) and tried 2 free cloning-tools: Carbon Copy Cloner and SuperDuper! – Both produced backups that did not show up in the boot menu (the one you get to when you press ALT while booting). (It did show up as bootable on the iMac with OS X 10.5 (Leopard) though for some reason, but that wasn’t good enough)
So this is what did work in the end:
We connected the MacBook Pro to the iMac with a Firewire cable and booted the MacBook into Firewire Target Mode (press T while booting until the Firewire Logo shows up on the screen), which allowed the iMac to use the MacBook like an external HD. Then we used Carbon Copy Cloner on the iMac to create a full backup from the MacBook HD to the external HD (connected to the iMac of course) – The result was bootable on the MacBook Pro!
The actual upgrade was easy then. Insert DVD, start Installation, right after it reboots open the Disk Utility from the menu on the top, format the internal HD and install…
2 Comments

Unity Web-Player HTML Problem

Just found out that people who didn’t have the unity web-player installed already, saw this on the page of our new futuristic racing game:
Not nice… So I uninstalled the unity web-player plugin by deleting it from /Library/Internet Plug-Ins/ (browser-restart required) and went bug-hunting…
Turns out the default unity html code opens an iFrame and never closes it again. So if you change line 141 (at least that’s the line number for the html that comes out of unity 2.5) and let it just close the iFrame again like this, you should be fine:
document.write('<iframe name="InstallerFrame" height="0" width="0" frameborder="0"></iframe>\n');
et voilá:
3 Comments

Unity WebPlayer Anti-Piracy

If you want to prevent people from downloading your webplayer and putting it up on their own site, you might want to have a look at Application.absoluteURL in the documentation. It will allow you to detect if your webPlayer is still where it’s supposed to be or not…

This still doesn’t stop anyone from linking to your webplayer directly though, which might be even worse since you’re now also paying for the traffic.
If you want to try and stop other people from linking to your webplayer from within their websites, check out the example given on the bottom of this page
Leave a comment

Using PHP to forward/fork to unity webplayers

All in all I think using AWS is a pretty decent solution that should keep me from getting kicked from my normal shared webserver for generating huge amounts of traffic (“unlimited” can be pretty limited if there’s a “fair use” clause attached).

Since I’m already paying for it though, I’d like to use the shared server as much as possible before generating any additional costs through AWS.

So… Instead of linking to the webplayer.unity file directly (on the local server or on AWS), I set the link to webplayer.php (a super-basic PHP page, that does nothing but forward to the real unity-file)


<?php
header("Location: http://d2s94hjscj93hx.cloudfront.net/webplayer.unity3d");
?>

The next step would now be to make the webserver aware of its state and make it switch to AWS automatically as soon as certain criteria are fullfilled… Several ideas are:

  • If you have a traffic-limit it could count the number of downloads this month and switch as soon as it gets close to the limit
  • It could switch to AWS if traffic goes beyond a certain amount of downloads per hour
  • switch to normal service during the lower-traffic times of the day
Leave a comment

Unity WebPlayer Content over Amazon S3 + Cloudfront

In the wake of big plans, I’ve been looking into low-cost ways of digitally distributing large amounts of data to lots of people. Here’s what I’ve set up so far:

Amazon S3 (Simple Storage Service) is a place where you can cheaply put large files for download – You currently pay $0.15/GB for storage and $0.17/GB for outbound transfer.
An example: You have a 20MB game and 1000 people a day play it: 20*1.000*30 = 600.000MB traffic per month = 586 GB * $0.17 per GB transfer + $0.15 for 1 GB of storage = ca. $100 per month

Amazon Cloudfront makes sure the content is delivered to the end-user with low latency. Your data will be delivered form the closest of currently 8 locations in the US, 4 in Europe and 2 in Asia. It’s also supposed to scale really well, so you should be immune to the famous slashdot-effect (the content will be immune, if the website that links to it goes down you’re still f*****)
The cost here will be slightly higher, but not substantially: Running the example given above through Cloudfront should amount to about $110.
Both of these Services are part of the Amazon Web Services (AWS) and if you already have an account at Amazon (and who doesn’t) it’s super-simple to sign up.
  • Once signed up to S3 and Cloudfront, get the S3Fox Firefox plugin and log in with your access key and secret key.
  • Create a new bucket (=directory) and upload your file to it.
  • Change Permissions (Edit ACL) and allow Everyone to Read.
  • At this stage you could already access your file through normal S3, but we want to get it through Cloudfront, so:
  • Manage Distributions on the bucket – Create Distribution. Once it is deployed you’ll see a Resource URL, copy it – this is the link to the directory. (If you go to Manage Distributions on the file it will show you the complete URL to the file.)
  • Put the link up on your webpage, you should be able to get your file on S3 through Cloudfront now.
1 Comment