worldofbalance / unity-game-client

Unity Client for World of Balance
http://smurf.sfsu.edu/~wob/
9 stars 8 forks source link

Can we all decide on an aspect ratio? #8

Closed brianxautumn closed 8 years ago

brianxautumn commented 8 years ago

Hey guys, having some trouble matching the game area to different window sizes. Would it be better if we set the aspect ratio to a fixed 16:9 or something like that so that we wont have to deal with all sorts of resizing issues?

Thanks

jensvdh commented 8 years ago

Wouldn't we handle aspect ratio by having the UI use anchors?

I think most phones are 16:9 or 16:10. I guess covering both aspect ratios would cover most of the stuff.

@dule-hwp might be the guy to answer that.

dule-hwp commented 8 years ago

We should be able to deal with different aspect rations using anchors as Jens mentioned. Feel free to post some screenshots, so we can discuss your specific problem and concerns.

brianxautumn commented 8 years ago

Yeah but what I'm saying is that there will be different amounts of the actual game shown depending on the size of the window.

http://v-play.net/doc/vplay-different-screen-sizes/

jensvdh commented 8 years ago

A common strategy used to deal with this in Video/TV content and videogames is by making sure your UI fits in the 4:3 aspect ratio. If it fits in 4:3 then it will , as a result also fit in 16:9 and 16:10. There will be some space on the sides, but for UI that is fine.

See: https://www.roguevector.com/wp-content/uploads/2014/05/Aspect-Ratios.png

I'm not sure if anyone actually has a 4:3 phone in landscape? I think supporting 16:9 and centering that within a 16:10 would suffice.

dule-hwp commented 8 years ago

Ok, i get what you are saying. Now the problem with this is that you would have to truncate extra content (we don't wanna do that) or add some extra fill space. Using 9patch is another option (not always useful, usually used for buttons and simple graphics), i know unity has something similar to this. Depends on specific problem, and the screen you want to render.

The way you deal with problem shown on link you posted on android is by providing different size resources to match different densities and aspect ratios (using buckets in android development). I guess there is something similar that Unity uses. I ll try to find something and get back with answer.

Again, sharing a screen would be helpful.

brianxautumn commented 8 years ago

I think Im going to go with making the background big enough, then try to automate the left/right camera bounds to fit around the actual play area depending on the aspect ratio.

Also, do we have to handle situations when the user turns their phone from landscape to portrait, or will it just be locked in landscape?

I'll try to get the camera script working in a bit so I can post a screen shot

jensvdh commented 8 years ago

We decided on locking the orientation to landscape for mobile.

brianxautumn commented 8 years ago

Okay so I resorted to making the scene use 3d cubes, then use the viewport to calculate scales and move stuff around so that it always fits. So far I got the background to fit. One of my team members is still tweaking the game board. The UI is from last semester.

screen shot 2016-03-23 at 10 51 33 pm
dule-hwp commented 8 years ago

I don't think that you will have too much problem with UI elements. All animals buttons in one pane anchored to top and middle and for plants middle left. On the containing Canvas scale with screen size, play with resolution and match parameter a bit and that should look ok on different aspect ratios.

My concern here is game board, because you cannot just add content as for the background, and i guess you cannot draw the table on canvas and use scaling options (i think this is not an option for you, because you need to add gameObjects on board). Size is fixed 9x5, so maybe calculating remaining space(both horizontally and vertically) in Awake method (ui elements should have its sizes scaled here), and based on that changing square size of the board. This way you could position board where you want. This is just me thinking out loud, maybe there is better way.

danamuise commented 8 years ago

did we arrive at a concensus on ratio? For now, we are going to set the lobby to 16:9 landscape only

jensvdh commented 8 years ago

16:9 is good. But test in 16:10 as well. Everything 16:9 is pretty much compatible with 16:10

jensvdh commented 8 years ago

as @dule-hwp said. Use UI elements and anchors. See wiki.