Tag Archives: iPod

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

The “freemium” business model.

From Wikipedia’s Freemium page:

Freemium is a business model that works by offering basic Web services, or a basic downloadable digital product, for free, while charging a premium for advanced or special features. The word “freemium” is a portmanteau created by combining the two aspects of the business model: “free” and “premium”.

There are hundreds or thousands of games on the Apple AppStore.  The popularity of it is rising according to numerous reports, and probably it is a very profitable model.  I just heard of the term and so looked it up.  It seemed fairly obvious given the context: a review written for an iPhone game, talking about the free nature and how the extra features are paid (something this particular reviewer did not like).

So, now the question of the moment: should this app I am developing follow the freemium model?  I don’t think I can answer that during the time of this blog post writing, but I will give it some writable thought.

A freemium app gives the public something to try-before-you-buy, but the Apple acceptance for new apps to the AppStore requires all apps to provide a “complete” product, even if it is minimal.

Pros:

  • You can get more initial market penetration
  • Possibly take advantage of alternate marketing techniques.
  • “Free-buyers” may be able to customize their experience of the product in the extensions
  • Coming from the previous point, the buyers may find their experience enhanced by a product that can interpret specific combinations of extensions, for example: a car-building game, buying a “racing stripe” paint job and an “air foil” extensions separately may each add individual looks or enhancements to speed, but together they gain a bonus, a synergy from the two.

Cons:

  • The product’s “extras” that are premium may not be accepted as “worth the money”, and a greater majority of people may consume the product’s free version, and then carry on with the next shiny thing that catches their eye.
  • The “extras” require specific development that extend beyond the core “Free” product scope.  More levels, more characters, etc, cost more time and money to create.
  • A buyer may be surprised to find “extras” that he or she, individually, naturally expects as part of the “Free” product, and complain or spread bad reviews complaining about “premiums that ought to be free”
  • An update to the free product that requires the previous purchase of a (very) popular extension should only be publicly released after making the popular extension become part of the core free product.  The Apple AppStore’s in-app purchases feature does not permit game logic upgrades, but does permit static data files like artwork (decals) and 3D models (new cars or whatever) and sound.  No new multi-player features, however there are ways around that…  So, realistically, an update to the free product that requires the previous purchase of an extension should not be an update to the free product, rather it should be a paid extension, perhaps one that absorbs and eliminates the previous popular extension

After this analysis, it seems the benefits are all mostly in favour of the end-user, and to a lesser extent, benefiting the company/developer.  The Cons are all weighing more heavily on the company/developer.  There are no major cons to the end-user except for those people who have personal expectations of extra free things, and the free-release of previously paid for products.

I like the idea of the fremium model, and may chose it but for now, the core game must completed.

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

Progress in movement algorithm design

The album Bolero Gypsies: new flamenco is playing in my ears and the book iPhone cool projects from apress is spread open on my lap and I am typing a blog update on the iPod touch.

The chapter in the book I am reading is about the subject of networking. This may be getting ahead of myself, but it’s good to know for when the opportunity presents itself, and it will.

Yesterday, I created the movement of one of the principle game assets that will be moving constantly in the game. Let’s call this object a “bird” (it’s not in the game, neither is it in the air but it serves for this explanation).  The movement requires intelligence, not merely a simple movement like a rotation of some degrees on every game loop (eg. coins in Super Mario games or rings in Sonic the Hedgehog games). The game world may be large when the game is finished. The first draft for movement has become the following: a “home path” in the same style of the common footpath worn by animals in their native environments, when they travel the paths frequently. So it is with this movent. A path throughout any part of the game world.

This path is achieved by using a number of data variables.

The most important is the array of “checkpoints”. These are the same as checkpoints in a racetrack. In my first version of the movement system, the checkpoints are created as cubes in the world 3d model file, with special object names and serial number prefixes, such as “homepath001”. The name is searched and all the points are loaded into an array.

After the array, the most important variable is for storing the index serial number for the checkpoint the bird will be moving toward. Optionally, this destination may be interupted an replaced with any arbitrary location and the bird will move toward there instead.

Now, storing the index value of the next checkpoint allows us to determine the direction of movement whenever we want to. So now, this permits us to consider other random travel destinations.  If any arbitrary destination is chosen at anytime, another variable must store the yes/no status indicating if the object is moving toward the next checkpoint or not. So this possibility brings the necessity of another variable to store the actual destination location instead of only referencing the next checkpoint from the next-checkpoint-index. When the next checkpoint is reached, the index of the next checkpoint is updated, and the location for the new next-checkpoint is copied to this destination as the default destination.

This is just the tip of the iceberg.

