Game Development Community

iPad Development Changes/Tips

by Michael Perry · in iTorque 2D · 04/05/2010 (3:20 pm) · 18 replies

Hey everyone. We are going to use this thread to post bugs, fixes, tips, and other notes related to iPad development with iT2D. We are looking to put out an official release this week, so anything useful in here will be rolled in.

1: Conversion - Your existing iT2D projects are built for the iPhone. To convert the project, perform the following:

1. Open your game's Xcode project
2. Right click on your target
3. Upgrade current target to iPad
4. Depending on your preference for multiple target, choose universal or separate targets. I've been using Universal.

2: Hard-coded resolutions -The overall problem is that the original developers operated under the assumption that the iPhone engine was always going to be targeting two possible resolutions: 480x320 and 320x480. Now that the iPad is available, it doesn't make sense to make a completely separate product/engine and fall into the same hole (what happens when the iTV comes out and we want iTorque to support it? =p)

What we are going to do is create a few extra variables and settings to make easy for the end-user (you) to determine the target platform and resolution. I would like for this to be accessible from script and the editor, as well as source code. This is not a monumental task, but it does need to be clean. Simple hacks will work on a per game basis, but when you want to create universal apps you will want something efficient and easy to use.

These are easy to track down, though. In Xcode, perform a search in the project for "480". You will get a list of code lines where this value is hardcoded. While we are working on a more elegant solution, you can change the following lines of code to get iPad resolution support (1024x768).


In platformiPhone/platformGL.h, lines 52 and 53
#define IPHONE_MAX_RESOLUTION_X			480
#define IPHONE_MAX_RESOLUTION_Y			480

Change to
#define IPHONE_MAX_RESOLUTION_X			1150
#define IPHONE_MAX_RESOLUTION_Y			1150

You will want to change these values to fit the new max resolution. For some reason, the obvious 1024 appears to have a bug. An offset has to be applied to the value for the canvas to line up. This will go away entirely in the final release

In platformiPhone/iPhoneOGLVideo.mm, lines 74, 75, 77, and 78
//------------------------------------------------------------------------------
void OpenGLDevice::initDevice()
{
// instead of caling enum monitors and enumdisplaymodes on that, we're just going to put in the ones that we know we have

	mResolutionList.push_back( Resolution( 320, 480, 16 ) );	
	mResolutionList.push_back( Resolution( 480, 320, 16 ) );	

	mResolutionList.push_back( Resolution( 320, 480, 32 ) );	
	mResolutionList.push_back( Resolution( 480, 320, 32 ) );	

}

Change to
//------------------------------------------------------------------------------
void OpenGLDevice::initDevice()
{
	//instead of caling enum monitors and enumdisplaymodes on that, we're just going to put in the ones that we know we have

	mResolutionList.push_back( Resolution( 320, 480, 16 ) );	
	mResolutionList.push_back( Resolution( 480, 320, 16 ) );	

	mResolutionList.push_back( Resolution( 320, 480, 32 ) );	
	mResolutionList.push_back( Resolution( 480, 320, 32 ) );	

	mResolutionList.push_back( Resolution( 768, 1024, 16 ) );	
	mResolutionList.push_back( Resolution( 1024, 768, 16 ) );	

	mResolutionList.push_back( Resolution( 768, 1024, 32 ) );	
	mResolutionList.push_back( Resolution( 1024, 768, 32 ) );

}

In your game's common/commonConfig.xml, change
<Resolution>480 320 32</Resolution>

To
<Resolution>1024 768 32</Resolution>

Of course, that depends on whether your game launches in landscape (1024x768) or portrait (768x1024) mode. Finally, make sure that while you are in the editor you set your Design Resolution to 1024x768 or 768x1024. This way you can test the game on the dev machine before deploying to device.

This should get you going on at least having your app render to the iPad device and simulator properly. I already have a list of some additional fixes, such as GUIs, input, and optional render specs to work on. Feel free to post any issues you run into. We will continue to work on this for an official release.

I will post more as I come across them, so you can get a headstart without waiting on a packaged build (hurray for source code access!). We are looking at two releases in the near future:

1. iT2D 1.3.2 - Fixes/changes related to iPad support
2. iT2D 1.4 - New iPhone OS feature support, new demos, new docs, new sample code

#1
04/05/2010 (4:49 pm)
Awesome.

I really appreciate you showing us how to change the resolution in code since I know everyone is working on different versions of iTGB.

