Blog, Unity, code

Getting started with Unity3d at Freeplay 1014 Aug

So. I gave a talk to day at Freeplay 10 all about Unity3d. I thought it was a bit scattered and I only got through about half of the stuff I wanted to get to (I didnt get to coroutines!! they are very important!) However, the audience was absolutely awesome and they ask really fantastic questions and it was a very interactive and fun session. Also, it was totally packed.

People were sitting on the floor and the room was about 35 degrees (that is 35 degrees C, for those of you in the states, that is approximately a million degrees fahrenheit). But all in all it was pretty awesome.

For anyone just tuning in, the talk started out with a quick tour of the unity interface, then I basically dove right into building a game prototype from scratch, trying to get it done in just over an hour. It was a bit of a frenzy of code and components and general Unity awesomeness. Well, I ended up only getting through the creation of a plane that you could fly around and shoot stuff and crash into things and exploding. That is as far as I got :-) I did not make ti to enemy turrets, or procedural city generation. However, as I mentioned earlier, there were so many good questions that I probably covered more actual material than I had originally planned.


(This is the prototype game using the frogames buildings, roads, textures and the plane)

Anyhow. Since the talk was all about prototyping, I was using the totally fantastic and incredably inexpensive protopack from frogames. These guys have a handful of unity compatible content packs that are absolutely worth every cent in terms of time saved and making it so easy to just grab a few prefabs, throw them into a scene attach a few scripts and you have your game idea outlined and ready to tweak.

However, I want to be able to give away the project, but I cannot give away the protopack... sooo I went in and stripped out the proto pack stuff and replaced it with primitives. It doesnt look as nice, but it still does the job, and you can get to the scripts and have a play with all the stuff I talked about today.


(this is the non-awesome looking primitives-only version of the project, which you can download)

So anyway, here is the Freeplay project sans protopack stuff.

SO: here is my advice: go and buy the protopack, it is only like $15 or something stupidly cheap. Then go and build your prototype game.

Let me know if you have questions or whatever!

Cheers!
-B

Blog, code, iPhone

Compression settings for iPhone video13 Jul

So. If you read this blog at all you may already know that I am the sole developer for the Gamebook Adventure series of iOS apps.

If you havent checked them out and enjoy some choose-your-own-adventure style fantasy games, then definitely do so. However, that is not what this post is about. For the books, we have an intro bumper video that plays the first time you open the app. Our first book: Assassin in Orlandes had a landscape oriented menu screen and so we made the video a normal landscape type video. However, the book reading bit was portrait orientation. In our in-house testing we didnt go back and forth between the two orientations all that often, but (as is often the case) the users used the app differently and were constantly going back and forth and so the orientation switch was a bit annoying.
For the second book: The Siege of the Necromancer, we switched to a fully portrait oriented app, with the exception of the intro video (it was already made when we decided to change the orientation, and being a poor indie studio we didnt have the cash to re-do the animations in a vertical aspect. However, most people watch the bumper once or twice then never see it again, so that is OK. )

Now with book three, Slaves of Rema, we are finally moving to a fully portrait oriented video. This poses some interesting problems.

Since I am the developer and we are indies, I am also the video codec guy, and often the video editor as well. The animations are outsourced and the other GFX are done in house, but it falls to me to put it all together and get it ready for the iPhone.

What is the problem you ask? Well, on the iPhone you can only play video in landscape and you can really only play landscape formatted videos. On the iPad you can play videos in portrait, but they get all scrunched down. If you want full screen vertical oriented videos then you really need to make your videos sideways.

This can be a bit of a pain to do. One way to do it is to take all of you grafics and rotate them before inserting them into final cut or similar. This means that you also need to tell the guy doing the animations that you need them to be done sideways and all of that. This is a fine way to go about it, but it can make working on the video a pain in the ass. Who wants to work on a sideways video?

Instead you can make the video upright and rotate it after you have done all the editing. I find this to be the best for our workflow. That way all the graphics guys and animation guys are all working with the right orientation in mind and everything looks good. The hard bit is editing a video that is 320 x 480. Final cut, which I love, is total shite at doing anything that is not meant for TV or HD resolutions. What I use is a combination of Screenflow and Quicktime pro.

wait what?

