Universal Builds for iOS and Android,and anything else,using iPad build and "Stretch" no distortion.
I see a lot of talk about Universal Build here lately, and thought I would share how I do it for those who need help. I don't like overscan because you lose area so I use stretch and gain a few pixels much better,and my mic is broken so I will try and explain and show video of it working.
I can't say it's 100% perfect but works well enough for me.
sorry my grammar is bad but here goes,lol.
I have a actor unlocked called camSize on every scene in here I change 5 attributes for the game in video, I have a portrait game that only uses 3.
camSize - this stores new camera size by checking the device against iPad size "deviceWidth x768 / deviceHeight = new
camSize, this is used to change camera size on ever scene, and by using stretch you get a perfect fit on anything.
Soffset.X - this store offset for actors if iPad is used it's 0 so nothing changes "new camera size - 1024 = offset"
this is used to offset actors for different devices. Now you only need to add this to actors that set at 512 and
higher because ever thing below this doesn't need to move.because camera expands to the right not left.
also sometime you may use change self to position+offset for a full move aka "controls" but some things may
only move to position+offset/2, and if iPad is being used offset will be 0.
offset is used the most on anything that will need to change positions for different devices just adding a simple
change attribute to actors saying change self position to self.position+offSet or offSet/2 does the trick.
SceneMin - this store half of the new cam size.
this I use for actors that set in middle of scene "512" I just tell them to go here, no matter what device there on
they will find there spot, and so can backgrounds if need be.
SceneMax - this stores scene size - sceneMin.
I use this for level select screen and to make sure camera stops moving at end of scene at correct spot,and ETC
SceneSize - stores full length of scene.
I use scene size to get sceneMin or whatever.
Heres a video of my game Steam Jack, notice the splash screen sets up most things and a single scene like title screen only needs to change camera size and a game screen changes 4 and that one could be 1 but my level select needs a scene size change so I just include it in ever play scene.
Hopefully this will help new people out.
Comments
i like it. thanks @BBEnk
Your Welcome.
Really great info, thanks for sharing!
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
@BBEnk looks like a good solution. Do the actors match up pixel perfect and can you upload a test project we can try out? Nothing flash just a couple of blank actors.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
I will pay good money to be able to go over this with you on skype. This video opens my eyes to a better understanding.. But creates questions. Ill pay to be able to pick your brain about this video on skype.
@colander @FINNBOGG
I will make a template and upload, and ask any question.
OK I made a template it's very basic but shows what I'm using to make my game work.
@FINNBOGG said:
If you have any question please ask, it's really very simple just seems not, and my help is free.
I had a play with the template. I added some more HUD actors and a couple of building actors joined to the pixel to better judge the results. It changes the layout quite a bit. The scene to the right grows while the scene on the left stays the same. If the code in the clouds were placed in the buildings to position them better they would come apart.
Like Overscan there is less screen real estate in iPad than there is in iPhone. The background has to be quite a bit larger too for it to fit the iPhone. This would be good for a side scroller as opposed to an Overscan from an iPhone 6 back to iPad. You would need to go back to iPad in Overscan so you could keep the top and bottom of the scene.
I have attached your project with an Overscan method in it. The only actors that need code are the HUD actors. This method looses scene real estate from the top and bottom and anything not on the background in these areas would be lost or need the code in it to bring it back on screen.
I think this just proves it is project dependent as to which method you choose Stretch or Overscan. I spent time working out this Overscan method for a vertical scroller I am updating and it works perfectly starting in iPad. A new game I started before this is a side scroller so I started in 720p HD which is the widest landscape aspect and overscaned back to iPad so I could keep the top and bottom of the scene.
If I do another side scroller I will look at using this method. I am interested to see what @pHghost comes up with in his thread. Thanks for posting this I love looking at new ways to do stuff.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
@colander said:
not really because you could just have a change attribute that says "change positionX to positionX + offset or offset/2" and they would move same distance. or not move them at all. I only put the rule to show what can be done.
also If you look at my video the only actors that are changing there position is the HUD from 512 over,and the background sky thats it.
All I'm doing is scaling the camera up so it has the same aspect ratio of device it's being run on for instance iPhone5 1136x640 goes to 1363.2x768 and this is were my offset attribute comes in and set it at 339 thats 1363-1024. so you get 339 more pixels on right for iPhone4 128 pixels and so on.
for all iPhones to fit needs to be 1366x768 or if you have nothing more then blue sky have a rule that makes it longer.
I really don't like overscan because you have to move ever actor up,down,left, and right to make it work and then it looks zoomed in.
I don't think its project dependent at all, I have 3 games that use this one is a plate former "see above" one is a Flappy Clone and another is a Pool like game.
And this is way people should read the forums, I've learned a ton on here over the last 3 years.
>
Have you checked out the videos and templates I posted?
0.9 is scaled, similar to what BBEnk is doing here, 0.95 is unscaled, great for pixel-perfect rendition.
If you check them out and write what specific issues you have with them, I will take your commentary on board and attempt to make a version that will tackle your needs.
@pHghost I was waiting for you to post v1.0 then have a look thinking that would be complete.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
@colander
What exactly is the issue your concerned about, my game Steam Jack is a side-scrolling plate-former that also has a vertical level and a endless runner type game and a flappy bird game built sideways so it plays in portrait. If I can get all that to work I would love to no what your issue is,lol.
@colander -- I see. If you send me comments before 1.0, I could try and make sure it will do what you need. But if you want to wait, that's fine as well, though 1.0 might not be ready before Monday or Tuesday.
It sounds like you are taking it personally I am just saying what I observed. In a NON scrolling game I can achieve what you have done much easier by overscanning from iPhone back to iPad like I did in my game Shooting Food. The only code needed is in the HUD actors it is not needed in anything else. Both these methods have dead space which needs to be filled.
I the attached images the ground and sky actors are reduced to the width of the iPad screen 1024 to show what I mean. In a non scrolling game I would have to put rules in the building and cloud actors to centre them and create larger sky and ground actors (Like you have) to fill the dead space. In design mode I wouldn't be able to see the edges of these adding some more difficulty to it. If I had a bunch of small actors to go there like in my game it would be really difficult and not practical. The HUD actors are not spaced correctly changing the look of the game and would need code to move them.
I think your method is good for a side scroller and next time I make one I will definitely be looking at it in more detail. For non scrolling games it doesn't look like a good solution compared to Overscan particularly when designing because Creator doesn't let you see much more than 40 or so pixels off the screen. In Overscan can I just start with the wider screen and work back and see the whole scene.
There is no magic bullet for UB's as developers we need to consider it before we start developing. Pick the best method to suit the style of game we are making and design our game with that method in mind.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
@colander
No not personal at all,lol I'm just curious thats all.
Also using any of the methods shown you can also just set the camera origin to -128 or ? and this will keep your game centered but just have to set all layers to movable.
see template below for that if interested.
I have added that to the project I modified see the first image. In the second one I turned off the rule in the Sky, Ground and Jump button. This is starting to look a lot like the Overscan method. You now need a larger Sky and Ground actors and code in the HUD buttons to reposition them. If it is possible to do this the other way from iPhone 6 Plus/720p HD back to iPad you would be able to see the whole scene in Creator when you are working on it. This may not work for a few reasons, if it does then the result would be exactly the same as the Overscan method I use. Just a matter of picking the one you are most comfortable with.
Using my method in Overscan I can use the same code setup in all game types i.e. non scrolling, vertical and horizontal scrollers going from iPad to widescreen or from widescreen to iPad in portrait or landscape. The code usually is only required in the HUD actors but sometimes a couple of the background actors will require it too. Like all other methods it is not perfect when designing my apps I still have to keep in mind how it will look in other aspect ratios.
Anyway thanks for sharing I will come back to it in the future and have another look at it in my next game and any future changes you might make.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
Heres the template above with a scrolling level select, also I made a change to my attributes I set them up a bit different not a big change.
This one shows why I have a sceneMin and sceneMax along with offset, but really sceneMin and offset can be used for same thing for me was just easier to keep track of whats doing what.
and there might be a better way of doing things but I'm working all this out with my GED math education,lol.
remember to select stretch and reset scene when you change device when testing.
Hopefully you will find useful.
@BBEnk Could this method be adapted to a project that was started in iPhone 5 format?
@beefy_clyro
Yes you can.
Just need to change two values, the Display size from iPad to iPhone5 see picture. and I made a quick example for iP5 for anyone to see.
and I haven't tested other builds but same thing should work with those. just change values in picture to your build size and give it a shot, the math is the same.
@BBEnk thanks, that's what I thought. Tried it on the original demo and seemed to work, tried it on my own project and couldn't get it working! After selecting stretch and resetting, it just stayed stretched!!!
@beefy_clyro -- feel free to try my method as well, no need to set up attributes, simply copy-paste rules and select method you want yo use:
http://forums.gamesalad.com/discussion/72604/universal-build-flexible-aspect-ratio-stretch-trick-with-video-and-template#latest
@beefy_clyro said:
Not sure why it would not work, the demo controls it all fine just tested again.
Remember:
Offset - I use to move Hud actors to correct position. (mostly actors to the right of center).
sceneMin - I use this to center backgrounds actors (Sky,Ground,ETC).
If you don't use these in the actors they will stay in same position.
iPhone 5 original size build.
iPhone 4 using stretch and offset + sceneMin note clouds have no offset rule so they don't move.
iPhone 4 no offset and background/ground is actually 1400 px wide so still fits, but right control is now off screen at original iP5 build position.
Thanks for replies guys, will try the methods again tomorrow
made a portrait version pretty much same thing but because the camera only gets bigger upwards I only need to use offset in the score so it can stay out of the way. would do the same thing with Pause and Home button.
how would you use this system if you were starting off with iPad (resolution independence) setting?
no difference.
Hi @BBEnk and @pHghost I have tried both of your methods and sadly none work for me!
My game is on one scene and every actor per level has its positions set by tables.
Issue with pHghost's .. Although it scales nicely, it doesn't keep things in 'original' positions, so you lose screen estate.
Issue with BBEnk's is that due to the offset and the need to apply this. Actors won't always be in fixed position, as i mentioned above, its all on one scene and per level an actor could be anywhere on that scene as a starting position!
Hmmm I need to have a rethink!
@beefy_clyro said:
My game "Bump'n Balls" is a one Scene and uses tables and all I did was add "offset" to the end of the rule that gets the table positions.
Like so.
Do you have Skype?