Assuming movement toward some arbitrary location is part of the object’s life cycle, not only following a path forever, then it stands to reason to store not only the next destination separate to the next checkpoint as we’ve discussed, but also store the current home-path-location of the bird as soon as a new, arbitrary, destination is created. This will give the bird next-destination options to choose between, when it reaches the arbitrary location.  It may chose to return to it’s home path from where it left the path, somewhat tracing it’s path backward. Or, it may choose to continue to the next checkpoint directly.

In the case of the city pigeon bird, a home path might be the path around a large office building, and its checkpoints are lamp posts and parking lots (it may choose to walk in a parking lot).  When it is anywhere flying or walking, it may decide to go look at something away from its path, but it will try to keep its home building in sight, and if it decides to return, it can go onto wherever it wants, in the direction of its home!

Having more options is always a better thing than few options or only one.

Following this, I have implemented bezier curves for a smooth transition from approaching one checkpoint to the start of the next checkpoint’s path.  It doesn’t work well if a bird (or any other creature) is moving in a straight line and then instantly is moving in a separate direction..

Never before have I worked with bezier curve equations, so it’s brand new.  But I got the equation from Wikipedia’s page and plugged it in, and now it works.  This is a complicated issue, and not really part of algorithm design, but of implementation.

That will remain for some other day.

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

Today: learning and doing activities. Tomorrow: repeat.

Today has been a day of guitar-playing, reading, interpreting, typing, mouse-clicking, and dragging.

I built a 3D model of the Bahamas islands plus Turks & Caicos islands. I am using it as the sample of a 3D islands world in my iPhone game project. This is fun! Building in 3D is new to me, but things don’t go in one ear and out the other in this sort of subject. There are SO VERY MANY things to learn in Blender, because it’s not a user-friendly 3D modelling program. I didn’t know that when I started learning it, but now I do know it.

I got into using it from someone’s internet article of 3D and 2D graphic rendering engines for iPhone and iPod touch (and I suppose now, iPad). The person had SIO2 and Oolong as the top two ranked options, but in pros-and-cons, listed Blender as a con for SIO2.

But that’s probably because like me, that person had no experience with 3D art and modelling.  Anyway, I spent the latter half of January going through Blender 3D: Noob to Pro, and have progressed about 40-50% through it.  I should really finish, except SIO2 does not fully support everything, and I’m trying to catch up to the 40-50% full competency of SIO2  before going on with more complex Blender subjects (like animated armatures).

So anyway, going through the tutorials in the source code is what must be done, not reading step-by-step how-to documents.  This is a guerilla-style learning.  Gotta get my feet wet by jumping in 100% and swim with the sharks.  Not that anyone associated with SIO2 is a great white shark, more like very pleasant whale shark… that sounds really odd, but I’m tired now.

When complete, this project will be a lot of fun (I hope!).  A lot of ideas come to me when I’m in a lucid state, so immediately in the morning before I am out of bed and just sort of coming out of unconsiousness, I try to figure out what ideas are lurking.. at the edge of thought.  Collect them up!  They’re worth money in the right hands, my hands!

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

Problems with iPhone device provisioning

Before working on the iPhone, I have only a day or two’s experience with secure certificates.  The SSL certificate I bought for a web site took a day to buy and another day to setup.

Now, I am dealing with these secure certificates again, and it’s a bit challenging because of my lack of experience!

The task at hand: get Xcode to properly upload one of my apps for testing on the iPod touch.  I think the provisioning is giving me troubles, or something else is.   When I tried to build an app I downloaded as a tutorial, it had someone else’s name in the configuration for the device, so I changed it to my own and also included the certificate, and it still kept telling me the other person’s name was in the configuration.

So I stopped trying to use that tutorial project, and went back to my own, and discovered that Xcode is bugged up.  I try to build and run, setting the device as the Active SDK.

And it uploads the app, but if I am running the debugger, and I click build and debug, it uploads, but gives me an error saying “Failed to upload the ___ app”

Then I look at the iPod touch, and the app is sitting there.  I delete the app, repeat the process, and it’s exactly the same as described.

I’ve checked every single Build-Debug configuration setting and they’re all proper, so I know the issue is not there.

I’ve just finished restarting the iPod touch, and the results:

Failure.

I’m really puzzled.  Possibly some other file is causing me grief.    I created a new test project to verify Xcode can still upload and debug, and yes, it can still upload and debug.  So, there’s something buggy with the app.  Cleaning the targets doesn’t help either.

And this issue has started since testing this other tutorial app out.

EDIT: I have solved this issue after checking google a second time.  First time searching for the problem did not give any success, but second time I found this: Failed to upload XXX.app

More information: The location of the name of this other person was in the Code signing area of the TARGET, but not of the PROJECT.    That’s solved now.

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

