Resizing to iPad Technique
tenrdrmer
Member, Sous Chef, Senior Sous-Chef Posts: 9,934
First of all I want to say. I know about the Project Re-sizer from Deep Blue Apps. I have it and I Love it. It has saved a lot of time for certain things. I recently found though, for my game Alpha Balls, it didn't save really any time at all. the reason is the game is heavily based on expressions for nearly every actor. So the task was very daunting to say the least.
I assumed I had a ton of work ahead of me until another user gave me an idea. for credit sake of the initial idea, I want to say this is the thread where it came from. http://gamesalad.com/forums/topic.php?id=32546
Although the Display size did not work for me and I got to thinking about that idea however.
And this is what I came up with.
I went through each scene in my game and place an actor that is unlocked and changed the Camera Size to 320x480. This also did not fully work however. I had to further adjust the camera origin on some levels that had an offscreen area. The last an final thing I did was to add a change attribute to any round actor that did this
Change self.width to self.width*0.9
This has provided a Flawless ipad version and here the best part. Last night I completely converted Alpha Balls to Alpha Balls HD in 1 hour
I hope this help you guys.
Thanks
Aaron
I assumed I had a ton of work ahead of me until another user gave me an idea. for credit sake of the initial idea, I want to say this is the thread where it came from. http://gamesalad.com/forums/topic.php?id=32546
Although the Display size did not work for me and I got to thinking about that idea however.
And this is what I came up with.
I went through each scene in my game and place an actor that is unlocked and changed the Camera Size to 320x480. This also did not fully work however. I had to further adjust the camera origin on some levels that had an offscreen area. The last an final thing I did was to add a change attribute to any round actor that did this
Change self.width to self.width*0.9
This has provided a Flawless ipad version and here the best part. Last night I completely converted Alpha Balls to Alpha Balls HD in 1 hour
I hope this help you guys.
Thanks
Aaron
Comments
Roy.
I would imagine it would be blurry if you did not build your game on RI in the first place. but otherwise I am extremely happy. creating some new screen shots today and will be submitting it.
"Change self.width to self.width*0.9" if its on iPad , the result will be a universal build !
Thats a great findings , i might just do an iPad version of "Loonimals" today haha .
Cheers
Roy.
I noticed if I tried putting the actor into my original first scene, it would not load fast enough and thus the display size would change but the other actors did not register it properly.
So the display size changed to 480x320 but the camera wasn't autoresizing, it will be at initial iPad settings.
And then it would just need a way to know the iphone and iPad placement of the camera origin for each scene. Im not sure how this would work though for a game that the camera moves.
Again its a nice quick solution but I would imagine that it wont work for every occasion.
Would be so easy to make Universal Builds!
Cheers.
I DO need to change my height to height*0.9 (My Game is Landscape)
Holderness_Media_Inc I know you created the "Original" method, but with that, your graphics don't retain the original proportion, you must change the width or height (Depending if its Landscape or Portrait).
Gs Team should read this... We could make universal Apps just so easy... (I will test more if this works great)
Cheers.
I'll be trying on our app soon, which doesnt use scrolling.
I went from ipad to iphone so memory sucked.
Main thing is the graphics aspect ratio will always be distorted. Using rules with separate graphics for iPad version should correct this.
I have no issues I have found with touch points but thats prob because I have gone from iPhone to iPad
I will redo some of the graphics for the iPad version for my new game and just make rules on the actors "if iPad is true then change attribute to ___image.png".
Just as a test, re-ported the space panda game
Original port (using the resizer tool, and then tweaking) - around 6-7 hours
New port using camera technique - 25 mins
!!
I boiled it all down to three vars "isiPhone", "gameSx", "gameSy" and a Custom Group called "Magic Scaling" I have that Custom Group in nearly every visible menu element of my game. The great thing about the Custom Group is that it lets me hand place things and adjust them easily.
Magic Scaling has a big if rule that surrounds four change attributes.
self.Size.Width = game.gameSx * self.Size.Width
self.Position.X = game.gameSx * self.Position.X
self.Size.Height = game.gameSy * self.Size.Height
self.Position.Y =game.gameSy * self.Position.Y
When going to the iPhone I change gameSx from 1 to 0.416667 and gameSy from 1 to 0.46875
For some elements that I don't want to scale that way I use the isiPhone var to trigger some other effect. There are some custom camera systems in my game that use this.
As a whole it's worked great for months.
Are you using the "isIphone" attribute to scale for acceleration, timers, etc.?
I imagine the Universal Build official solution will work along these lines, though who knows.
Hopefully it comes in one of the next few updates.
@ bradherman. I have been here over a year and until a few days ago have never seen and option for resizing other than manually or with the resizer from deep blue apps. Thats why I posted it. Its actually asked kinda often about how you can easily resize and the answer always being given is the two options I just said.
thats a nice technique you have as well. What orientation is that based on and do you just change the project to iphone version in the device list and the attribute or is there more you do to tweak things?
This is the process outlined in my notes. I do it the same way every time and follow the checklist.
I change the project to iPhone
I go to each scene and fix the Camera Follow interactively, This always gets broken when I change the project setting.
isiPhone = 1
gameSx = 0.416667
gameSy = 0.46875
save scene as mygame_vXX_iPhone
Play Test on Device with Viewer
Publish
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
So if this method works I will using it instead and maybe get this thing done.
Now, for my new game I can maintain 1 GS project and scale back and forth between iPhone or iPad in 2 steps. This will be sweet for updates.
Everything scales correctly, and any updates I make such as new levels, actors, etc. will also scale correctly.
(This might not work on everyone's projects, but for the way mine is programmed it's perfect.)
I should point out that I started this project from the get go with the mindset that Gamesalad will be adding universal support fairly soon, so alot of the actors in the project are programmed so their original XY coordinates relate directly to Game.DisplaySize. This *should* enable them to easily scale to iPhone, iPad, Macs, and I'm assuming Android as well. I can add more scenes, updates, characters etc. without needing to go in and manually resize scenes or anything. The main things to consider are how resizing an actor will potentially affect other actors and/or it's graphics, and then adding 1-2 custom behaviors accordingly. For majority of actors, simply resizing them will be fine, and maintain proper graphic proportions.
My first idea to use a dummy scene to change the game's display size to scale your scene's worked pretty well for my game, but it didn't retain the proper proportions on graphics. http://gamesalad.com/forums/topic.php?id=32546
Then bradherman posted about his techniques for scaling, which are briliant.
Maybe I'm just being stubborn, but I still felt there shouldn't be a need to scale each individual actors size AND it's x and y coordinates, as simply changing the game display size seems to scale the coordinates and velocity properly without need to configure.
**This is for LANDSCAPE projects, but theoretically should work for Portrait and potentially any dimensions so long as you change the values of gameSx and gameSy to compensate for screen dimensions. Also, this assumes you are using Retina sized graphics, otherwise your graphics will be distorted.**
Here's what I'm doing.
1.) Create a boolean game attribute called "isPad", or "isiPhone" or simliar. (I went ahead and made booleans for iPad/iPhone/Android/etc. so that when the options arrive in Gamesald I can quickly scale between platforms when exporting.)
2.) Create 2 attributes, "gameSx" and "gameSy" as per bradhermans method.
(These attributes need to be "real" not "integer".)
To scale from iPhone to iPad, use these values.
gameSx = 0.9375
gameSy= 0.833333
(if scaling from iPad to iPhone, use the values brad posted.)
3.) On any of your actors, create a new rule with 2 change attributes
If attribute "isiPad" is true:
change attribute self.size.width to game.gameSx * self.size.width
change attribute self.size.height to game.gameSy * self.size.height
4.) Save this new rule as a custom behavior, so you can drag it onto any actors you need to. Name it something like "Resize actor for iPad". Of course you'll likely want most of your prototype actors to have this rule.
5.) For backgrounds, or any other actors you see fit, they will need to use different graphics in order to have proper proportions when scaled to iPad. So make a separate rule for these actors.
if "isPad" is true:
change attribute self.Image to "ipad_sized_image.png"
Again, you can now save this rule as a custom behavior to use for any other actors, backgrounds etc. that you wish to switch graphics for iPad.
You DO NOT need to resize these actors for iPad, changing their graphics to an image that has iPad proportions works perfect.
6.) Create a new blank scene, and make it the first scene in your project, before your normal "home" screen. Call this new scene something like "Game Display scaling".
(This scene will be used to scale the entire game to iPad when desired, or simply bypass and go to your normal home screen.)
7.) Create a blank actor, call it something like "game display resizer" or simliar.
Create a rule for this actor:
if "isiPad" is true:
change attribute game.DisplaySize.Width to 480
change attribute game.DisplaySize.Height to 320
Now, create a SEPARATE timer for this actor:
After 0.2 seconds (run to completion)
Change Scene to "your home scene"
(make sure this timer is not embedded within the rule above)
8.) Add the "Resize actor for iPad" and/or "change image for iPad" custom behaviors to all the necessary actors for your game.
That's it.
Once these steps are taken, you should now be able to do the following whenever publishing to scale for iPad.
1.) change game attribute "isIpad" to TRUE
2.) change the project dimension to iPad landscape
Now test your game on the iPad using the viewer, and publish when ready.