Tag Archives: iPhone

New author, plus testing WordPress iPhone app

Tonight (in eastern timezone) my sister has asked about setting up a blog and slideshow.  She’s on a working holiday in Australia.  So in an attempt to learn more myself and give her a solution, I’ve created a user for her and category for blog posts, added to the site main menu.

While doing so, she and I discussed posting from the iPhone.  I explained about the last experience I had with the iPhone app, that it was very simplistic, not full-featured like the web site.  And so she got the app, and I updated (first time using the app in over a year).

Continue reading

Posted in Technology | Tagged , , , , | Leave a comment

Development-time app distribution

So you want to know how to distribute your native iPhone test app? It’s much easier than emailing updated versions to testers, if you can simply have the app online all the time. And having newer versions published when they become built is an added convenience.

First, it does not require an enterprise developer account with apple.

Second, it does require having an active web server somewhere, or at minimal a hosting account.

Continue reading

Posted in Technology | Tagged , , , | Leave a comment

Towers of Hanoi puzzle game applied to real-life and work

The Towers of Hanoi game is a very clean, effective puzzle to learn problem solving, and also learn problem analysis. It’s easy to play with 2-3 discs, and becomes more challenging for inexperienced people with more discs.

After learning the method to solving, it becomes easy, where each additional disc simply doubles the time it takes to solve the puzzle. The real challenge then becomes keeping track of which level within which stack you need to move.

I often refer to this puzzle in conversation, when doing things in life that require moving lots of stuff, physically, mentally, emotionally. It’s come up in my facebook status messages.

Continue reading

Posted in Technology, Thoughts | Tagged , , , | Leave a comment

Best Techniques for 360 Panorama on iPhone

360 Panorama is a revolutionary app.  It is made by Occipital (occipital.com) and has been under constant improvement, both the app and the web-site since it was released in late 2010.  Check out the 360Verse web app!

A short history of my use of the app:

I got the app in early December 2010, and captured several Christmas light panoramas.  They were amazing, and the ease at which I could just stand and spin around made me so happy.  Having experience stitching dozens and dozens of photos into 40-80 megapixel panoramas, this made me so happy to save such time. And for better or worse, I am a perfectionist.  Despite how amazing and excited these christmas light panoramas were, I found them flawed. All my attempts were challenged by light intensity, and were full of tilting, so I felt either I needed to figure out some techniques to improve, or the app needed updating or both. And the app has been updated several times with several new features, and greatly improved image blending/stitching! Awesome!

 

Getting a satisfying 360-degree photo is so easy (wahoo!!!), but to add that little extra bit of quality, I’ve come up with a handful of techniques that can be used to improve the finished result.

Quick Bonus Tips! 

  1. Keep the iPhone as close to you as possible, right in front of your face.  Holding it at arms length can confuse it for certain near-by objects.  This tip came directly from Occipital after I finally asked for help in late February 2011.
  2. Also don’t lower it down to your chest or waist when capturing the ground, and don’t stick it way up above your head when capturing the sky.  Only rotate it up and down, right in front of your face, and spin your body to get the side images.

The Best Tips

The following are the most important techniques to solve the most significant problems I found occurring in most panoramas:

  1. Achieving the best camera exposure levels in the first shot
  2. Moving around so the images to blend together properly, primarily to fix broken horizons
  3. Moving so the internal gyroscope does not start to go sideways, resulting in tilted-looking buildings like Leaning Tower of Pisa.. or the horizon on a lake doesn’t tilt.

1. Get Best Exposure for the Environment’s Light

Determining the best exposure is often a bit of a guess, but the best way to get it is aiming the camera toward the brightest point in the 360 environment for light or average environments … obviously the sun, if you’re outside, or some light wall inside, etc.  In a darker environment, aim the camera at the darkest place so it compensates and the rest of the 360 view is easier to see, not all black.  And then, start capturing, and quickly spin around and find any places in the environment that you really like and want to see in the panorama, and if they appear way too dark or too light, then you might want to restart, and aim the camera a bit off from whatever you aimed at initially.  Then you can either assume the camera has a good initial exposure and continue to make the panorama or you can do a quick spot check again.  I usually do one single test and then do the panorama.. Although, I would have done a third on Lake Louise if I had the time (I was annoying family members who were also in the canoe, requesting them to spin the boat around! haha..)