Documentation and 3D game engines

I am progressing slowly but surely. The 3d rendering engine for the iPhone that I am using is called SIO2. I am finding it slow going because the documentation is not what I call good. There are no step by step procedures in the tutorials and the reference doc materials are very raw, with no clean summaries,except those on the front page of the website that describe, in point form, the most general capabilities. Those capabilities are great,but after putting in the time to download the engine and try out the tutorials, I am coming to a question: is a pre-existing system better than developing a system in-house, if the existing system is so time consuming that the learning curve is almost as long as the development process?

Here I am frustrated with the lack of good quality and complete learning materials, but the existence of the system is still better than developing my own system. That is because in the time it would still take to devlelop my own thing, the existing thing may (or may not) improve, and in other cases I may find some help that I had not found at first. So the learning of an existing system is better.

This experience is going into the heaping pile of experiences of bad documentation for products I have seen. There is a wiki, and I might start contributing to it.

Going forward in the future, the skill to produce good documentation may become a very valuable transferable skill in the workplace. It seems very boring in some product contexts, ie. Vacuum cleaner manuals, software application manuals, inflatable air matress instruction sheets. Yet this world needs a better, universal, written method of learning that appeals to the reader. Something like google’s API doumentation, and apple’s iPhone and iPad documentation.

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

Defining iPhone game app scope

I’ve had a bit of annoying troubles today. Not a whole lot, but a bit. I’ve gone through them after a bit of stress.

Classical music does wonders for slowing down and calming my super-fast reading eyes, that my mind can’t keep up with. It also brings a bit of patience. So tasks may be done.

And I didn’t start listening to classical music until around 7:30pm. heh.  Earlier in the day, I built up a document of screen names (eg. load screen, main front screen, instructions screen) and the contents and behaviours on them, from a number of existing iPhone game apps. Using these notes as a starting point for constructing the outer scope of the game. With them, it becomes much easier to see where everything fits from a top-down perspective.

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

UIKit’s UIView Hierarchy

Tonight I decided to put together a printable document built from the iPhone Dev Center’s reference for UIKit.  This document includes three sections (class name + overview section + tasks section) for UIView, plus all subclasses of UIView that appear in the hierarchy tree diagram in the UIKit framework reference.

That’s a mouthful.

Simply put: this document is a condensed, reader’s-digest version of the class references for every visible piece of an iPhone app (not counting custom crazy OpenGL apps and custom drawn stuff. heh)

There are a lot of things available even before getting into the custom drawn things, so to read it all in a nutshell, I copy-pasted all the text and edited it to fit to pages and be nicely readable.   The document is a PDF.

Click here for the UIView class hierarchy plus UIApplication and UIResponder

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

Created a new iPhone app

Using iTunes connect, I have setup an app submission. The app is a game whose name is yet to be announced, and is not yet finished. So, the submission will be completed for the review to begin when the game’s design and development are complete.

This is exciting!

Last night or the night before, I installed the iMario app, a free or paid soundboard app. It is too simple, but has a bit of nice images. The sound does not play well, eg. If you press the starman button, the sound plays for several seconds, but if pressing the block smash button, the starman sound cuts out. The playback of any sound is imediately ended if starting a different sound.

Back to the iPhone app: app developers may start the submission process without submitting the product, so I am doing this as an exersize to learn the process now.

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

iPhone & iPod Touch apps

Last night I succeeded in enrolling in the iPhone Developer Program.

This permits two major activities:

  1. Installing in-development projects onto a real iPhone/iTouch (compared to only running projects in the iPhone simulator on the macbook)
  2. Submitting developed projects to the Apple’s AppStore.

Soon a few ideas I have will be submitted, but first they need to be designed on paper.

There are some free resources for creating the visual design of an app on the iPhone/iTouch.  Stencils exist for most, if not all major image editor programs like Adobe Photoshop and Illustrator and Omnigraffle. Also I found some graph paper of all things, but with the iphone body printed overtop, and when printed off it’s at 1:1 scale, and it’s just great stuff.  So this needs to be my focus next.

Boat, screenshot from ipod touch

Right now I am still burning through the Blender wiki, learning the 3D modelling program as fast as I can, so I can get a better ship modelled.  Earlier this week, I created a 9 polygon little boat.  two sails, a rudder, a deck, a stern, and a 4 polygon hull.  Wooohooo

The tutorials teach how to build a person, and a mountain range, and then a lot more crazy things.

The objective is creating a couple of 3D content files that I can load into a 3D game engine which I’ve downloaded called SIO2 and use it to build a demonstration first, then a full app after.

Later, I may make a tank game and call it TomTank.  Revisit the dumb but funny days of QBasic in highschool.

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