Different App versions, same App in AppStore

I have now realized that for the App i’m doing, i really need to have a version for the iPhone 3, another for the iPhone 4 and another for the Ipad.
As dynamic resolution doesn’t work for spritesheets, and almost everything in my app comes from spritesheets, i’ll need to develop 3 different versions of my game.
What would then happen in the AppStore? Would i have all 3 versions as different applications or is there a way for it to appear as just one app and then, at the moment of downloading, the correct version for that specific device is downloaded…
Having great problems with this since i can’t figure out how to turn my iPad 2/ iPhone 4 game into an iPhone 3/iPad 1 app.
Would appreciate any kind of help!! thanks! [import]uid: 105206 topic_id: 22544 reply_id: 322544[/import]

Don’t forget that there are simple ways to detect which device you are using in your code, so you could check in your main.lua which device is being used, and based on that run different code. The only downside here is that your package will include the assets for all 3 sizes, but I would assume that iPhone 4 and iPad would use the same size so this does not have to be too big a problem.

This looks like a much better option than having 3 different apps out there and users potentially rating you down because they got lost somewhere.

just wait till the iPad 3 complicates things further! [import]uid: 70134 topic_id: 22544 reply_id: 89872[/import]

I think the only way to do this in the Apple AppStore would be to include everything in a single application. At runtime you would dynamically detect which platform you are running on and load the appropriate sprite sheets (and adjust other variables as appropriate).

You can do what you’re suggesting in the Android Marketplace. It has the ability to provide multiple APK files for a single entry though it can be difficult to setup and support correctly.

  • Stephen
    KigraSoft [import]uid: 4639 topic_id: 22544 reply_id: 89875[/import]

@thomas6, SteveK,

thank you both for your replies. I’ll check the device detection then.
Cheers! [import]uid: 105206 topic_id: 22544 reply_id: 89879[/import]

Maybe this will get you started.

main.lua

-- detect device code  
---------------------  
  
local xScale = display.newText("xScale", 20, 50, "Helvetica", 24)  
local yScale = display.newText("yScale", 20, 100, "Helvetica", 24)  
local contentWidth = display.newText("contentWidth", 20, 150, "Helvetica", 24)  
local contentHeight = display.newText("contentHeight", 20, 200, "Helvetica", 24)  
local device = display.newText("device", 20, 250, "Helvetica", 30)  
  
xScale:setTextColor(255, 255, 255)  
yScale:setTextColor(255, 255, 255)  
contentWidth:setTextColor(255, 255, 255)  
contentHeight:setTextColor(255, 255, 255)  
device:setTextColor(255, 0, 255)  
  
local function detectDevice()  
 xScale.text = string.format("%.2f", display.contentScaleX)  
 yScale.text = string.format("%.2f", display.contentScaleY)  
 contentWidth.text = string.format("%.2f", display.viewableContentWidth)  
 contentHeight.text = string.format("%.2f", display.viewableContentHeight)  
  
 xScale:setReferencePoint(display.CenterLeftReferencePoint);  
 xScale.x = 20  
 yScale:setReferencePoint(display.CenterLeftReferencePoint);  
 yScale.x = 20  
 contentWidth:setReferencePoint(display.CenterLeftReferencePoint);  
 contentWidth.x = 20  
 contentHeight:setReferencePoint(display.CenterLeftReferencePoint);  
 contentHeight.x = 20   
  
  
 local test = tonumber(xScale.text)  
 if test == 1 then  
 device.text = "iPhone 3 or myTouch"  
 elseif test == 0.5 then  
 device.text = "iPhone 4"  
 elseif test == 0.47 then  
 device.text = "iPad"  
 elseif test == 0.67 then  
 device.text = "Droid or Nexus One"  
 elseif test == 0.53 then  
 device.text = "Galaxy Tab"   
 end  
  
 device:setReferencePoint(display.CenterLeftReferencePoint);  
 device.x = 20  
  
end -- detectDevice()  
  
detectDevice()  

and config.lua

application =  
{  
 content =  
 {  
 width = 320,  
 height = 480,  
 scale = "letterBox"  
 },  
}  

Use this and switch devices in the simulator. I prefer this (working with the exact screen size) over trying to fetch a device name and or model version.

Of course your exact solution will be different. Good luck!

Thomas [import]uid: 70134 topic_id: 22544 reply_id: 89880[/import]

Awesome code thomas! This is extremely helpful!
Now, how would this change if my config is set for the iPad?? Or it doesn’t change at all? [import]uid: 105206 topic_id: 22544 reply_id: 89881[/import]

You’re welcome!

Haven’t run the code myself for some time, but I assume it will work similarly but just give different values for xScale.text, so just run it, take note of those values for the different devices in the simulator and adjust your code.

Let me know if you have trouble getting this to work. [import]uid: 70134 topic_id: 22544 reply_id: 89884[/import]

What is in your config.lua file now? Can you post it here so I can have a look at it tonight (in 8 hours)? [import]uid: 70134 topic_id: 22544 reply_id: 89885[/import]

Sure!

[blockcode]
application =
{
content =
{
fps = 30,
width = 768,
height = 1024,
scale = “letterbox”,
},
}
[/blockcode] [import]uid: 105206 topic_id: 22544 reply_id: 89886[/import]

use this in main.lua and watch your terminal output:

[code]
– detect device code

local test = display.contentScaleX

if test == 1 then
print(“iPad”)
elseif test == 1.2 then
print(“iPhone 4”)
elseif test == 2.4 then
print(“iPhone 3”)
end
[/code] [import]uid: 70134 topic_id: 22544 reply_id: 89887[/import]

nothing is being printed :S

I added an “else” condition. It prints that output. It seems like none of those “test” values are detected.

[blockcode]

local test = display.contentScaleX

if test == 1 then
print(“iPad”)
elseif test == 1.2 then
print(“iPhone 4”)
elseif test == 2.4 then
print(“iPhone 3”)
else
print(“none”)
end
[/blockcode]

EDIT: It only returns iPad when running on the iPad, on the others it returns none. [import]uid: 105206 topic_id: 22544 reply_id: 89890[/import]

Don’t be lazy, nml! That’s just a rounding issue.

Corrected here:

[code]
– detect device code

local test = math.round(display.contentScaleX*10)/10

print(test)

if test == 1 then
print(“iPad”)
elseif test == 1.2 then
print(“iPhone 4”)
elseif test == 2.4 then
print(“iPhone 3”)
end
[/code] [import]uid: 70134 topic_id: 22544 reply_id: 89891[/import]

Haha that was it!!
I have no idea of what’s happening, that’s why i didn’t know i had to round it.
Thank you a lot! This will do it for me! [import]uid: 105206 topic_id: 22544 reply_id: 89893[/import]

could it be possible that this doesn’t work when using zoomStretch or zoomEven?? [import]uid: 105206 topic_id: 22544 reply_id: 89905[/import]

The first answer is always: have you tried it? :wink:

I don’t know myself. There’s reasons to think it should or shouldn’t work - although I would think the content scaling factor should work in the same way so I would guess that it should work, but you might get different results.

Check the values that are output to the terminal with the print(“test”) command, and use these in the if…elseif…end block.

And let us know the results! [import]uid: 70134 topic_id: 22544 reply_id: 89910[/import]