Hmmm now I wonder how much work it would take to do a universal build...
#2
04/05/2010 (5:05 pm)
@Johnny Vo - I think if you plan it out carefully from the beginning, it will not be difficult. Assets will be the trickiest part, then functionality. The iPad CPU is crunching twice as fast an iPhone, so TorqueScript is a lot more performant.

The new iT2D demo I'm working on will be a universal app.
#3
04/06/2010 (10:04 am)
This is some fantastic stuff, right on time. I just got a contract to create an iPhone product for medical education, I sold them on an iPad version as well.

#4
04/06/2010 (11:15 pm)
@Henry Shilling off topic, I'm Just curious as a fairly new developer, how do you find these people that need these apps made for iphone? Did they find you? Feel free to email me, I'd really appreciate it. My emails in my profile
#5
04/07/2010 (10:00 am)
@John, I have been doing development of weird interactives, in central ohio for the last 15 years. Games for trade shows etc and many companies in the area know that when they want some out of the box thing, like not just a website or such, they call me. The iPhone thing came from someone who knew someone who was a facebook friend and saw where I posted some of the things I was working on, which included iPhone dev.

There are often creative agencies in most larger towns where you can find interesting stuff as well, I have used www.creativegroup.com and have a 4 year professional relationship with an agent there who calls me often when something out of the ordinary comes up.

I stay on twitter often and facebook sometimes, to post what I am doing, have a number of followers/friends who I have worked with. It keeps my face in front of them.

It's always good to network ;)

#6
04/12/2010 (9:33 am)
@Henry (off topic also)
Where in central Ohio are you? I am in the Columbus area myself. I am an iPhone game developer doing contract work for a company out of NY called Ten Toed Inc. They make children's games primarily. We just released one called Frogs and Fireflies. I also agree... it's always good to network ;) If you are on LinkedIn, feel free to add me (same name as here).

@John
I got my contract by going to GDC Austin. GDC is sort of a career fair for the games industry. There are a lot of scouts there looking for contractors or employees. The next one is in Vancouver, BC. After that, it'll be Austin, TX again (in September), and San Francisco, CA (in March). There's also a GDC Europe and GDC Asia, but I don't know much about those. Google "Game Developers Conference" and you should find their main website. Good luck!
#7
04/12/2010 (10:38 pm)
We never get the cool conferences near us. I am also in Columbus, UA to be exact. You should also try out TX and XNA. You can knock things out pretty quickly and it's been a decent source of income for me.

We do have the Origins game fair, ok quit laughing now.
#8
04/13/2010 (9:42 am)
Please remain on topic. This thread is dedicated to iPad support and code.
#9
04/14/2010 (11:10 pm)
(Back on topic)

Is there any word on when the official iPad supported release will be available?
#10
04/15/2010 (10:42 am)
I can´t perform the conversion since there is no Transition or Universal option to pick when I right click on my target. I´m missing something? I´ve opened the Xcode_iPhone project Xcode its empty.

Thanks
#11
04/15/2010 (10:56 am)
@Sarah - We are working on it now, but we are being more cautious about development while we wait to see how the current 3.3.2 issue pans out.

@Isaac - Which Xcode did you open? MyProjects\iPhoneExample\buildFiles\XCode_iPhone or install_directory\engine\compilers\Xcode_iPhone ?

Also, which iPhone SDK do you have installed?
#12
04/15/2010 (11:24 am)
@Michael,

I did open MyProjects\iPhoneExample\buildFiles\XCode_iPhone

Xcode 3.2.1
#13
04/15/2010 (11:42 am)
@Isaac - Sorry, I used terminology from the Apple docs. I just went through the process on our office Mac. Look for "Upgrade current target to iPad"
#14
04/15/2010 (2:36 pm)
@Michael,

Thanks. It seems that I need to download 3.2.2 first. It is safe to install Xcode lastest SDK for use with T2d 1.3?

#15
04/15/2010 (2:40 pm)
@Isaac - I have yet to personally have any problems with the SDK, but we have not fully run it through our QA.
#16
04/15/2010 (3:28 pm)
what is the 3.3.2 issue?
#17
04/15/2010 (3:53 pm)
@Henry - Please see this thread
#18
06/01/2010 (11:51 am)
Value 1150 for the maximal resolution is not enough - on the left border there will still be a white line
So one should use 1151
#define IPHONE_MAX_RESOLUTION_X         1151

Anyway, for what reason does it need to be more then 1024 x 768 / 768 x 1024 ?