Screenflow is a screencasting program, why would you use it for editing? Well, mostly because I already use it for screencasting, so I have it laying around. And it does a fine job of doing basic editing. Most importantly it allows you to export in any crazy-ass aspect ratio you want, and the export options are excellent. This allows me to edit the video in the aspect it will be seen at, ie portrait.

So, what I do is edit my video in Screenflow, (in the case of the new books these videos are at 640 x 960, so I can do high rez versions for the iPhone4 and the iPad, but it all works the same for 320 x 480, just be sure your final export size is the size you are shooting for)

I export the video at full rez and lossless from Screenflow (make sure that your rez is 320 x 480 or 640 x 960).

next thing is to open it in Quicktime Pro. (note, the quicktime that comes with your mac these days is not qt pro, it is just qt player. QT pro is $30 ish and is an indispensable tool to have in your arsenal if you do any amount of video work. (if you have final cut or FCX, you should already have QT pro).

Once in QT Pro, go to window->show movie properties. Select the video track, and look at the Visual Settings tab.

All you need to do here is hit one of the rotate buttons. I generally thing that rotating left (the rightmost button) is the way to go. That way the home button on the phone will be facing downward when the phone is is standard portrait orientation and the video is playing.

At this point your video should look like the one above that is tipped sideways.

Now for the fun part, the compression.

This may take a little while, and if you have a slow machine it may take a long while. The idea here is that you will probably need to try a half dozen different settings before you get one that looks good and is the size you want.

First off, see if the built-in settings work OK for your video:

Choose File->Export. Then select the Movie to iPhone setting and save it off. This will generate an .m4v file.

Once it is done compressing, open it back up and watch it. If your video still looks fine then you are done. This seems to wrok well for about 90% of the videos I run through it.
However I find that the default 'iPhone' settings sometimes produce terrible video artifacting for certain types of video so I have to do it the hard way. (also, if you are trying to really squeeze every last meg out of your app packages, then the you can get similar quality with half (or less) the size by tweaking the settings yourself.

In this case you need to change the export options and select 'Movie to MPEG-4'

Have a look at all the fields on the MPEG-4 options.

Make sure that the video size is set to what you want, make sure the video format is set to H.264. After that the most important thing on this screen is the Data Rate. but before we get to that, hit the 'Video Options' button, and select baseline.

NOTE: if you dont do this, the video will simply not play on your device, not at all.

Ok, back the the main MPEG-4 screen and the data rate. This is where you will want to change the value and make a few different videos until you are happy with the quality and the size. I generally start at 1200 or 1500 kbits/sec (this usually produces a fairly nice quality video, but it is generally pretty beefy in terms of size.) then I go down by 250 until the quality degrades to a point where I would never use it. From there you should have a handful fo videos fo different qualities/sizes to choose from. You can tweak the data rate down as accurate as you want. If the video quality is almost good enough, then just bump up the data rate by 25 or 50 and see what you get.

cheers!
-Ben

multitouch

SDK4, Sound and Video quick tip28 Jun

Hey, so I upgraded to SDK 4 when it came out and everything is groovy, love the new iPhone 4 simulator, even if it makes all my non-doubled images look like ass.

Anyhow one huge frustration I was having was that the sound and video that worked just fine in the older SDKs no longer seemed to work on the simulator. (everything works fine on the device) I had a few bugs with the way the 3.2 and above handle video, but even after sorting that out it refused to work on the simulator.

I have been pulling my hair out about this for a week now. I mean, it is not a huge deal, I can get by without sound in the simulator, but it is really annoying when i KNOW the code is fine.

Just to be clear: I have a hybrid OpenAL/AVAudioPlayer sound management system, and the videos are all played with MPMoviePlayerController (using the old ways on the old systems and the new ways on the new systems) everything works groovy on all of my myriad devices but NOT on the simulator.

The movies wont even kick off, you tell them to play, and you immediately get MPMoviePlayerPlaybackDidFinishNotification. No errors, nothing.

I finally figured it out! It was my iSight camera. I have an old school original firewire iSight attached to my MacPro for the iChatting etc.. I disconnected that from the system and suddenly sound and video are working again! So I guess I would suggest to anyone else having similar issues: disconnect any external devices that deal with sound or video and see if the problem persists.

Anyway, I am glad I figured out the problem, but I am a bit annoyed that I have to unhook my iSight in order to be able to develop with the simulator. Mighty annoying.

Cheers!
-B

Blog, iPhone, meta

DIY iPad stand for developing30 May

The iPad finally arrived in Australia this week. Some of us uber-geeks have had them for awhile now. (i got mine by calling my mom in the states and having her send one out for me, thanks mom!!)

Anyhow, it seems like everyone is showing off their clever and not-so-clever custom stands and cases for the iPad, so to day I figure I would throw mine in the ring :-) (plus it is sunday, and I don't want to work right now)

When I first got the iPad, I had it propped up like how most of the stands work (ie like a picture frame sitting on your desk) However, this put it out past my mouse pad, and was a stretch to reach it. Since I mainly use the iPad to develop games, this solution was not ideal. (After about two hours of going back and forth between Unity, XCode and stretching to tap on the iPad, my shoulders were fooked)

Instead I needed something to get it closer to me. This meant getting it up above my mouse pad. This works well since the mousing area takes up a not insignificant amount of desk space, but not very much height. So I went scrounging in my big piles of junk. looking for a good solution.

Here is what I came up with:

This stand didn't cost me a single cent. However, if you don't have esoteric camera support gear lying about the house, then it might be a wee bit more expensive. (like, prohibitively so :-)

You will need:

1 x Magic arm (Manfrotto makes them)


1 x Super Clamp (also by Manfrotto, altho there are plenty of other similar clamps that work just dandy)

You will also need some way to attach the magic arm to your desk (or in this case the shelf that is just above my desk. )

I have chosen the tried and true method of: find a clamp in the shed, and clamp the bastard to the shelf. However, if you are starting from scratch there are actually many better ways of doing this (for instance, maybe get two super clamps, and just use that. It would definitely look less terrible, but again, this was just what I had around the house)

The last thing you need is some spare bits of wood. I used a bit of 1x2 and some plywood.

The design is very simple, just a single cross piece screwed to the plywood (with a nice groove cut out where the charging cable fits) and a few bits on the back to give me some clamping options.


(note I am lifting the iPad so you can see the groove, it doesnt sit up like that)


(I find the top one give me lots more 'reach' with the arm, but is a bit wobbly. The center clamp point is more stable)

The stand works well in both portrait and landscape mode:

As you can see, it hovers right over the mouseing area. This means I can go from typing/mousing to iPad testing by just lifting my hand. Much more ergonomic! This is a perfect solution to keep the iPad in a useful position for coding and testing. At some point I might go out and spend the extra cash for a better mounting solution (either a mounting plate, or another super clamp)

Cheers!
-Ben

multitouch

iRaspberry in the app store now25 May

Just released a new little app: iRaspberry. It was actually last week, but I am perpetually behind, so there you go. Apparently we got some 12,000 downloads the first weekend, so that is cool :-)

It is free to download, and you get two of the raspberry videos for free, and there is an in app purchase to upgrade to the full app which gives you 16 ways the stick out your toungue at people :-)

