Getting Started with Screen Sizes in Godot 3

Поділитися
Вставка
  • Опубліковано 19 жов 2024
  • Make your Godot 3 game adapt to different screen sizes with this tutorial! It's Guilherme's first video on the channel.
    He made a Godot course for beginners on Udemy: bit.ly/guis-god...
    ----
    LINKS
    Godot 3 project on GitHub: bit.ly/screen-s...
    Godot 3 course: gdquest.mavens...
    This video is supported by:
    Gamblify: www.gamblify.com/
    Pineapple Works: pineapple.works/
    Echo86: www.echo86.com/
    Subscribe for more tutorials! ua-cam.com/users/c...
    Twitter ► / nathangdquest
    Instagram ► / prepare
    This video is licensed under the CC-By 4.0 license: creativecommon...
    You can attribute it to "GDQuest and contributors - www.gdquest.com/"

КОМЕНТАРІ • 77

  • @Gdquest
    @Gdquest  6 років тому +71

    It's Guilherme's first time on the channel. What do you think? He's really open to feedback so he'll be glad to see your replies. And please ask any questions you may have about this topic!
    He also has a Godot course on Udemy, made for beginners: bit.ly/guis-godot-course
    Regarding screen sizes now. For one it's an issue we all face as game developers as not only mobile, but computer and TV displays come in different shapes and sizes. Your game and UI doesn't need to scale in realtime like a responsive website, but it does need to adapt to different screens. This means that different players will have a slightly different view of the game. It's important to keep in mind when you create cut-scenes or design challenges as someone with a wider screen might see something they shouldn't.
    If you're looking for a rule of thumb to pick the right project settings, you can give the 2d mode and expand aspect ratio a try. Expand will smartly expand on the axis that stretches past the game's base aspect ratio. The one that goes with its resolution.

  • @lukostello
    @lukostello 4 роки тому +26

    I'm so glad I watched this, I might not have ever looked in the project settings and tried to effectively implement the 2d stretch mode using code for my control nodes

  • @evanhardin
    @evanhardin 6 років тому +44

    This video was super useful. Thanks!

  • @AntonioMarcodaSilva_antomarsi
    @AntonioMarcodaSilva_antomarsi 6 років тому +116

    Wow, a Brazilian, nice

  • @Bright-Fall
    @Bright-Fall 9 місяців тому

    BRAVO! I am so happy this fixed my games fullscreen issue you are a hero of the people gentlemen

  • @Sfr047
    @Sfr047 Рік тому

    I thought about how to do it for 3 days and you helped me even though this video is old, but it helped me thanks! :)

  • @nomoremuda
    @nomoremuda 2 роки тому

    Best explanation of this I’ve seen

  • @business2024-c9m
    @business2024-c9m 5 місяців тому

    Thank you so much..this video was really helpful

  • @user-mk6lc2tv8u
    @user-mk6lc2tv8u 7 днів тому

    thank you this fixed all my problems (i'm a beginner)

  • @laurencebannister
    @laurencebannister 6 років тому +4

    Thank you so much for this. Loved it!

  • @Blodyx_
    @Blodyx_ 2 роки тому

    This is exactly what i needed, thank you!

  • @dheatlyblaze2846
    @dheatlyblaze2846 Рік тому

    This is very helpful! Thank you!

  • @GoodCraftingYT
    @GoodCraftingYT 4 роки тому

    THANK YOU SO MUCH!!! YOU HAVE NO IDEA HOW MUCH YOU HELPED ME!

  • @antanaspaskauskas9432
    @antanaspaskauskas9432 6 років тому +7

    Do you know what does option Shrink actually do? Does it reduce internal / rendered resolution or output displayed resolution?

  • @Lu_Ciel.
    @Lu_Ciel. 4 роки тому +2

    Hello. Is it possible to force Godot to only scale the window based on integer steps? eg: i have a window with width = 480 pixels, so, the next allowed size is width = 960 pixels? Thank you

  • @zanyman
    @zanyman 3 роки тому

    THANKS FOR SOLVING MY PROBLEM

  • @Chevifier
    @Chevifier 3 роки тому +6

    Best bet is to target 16:9. Aspect ratio and set it to keep

  • @fernandev7879
    @fernandev7879 2 роки тому

    top guilhermão!

  • @Rin-qj7zt
    @Rin-qj7zt 2 роки тому +2

    i don't understand. my game isn't doing this. it's squishing and squashing text into unreadability when scaled. buttons become unreasonably thin, and i can't figure out how to force them to remain constant like your buttons do.

  • @thomaswmedeiros9906
    @thomaswmedeiros9906 2 роки тому

    Omg, thank you so much

  • @Zen-rw2fz
    @Zen-rw2fz 5 років тому +4

    you two are different persons? I thought you were just nathan with a younger voice in your older videos

  • @kolts2026
    @kolts2026 Рік тому

    thanks it worked

  • @tonywithani
    @tonywithani 5 років тому

    Nice tut. Really helpful.

  • @brucelee7782
    @brucelee7782 9 місяців тому

    Should we just design in a 1920x1080 window size so that it looks good for smaller screen sizes? There's too many options it's confusing

  • @helkat9876
    @helkat9876 5 років тому +4

    i have a question, i am making a game that allows player to turn on full screen mode, but it should allow to turn it off too. and here is the problem , i can't write a code that turns off full screen, can u help me?

    • @dynomitediamond6296
      @dynomitediamond6296 4 роки тому +1

      Running "OS.window_fullscreen = !OS.window_fullscreen" allows you to toggle fullscreen. To turn it off, try OS.window_fullscreen = false

  • @thecringeybatboy491
    @thecringeybatboy491 3 роки тому

    thx this helped alot

  • @auto-fav8969
    @auto-fav8969 2 роки тому

    thanks great

  •  3 роки тому

    thanks

  • @muhammedemiraysan
    @muhammedemiraysan 3 роки тому

    thx bro

  • @joeyallard
    @joeyallard 6 років тому

    Very helpful video!
    Thank you :)

  • @Arkl1te
    @Arkl1te 3 роки тому +1

    Note to myself:
    Mode -> 2d
    Aspect -> keep

  • @user-js7ud9du2y
    @user-js7ud9du2y 2 роки тому

    unity lacks this black bar feature. though i think the resizable screen should have draggable corners instead

  • @raventhorX
    @raventhorX 6 років тому +1

    But what if you wanted to adjust the viewport size? I am using a tilemap and everything looks to small for what I want it to be for my start screen, however I can't adjust the size of everything in one go and would have to go back through the tilemap to re adjust it's size, a simple fix to this for me is zooming the view in a bit to make everything appear bigger and the only way I can think of to do this is to reduce the size of the viewport but idk how.

  • @cyberground.
    @cyberground. 6 років тому

    Thanks, that help me for a GameJam ;)

  • @dredan88
    @dredan88 Рік тому

    BRASIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIILLLLLLL

  • @mamaeluigi2532
    @mamaeluigi2532 4 роки тому +1

    BRASIL CAMPEÃO DO MUNDO!

  • @bitmammothOG
    @bitmammothOG 4 роки тому

    Thank You :)

  • @jrumiak
    @jrumiak 6 років тому +26

    Sadly I must say that I'm a bit disappointed...
    A couple of points to work on:
    - Slow down. Please :)
    - Do not show only the API. It's meant as a tutorial. Tell me more about why and when I should use it.
    - Switching to Viewport makes things more pixelated... alright... but why? Please explain. It's described better even in original docs: docs.godotengine.org/en/3.0/tutorials/viewports/multiple_resolutions.html#doc-multiple-resolutions
    - Stretch modes - more or less the same as above. Slow down, explain, add meaningful examples.
    - Expand mode - if something is "tricky" to use, this is probably the part you should focus on more instead of rushing thrue it. Also don't say "you don't know what is going to happen". You are making this video exactly for this propose - to tell me what is going to happen. Again, it is described in the docs.
    - What happened to "Shrink" option? Why it's left out?
    Overall: Good start. Keep up good work but there is still room for improvement.
    Take a look at this: ua-cam.com/play/PLXkVsacazW2qvdnKNzgBLkUwlgi3FU-VO.html

    • @Gdquest
      @Gdquest  6 років тому +5

      Agreed, thanks much for the constructive feedback! I gave a lot to Guilherme already, sent him your comment as well. He has a great attitude so you should see his content improve quickly :)

  • @MrTomas7777
    @MrTomas7777 4 роки тому +2

    What if I want "expand" aspect mode but expanding to both sides instead of anchoring the viewport to top-left?

    • @PROJECTJoza100
      @PROJECTJoza100 4 роки тому

      This is exactly what i need and ive been looking for it for hours... Have you found the solution to share?

    • @MrTomas7777
      @MrTomas7777 4 роки тому

      PROJECT: Joza100 Nope... :/

    • @PROJECTJoza100
      @PROJECTJoza100 4 роки тому +2

      @@MrTomas7777 i figured it out. I posed on reddit but then fogured it out and the solution is in the comments.
      www.reddit.com/r/godot/comments/f39u4w/how_to_use_keep_height_and_show_more_of_left_and/?

    • @MrTomas7777
      @MrTomas7777 4 роки тому

      Oh nice, thanks 👍

  • @doniyorkoshimbetov3729
    @doniyorkoshimbetov3729 4 роки тому +2

    I cant see the difference between 2d and viewport. Can anybody explain, pleasae

    • @IndividualFreedomNet
      @IndividualFreedomNet 4 роки тому +3

      It confused me too in the beginning and it is not very well explained here. Both deal differently with the original resolution as defined in the project settings in relation to the resolution of the game running on the actual device. For my explanation let's assume you define a base resolution of 960 x 640 in the project settings (the native resolution of an iPhone 4S for example). Then you run it on that iPhone 4S, a Samsung S7 at 2560 x 1440 and on a PC/Mac desktop running at fullscreen in full HD 1920 x 1080. Let's also assume the game is a 2D game and mainly has several 2D graphics displaying sprites and such, but also draws a HUD on top of it with text and some "vector graphics" like diagonal lines. Now what happens is as follows:
      "Viewport" renders the game internally at exactly the resolution which you define in the settings (for everything: graphics, text and vector drawing) and then stretches the result to the target resolutions. On the 4S it will look exactly as designed in all aspects (no stretching happens). Both on the S7 and on the desktop versions the 960 x 640 will be scaled up to 2560 x 1440 and 1920 x 1080 respectively. Everything will look scaled up equally, the graphics will probably look good, but the text and vector drawings will probably look a bit uglier than they could and blurry along the edges.
      "2D" on the other hand, renders your game at the target resolution of the device internally - and NOT what you set in the project settings (but the aspect ratio will be kept if you chose the according setting). So for the 4S there will be no difference at all to "Viewport" - every single pixel will be identical. But for the other devices it renders into a much larger viewport: 2560 x 1440 for the S7 and 1920 x 1080 for the desktop versions. The scaled up sprites and background graphics will probably look the same like with "Viewport", but the text and vector graphics output will be drawn at the higher resolution directly and look much sharper and less blurry with "2D". The larger the difference between the base resolution and the target resolution is, the more you will see the difference.
      In conclusion, generally "2D" is the better choice for most use cases as the result of graphics/sprites are pretty much the same in both cases, but text and vector drawings look a lot better with "2D".
      But "2D" also needs more performance to be drawn, so "Viewport" sometimes might be a performance related choice. If you have a "pixel look" game (which you want to use for text/drawing too), you might prefer "Viewport" for aesthetic reasons.
      PS: Note that if a target device has a smaller resolution than what you define in the project settings, "Viewport" will need more performance and actually scale down. "2D" on the other hand will draw to that smaller resolution directly. (But this is probably a rare case unless you design your game in a kind of "middle resolution"...) Probably my explanation would have been more precise (but also more confusing) if I chose a "middle resolution" (full HD) as the base and made an example with a smaller (4S) and one with a larger resolution (S7). But I hope you get this idea... :-)

    • @doniyorkoshimbetov3729
      @doniyorkoshimbetov3729 4 роки тому +1

      @@IndividualFreedomNet Thank you a lot. Now I understand

  • @Hana_UwU
    @Hana_UwU 3 роки тому

    nice

  • @shinobiinu6920
    @shinobiinu6920 5 років тому

    Hello! Does this method make games also mobile optimized automatically?

    • @tuxuni2587
      @tuxuni2587 5 років тому

      Theoretically yes, it does.

  • @marcelogamer2156
    @marcelogamer2156 4 роки тому

    Eaí Guilherme! Bora Brasil!!!

  • @rsensato
    @rsensato 6 років тому +1

    Massa!

  • @matthewnewsom5225
    @matthewnewsom5225 6 років тому

    So I want to create a 64x64 pixel game, so that's the widht/height set in project setttings. But that means the game window is hellllla small. I can enable stretching so the user can make it bigger, but how can I actually set the default window size to something bigger than 64 pixels?

    • @Gdquest
      @Gdquest  6 років тому

      There should be some function in the OS class. Also for testing check the 'test resolution' project settings

    • @channelnumber52
      @channelnumber52 6 років тому +1

      You don't want a 64 x 64 pixel game. You want to create a screen with a height and width of 64 units. Each unit will be multiple pixels. I'm much more familiar with how to do this in LibGDX, not Godot, so I can't tell you how to achieve this. Try creating a tilemap that is 64 by 64, and then configure your camera to fit that tilemap on screen properly, then boom, you've got your camera set to a 64x64 world.

  • @oito20
    @oito20 6 років тому +8

    Eu queria que a godot tivesse uma comunidade brasileira como tem a unity. Vejo que muita gente tá passando a usar ela, porém é muito mais difícil tirar dúvidas.

    • @somarandtheastronautape6518
      @somarandtheastronautape6518 5 років тому +3

      Sei que posso parecer ignorante, mas inglês no mundo de desenvolvimento de jogos é o mínimo que você pode aprender. Depois, o Discord do Godot é extremamente útil, tem diversas pessoas lá, inclusive o próprio GDquest está sempre lá tirando a dúvida de todos. Desde que comecei a usar o Godot(e sou muito amador ainda) tiro todas as minhas dúvidas lá. E já estou próximo de terminar meu primeiro projeto.

  • @twl148
    @twl148 5 років тому +1

    thank you kanYE

  • @ТигранЕпремян-й4с
    @ТигранЕпремян-й4с 3 роки тому

    what code in TouchBu..??

  • @peeleandro
    @peeleandro 3 роки тому +2

    Brasileiro ?????? TOP

  • @WolfsDenShop
    @WolfsDenShop 4 роки тому +5

    You have to slow down a little, you're like a 'Machine Gun.' Your accent's nice, so don't worry about that.

  • @srlilith7167
    @srlilith7167 3 роки тому

    ta na cara que é BR kkkk, mas ótimo vídeo, vlw adorei seu inglês

  • @forhadrh
    @forhadrh 3 роки тому

    👍

  • @kramgamedev995
    @kramgamedev995 5 років тому +4

    seria interessante se houvesse pelo menos uma legenda em pt parabens pelo video

  • @KidoKatsuragi
    @KidoKatsuragi 4 роки тому +3

    Video was useless. Nothing more than overview of settings without any real use cases.