Here are two pairs of panoramas with separate light/dark versions, Lake Louise and Grotto Mountain Pond:

  • Lake Louise light (the water texture is much more detailed than the dark version, but the Fairmont Chateau Lake Louise is farther and harder to see here… the dark one is closer)

 

  • Lake Louise dark (the trees on the mountain are harder to see, and water is darker compared with the light version, but the two landmarks Mount Victoria and Chateau Lake Louise are easy to see)

 

  • Grotto Mountain Pond light (easy-to-see large mountain on left, almost bleached-white mountain on right)

 

  • Grotto Mountain Pond dark (easy-to-see mountain on right, almost total black mountain on left)

I felt rushed for time at Grotto Mountain Pond, so I couldn’t get a well balanced 3rd panorama.  .. Ahem.. Actually, these were the 3rd and 4th. The 1st and 2nd were each destroyed by separate incoming SMS text messages. Bah!! Airplane mode fixed that. hahaha!

This technique was important for the panorama in the field with mountains in Canmore (http://360.io/HkKLEB)  I did 2 or 3 spot checks before I finished the field-with-mountains, because there is a huge amount of dynamic range.

First I aimed at the sun, so the sky was darker and all the clouds were detailed, but the mountains turned totally black.

Then tried lighter a bit, once or twice, until I liked the balance between bright sky clouds and the dark mountains. This was used by Occipital in the 360verse, and a viewer commented on it, inspiring me to write all this information.

 

2. Preventing Broken Horizons

 

Watch the grid when starting, and try to get the horizon in your first image, rather than a total sky image or total ground image.  Then slowly angle the device up and down to get the sky and ground for this initial horizon image, then return to the horizon and start slowly turning around in a circle. The camera decides to take a picture when there is enough new uncaptured environment in the camera view.  When the camera decides to snap a new picture, try to make it so as much of the new image is overlapping the captured images as possible…. so spinning your body slower helps.  Doing this, will greatly reduce the chance of a broken horizon… except in the final stitch-together when you complete the 360 spin.  It’s much more tricky to get the horizon at the end of the 360 spin to be unbroken.  I think it’s a bit of luck, but it’s partly about keeping the iPhone as still as possible, while spinning.  But as I describe in #3 below, the internal gyroscope can get thrown off so sometimes.  Finally, completing the spin around, hopefully there has been very little broken horizons, and there are no trees or buildings or horizon tilted.  Then start spinning slowly again, capturing the sky and ground in the same manner.  I haven’t determined if it makes a difference to capture only the sky in a spin, and only the ground in another spin, or if the second spin can capture both sky and ground perfectly well simply angling up and down as you spin the second time around.

3. Calibrating the Gyroscope Mid-Capture

The fix for the gyroscope, as described above, is important to limit lines both horizontal (like the horizon especially obvious on lakes/oceans) or vertical (like buildings or trees) from tilting left/right.  It’s best, while keeping the iPhone perfectly untilted left or right, to watch the grid on the screen.  If it starts to tilt, then the gyroscope needs calibration.  So, the best way to do that without ruining the panorama is to keeping the iPhone pointed at an image you’ve already captured, and moving the device rapidly back and forth.  I have found various motions work at different times, either outward and inward around 12-24 inches out from your face, or moving the phone in a circle about 12 inches in diameter, or a figure-8 shape, in front of your face.  Alternatively, quickly spin a bit back over the panorama you’ve captured already about 90 degrees, then return and repeat as needed until the grid is straight again.  That is the best technique for calibrating, and at the same time preventing the camera from snapping a new picture for the panorama that you don’t intend.

Now I’ve created almost 30 panoramas, some uploaded and public, and feeling great confidence in the app, and my own improved use of it.  Hope this info can help you get even more enjoyment from the app.

If you want to see some more of mine, click to view my public panoramas occipital account page.

Follow @360panorama on Twitter to hear about the latest news and additions in the 360verse web app.

Posted in Activities & Adventures, Technology, Thoughts | Tagged , , , , , , , , | 4 Comments

Make your iOS apps support public types (like .zip)

It will happen once in a while, when using an iPhone or iPad, a person may get an email with an attachment to be opened, but can’t because there is no app on the device to open it. Or similarly, surfing the web using the Safari mobile browser, and suddenly there is a file to be accessed/downloaded but it isn’t supported in Safari on iOS.

And for app creators/developers, we solve this issue by allowing our apps to open those types of files, to make up for the lack of Apple having an app that does so.

There is much info around the internet about this, but mostly the info is about supporting custom file types (for random example: .my3dimage) it all comes up short for supporting public file types. I mean, types of files that are out there in the world, but the iPhone doesn’t have an app that supports them. A really obvious case is PDF files.  They used to be not supported, but now they can be viewed in Mail or Safari.  One popular type that is not supported in mail or is the zip file type.

An app developer simply adds the CFBundleDocumentTypes key to the app’s Info.plist file, and fills it in with info, and then builds the app to handle the file when another app tries and fails to open a file.

CFBundleDocumentTypes is an Array of Dictionary objects. Each dictionary has a set of keys (and values) and following is a list of recommended keys from Registering the File Types Your App Supports in Document Interaction Programming Topics in the iOS developer library:

CFBundleTypeName specifies the name of the document type. (ie. Zip archive)
CFBundleTypeIconFiles is an array of filenames for the image resources to use as the document’s icon. (could be a picture of a folder with a zipper, like Windows Explorer uses, or anything else)
LSItemContentTypes contains an array of strings with the UTI types that represent the supported file types in this group. (an array of the UTI types.. this is the confusing part for quickly supporting public types that I deal with in a moment).
LSHandlerRank describes whether this application owns the document type or is merely able to open it. (This is another interesting part that I talk about)

More can be added (and SHOULD be added), and they’re found in Table 2 Keys for type-definition dictionaries, of the CFBundleDocumentTypes section, in the Core Foundation Keys page of iOS Information Property Key Reference.  But BEWARE!  Several of these keys are not for iOS, but Mac OSX, and some are deprecated, while still remaining in the list.

There is more information on the meaning of each specific value that can be assigned to each key. Check out below Table 2, in CFBundleDocumentTypes section, for Document Roles and Document Icons.

After Document Roles and Document Icons sub-sections, is a relatively section of some importance, Recommended Keys.  I say “some” importance because it’s a very important section naturally, but contains out-of-date recommendations.  This list contains 1 valid key for iOS and 3 that are Mac OSX only, plus those 3 are deprecated:

LSItemContentTypes
CFBundleTypeExtensions (not in iOS)
CFBundleTypeMIMETypes (not in iOS)
CFBundleTypeOSTypes (not in iOS)

The following are strongly recommended, but optional:

CFBundleTypeIconFile
CFBundleTypeName
CFBundleTypeRole

These 7 recommended keys, partly overlap with the 4 I listed above from the Registering the File Types Your App Supports section. The overlapping items are:

LSItemContentTypes
CFBundleTypeName

It can be confusing then, which to use… I think this is just a case of some instructions not being updated with the latest best-practices. So try support as many non-deprecated keys as possible!

Now for a list of the strings that can go into the all-important LSItemContentTypes section:

System-declared Uniform Type Identifiers (UTIs)

 

The table on this page lists a whole bunch of system and public file types that aren’t necessarily supported in the iPhone or iPad.  Zip is in the list, and happens to have the com.pkware.zip-archive valiue.

I won’t discuss the icon, but please see Document Icons  within Custom Icon and Image Creation Guidelines for info about them.

Info about the Role is in iOS library.

There is a possible issue with the Rank, if two apps declare themselves as the Owner of a type, then one of them is given precidence for the button that appears on the right-side in Mobile Safari, as seen in this picture:

 

 

 

 

 

 

 

 

 

I don’t know much about dealing with this yet, but it should not be a huge problem because a user can click on the “Open In..” button and see other apps that open it, like in the following picture:

Hope that helps someone.

Posted in Technology | Tagged , , , , , , , , , | 2 Comments

Google’s Android OS and Apple’s iOS – Introduction

Other blog sites probably have content about this subject, but I felt a desire to share my two-cents-worth.

Now I’ve begun to learn Google’s Android OS and it’s helping me appreciate Apple’s iOS more.  Another reason, I found a blog with some good info on it yesterday and had an article something like “10 great things for ____”, and the author created a list of 5 things, and finished the list saying “I’ll get more written soon.”  That was 2 years ago.  Nothing was posted on the blog afterward.  Seems like one of those late-1990’s websites that were PERMANENTLY “under construction”.

So, this is the beginning of a number of writings about the two mobile smartphone operating systems, and I’m writing a bunch of this now, but posting it separately.

Topics:

  • Introduction
  • Hardware
  • OS & Software
  • User Interface
  • Apps
  • … more later, possibly!!

 

Introduction

Recently, I chose to put effort, serious and dedicated effort, into learning the Android OS for smart phones.  When doing development, it helps very much to have one of the real physical devices to test and give a sense of “yes it works!” excitement, and the money expense also helps force the progress, since a financial commitment has been made.

So I now own an iPod Touch 2nd generation, iPhone 4, and Acer Liquid E running Android.  These are my mobile development devices, and I am really getting to understand them both more than I could with only the simulators.  Having the iPod touch for two years before the iPhone 4, and having that 2 months before the Android phone, I would think I understand most everything in terms of how it works on iOS, and be irritated when the Android environment is different.  Well, it’s true in most cases, there are a lot of things I prefer about iOS than the Android OS, but the interesting thing is: I realize that I don’t appreciate Apple’s operating system as much without having something different to compare it to.  Thus I am now beginning to understand some philosophy behind the design in iOS, and how it is different to the Android philosophy.

The main difference is the open-versus-closed models; Android being open-source and you can mess around with the OS and recompile it, and install it on the phone, making it do what you want. That’s for the way-out-there developers, but people can install apps anyway in their own home, downloaded from the internet and installed using the Eclipse IDE, if a person is ambitious enough, and patient enough to go through the necessary steps.   The iPhones and iPod Touches can’t have any app downloaded from the internet and installed… they must be downloaded through the device’s App Store app, or through iTunes on the desktop/laptops and synced onto the phone.  Apps are developed in Xcode on  Mac computers, and can only be installed on the device if a person has paid $100 for a yearly subscription to the “iOS Developer Program”.  Then you can download sample apps from the internet, and install them on your device.

Most the other differences are under the hood, which only developers will see or understand.  For example:  Apple expects apps to be singular, and it’s the normal way of apps on a desktop like Microsoft Word or Firefox/Safari/Google Chrome.  You double click an icon for the program,  or a file that is viewed by the program, and the program opens.

With Android, an app can have different bits that are each disconnected from each-other, but are loosely joined together… for example an app that is designed for note taking, allows you to write notes.  But it can also convert notes to PDF files, and you can email those PDF files with the app.  The PDF part is secondary to the note-creation, and yet the app can be made so that any other app can “create a PDF” and this app will be run, but instead of showing the standard note-taking component, ONLY the PDF converter component will be activated.  I haven’t seen this in practical action yet, because I’m only just learning, but this is the way it is according to the introduction on http://developer.android.com.

So those are two examples of philosophy differences, each with a description for Android and iOS.

 

Next, the more useful information begins.

 

Posted in Activities & Adventures, Technology, Thoughts | Tagged , , , , , , , , , , | Leave a comment

The organization of a game app

The central-most Objective-C class in this game I’m developing is called “HBDGame”. The main source file has gone beyond the previously-mentioned 6000 lines and is now over 7200 lines. It seems a lot (for my own records).

Now I want to make a quick post because I will forget if I don’t… and because I do not want to write about this in detail right now.

There is a difficulty in maintaining strong organization when I have over 40 classes and dozens or hundreds of images, giant world map files (around 10/25 made so far) with dozens of configured elements within each, and a handful of soundeffects.

So I have probably 100+ pages of hand-written notes and diagrams and pencil illustrations, plus all the source mockup files for the computer graphics, and e-documents typed to keep myself organized.

And it’s becoming very challenging. I make constant use of text-based two-way references. That’s one of the best helps for me to keep track of execution paths in the program. blah. Now this is really starting to sound technical.. hah.

The major point of this post is simply this: the source-code and information hierarchy model I’ve found myself using (and pretty comfortable with) is something like this:

  1. Main game class is HBDGame, and it is the ultimate boss, next to the app delegate itself.
  2. There is a layer of persistent data (game settings that are important to keep the same for every game-session, like music volume and choice of accelerometer control versus touch-screen control). This persistent data is saved and loaded by 3 different simple functions.  The HBDGame controls these, and every class that wants stuff saved goes through the boss class.
  3. Significant game components, including the GamePlayer, menu systems (main menu, pause menu, quick popup menus) and other significant game objects.
  4. Interaction layer which handles the inputs to affect the game.  Some of this goes through the boss, and the boss passes off the inputs to the proper recipient.  Other times it goes directly to the recipient (specifically in the case of menus).
  5. Finally, the graphics themselves.  The graphics are controlled almost all completely through the main game components.

Probably doesn’t qualify as a model-view-controller layout.  More like a Global support-storage-model-controller-view.  I think the model-view-controller is a great model for software, but it seems complex projects have blurry lines of communication between the three concepts.

Perhaps there is a better way to organize what I’m doing, but right now I’m still finishing up the core of the game.

I’ll try to write more about this, with concise details, later on.

Posted in Activities & Adventures, Technology, Thoughts | Tagged , , , , | Leave a comment

Custom rotation/orientation, and almost too much code

I have my major iPhone project game-app organized in this manner:

Custom class for appplication delegate class (as all apps have)

it has a generic UIWindow as the view property.

To this window, I add a background wood image.

Then the app delegate creates an instance from a nib, of my main game object view-controller-subclass.  I actually use this view controller subclass as the main model of the game, instead of separating it out to form a more appropriate model-view-controller relationship model.

The game object has a custom UIView subclass, NOT the one for the OpenGL view.

This view is permanently in UIInterfaceOrientationLandscapeRight (the default orientation set in the Info.plist).
Extra trivia: when an orientation change occurs, I manually rotate subviews of the main game view individually.  This is done by  picking one of my five global CGAffineTransform variables created with assigned values

CGAffineTransform transRot0 = CGAffineTransformMakeRotation( 0 );
CGAffineTransform transRotMinus90 = CGAffineTransformMakeRotation( – M_PI / 2 );
CGAffineTransform transRot90 = CGAffineTransformMakeRotation( M_PI / 2 );
CGAffineTransform transRotMinus180 = CGAffineTransformMakeRotation( – M_PI );
CGAffineTransform transRot180 = CGAffineTransformMakeRotation( M_PI );

The two 180s are very important, only if using animations to transition with style.  And that’s what I am doing (in some cases).
The UIInterfaceOrientationLandscapeRight is the same thing as UIDeviceOrientationLandscapeLeft (when you rotate the iPhone or iPod touch from having the home-button down = portrait, to having it on the right-side = device landscape left, the interface must rotate the opposite direction = landscape right, to maintain the same upward direction so you don’t have to tilt your head).  The direction of positive rotation is clockwise,  so if someone starts the app and has the home button down = device/interface portrait, the interface must rotate counter-clockwise 90 degrees, thus I assign transRotMinus90.
NOW IF the device is rotated again to device-landscape-right/interface-landscape-left, all my subviews including the play-screen and main menu will need to be rotated to a 180 degree transform rotation. But because the view was previously a Minus-90 degree, the next rotation should be a Minus-180 degree.  If using animations and assigning all subviews a 180 degree rotation from minus-90 degrees, rotating from portrait to device-landscape-right will have a terrible looking 270 degree opposite rotation.  Again, it isn’t important to do minus-180 if there is no animation.

That’s a long-winded orientation discussion.

And as mentioned, the game-viewcontroller has a custom subclass UIView.  It has two primary views added as subviews (there are other subviews which are not important for discussion).  The first primary view is a view from a custom subclass of UIViewController controlling the main menu, and the second of the two primary views is a custom subclass of UIView which is for the OpenGL graphics.

And I haven’t been working on this today, but I mentioned all of my game’s orientation methods are contained within the main game class, not the custom subview class.

All of this orientation code, and much more (multiple levels of initializing and setup, haha) combine to a pretty large line count – today I went over 6000 lines in this one file.

Everything is very well organized still, so I have no problem navigating or finding things.  Woohoo.  Otherwise, it would be a colossal nightmare.

Posted in Technology | Tagged , , , , , , , , | Leave a comment

What should be paid-for, and what should be free?

Here are two reviews of an iPhone app on the Apple App Store, copied mostly word-for-word

Fantastic game 🙂 ***** (5/5 stars rated)
Awesome music soundtrack, great gameplay, just pure love.  I agree that the update should be free, but I still bought the map pack because at least my money goes to the developer who really deserves it.

Pay for new content  *  (1/5 stars rated)
Game is good but having to pay for new maps is ridiculous.  Also saying 5 star rating will keep updates coming.  If I have to pay for updates, what’s the point.

Here I have discovered two immediately accessible cases of opposing attitudes of rating, but similar attitudes about product expectation. Myself, I found the game as a free promotional offer.  I assume it is normally a paid-for app.

I’ll say person A is the 5 star rating, and person B is the 1 star rating.

Person A has a good attitude.  There are a lot of apps out there that are good for fun or for usefulness and should be paid for, or tolerate any advertising that is present in the app to cover some costs of development or maintenance.

Person B expects too much.  What is the point of getting a game if expansions must be paid for?  Sounds like someone who might pay 200 dollars for the Nintendo Wii, or 300-400 for the Sony PS3 but expect 10 games to come with the console, or a full party-pack of controllers instead of the single ones that come packaged.

Maybe lots of people have expectations.  But when they’re very harsh opinions that get tossed into the public domain where anyone can be influenced, the problem that I recognize isn’t the unreasonable harshness or the 1/5 rating despite the first few words being “Game is good”… The real problem is the cultural expectation of what should be free and what should be paid-for.

This is something I’ve been thinking about recently, relating to my own project.

Personally, I think the paid-for content should be anything that is above and beyond the original scope of the project, unless it is an enhancement to the product that actually fits within the original scope.

Now I have been thinking of a number of specific examples of this idea.

When I submit the first release of this product to Apple for approval to the App Store, I am going to make it either free or paid.  My general desire is paid.  This way, NO one tries the app unless it is paid for, and my personal expectation is that only people who really like the app will pay for it because I’m going to have appropriate (but very limited) marketing- good example screen shots of gameplay, not just menus.  Also I plan on marketing a few videos on Youtube.  So it can be known what the game is like and people who want it will buy it, and those who wouldn’t like to pay will just go get something else, for free.  This is my reasoning.  More info follows.

Any app that has better performance developed, say bringing a game from 20 frames-per-second to 30 or 40 fps, is a great development upgrade, and that should be included for free.  It is something that is contained within the original scope because it has no extension to the project.  It is an enhancement of the product but not a true extension/expansion.

Any new artwork that replaces original artwork is also enhancement, but not expansions/extensions.

But any new levels that are adding to gameplay that are not included in the original app are extensions.  It is a good thing for the developer/publisher to have a price set, or make it free if they want.

Another expansion/extension is multiplayer.  This is one of the most significant aspects of a game.  But when is it appropriate to charge for multiplayer?  Seems like it’s always free!

Well, I would say if an app is released as single-player on the app sore, and is FREE, then the multiplayer should be a paid-for extension because the original app is already free for everyone to enjoy.  Adding multiplayer support within a game can be very complicated, and take many hours/days/weeks to setup and polish.  It is in so many games already for free, but most of these games are paid-for and so the consumer may expect multiplayer feature to be free.  I know I would.

So now for any free app, any extension is reasonable to be a paid extension, and even upgrades may be chargable.

The point of a free game is to have a free game.   Can it be any more obvious?  There should be no high expectations.

A paid-for game should have far more content than a free game.  extensions may be free, and some may be paid.  Deciding to make extensions free will be a very welcome thing to anyone who has paid for your app.  Making extensions paid must mean the extensions should be very, very good, sort of like the quality of a whole new app.  Something that adds new vibrancy to the game.

In my case, I am thinking of making large environments in the future, and will try selling them with a custom pricing model (say 1 sub environment for $1, 5 sub environments for $2, 10 sub environments for $5, and so on.

There are many different influencing factors, but one of the biggest influences is whether the app is free on the app store, or paid.

Posted in Technology, Thoughts | Tagged , , , , | 1 Comment