anyhow, it is a silly thing, but lots of fun, so check it out!

Cheers!
-B

About

meMy full name is Ben Britten Smith.

I go by Ben Britten because Ben Smith is a bit too common and using my full name is a mouthful.

I live in Melbourne, Australia and service clients all over the globe.

Contact

Have some questions?

Feel free to contact me directly at support@benbritten.com with any questions you might have about any of the applications I support.

Thanks!

PHVsPjxsaT48c3Ryb25nPndvb19hYm91dDwvc3Ryb25nPiAtIGFib3V0LXdpZGdldDwvbGk+PGxpPjxzdHJvbmc+d29vX2FkX2JlbG93X2ltYWdlPC9zdHJvbmc+IC0gaHR0cDovL2JlbmJyaXR0ZW4uY29tL3dwLWNvbnRlbnQvdGhlbWVzL3ZpYnJhbnRjbXMvaW1hZ2VzL2FkNDY4LmpwZzwvbGk+PGxpPjxzdHJvbmc+d29vX2FkX2JlbG93X3VybDwvc3Ryb25nPiAtIGh0dHA6Ly93d3cud29vdGhlbWVzLmNvbTwvbGk+PGxpPjxzdHJvbmc+d29vX2FsdF9zdHlsZXNoZWV0PC9zdHJvbmc+IC0gYmVuYnJpdHRlbi5jc3M8L2xpPj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