Aristurtle Dev
Aristurtle Dev
  • 18
  • 24 621
Scale Matrix Independent Resolution Rendering in MonoGame #monogame #gamedev
In this tutorial, I discuss how to use a scale matrix to achieve independent screen resolution rendering in your MonoGame game. This is an alternative technique to the RenderTarget2D method in my previous tutorial ua-cam.com/video/Zla4q0Z6Zwc/v-deo.html
Image used in game is from the Pixel Platformer package page from Kenny, licensed under the CC0 license. kenney.nl/assets/pixel-platformer
---
Patreon: patreon.com/aristurtledev
Twitter: aristurtledev
Twitch: twitch.tv/aristurtledev
MonoGame Discord: discord.gg/monogame
---
Timestamps
00:00 Introduction
00:45 What is Independent Screen Resolution Rendering
02:00 Project Setup
04:12 Defining Resolution
06:09 Showing the Problem to Solve
07:24 Add Scale Matrix
07:45 Add Update Matrix Method
08:37 Adding Matrix To SpriteBatch.Begin
09:44 Using A Scale Matrix
11:28 Calculating The Scale Factor
20:20 Updating Scale Matrix When Window Changes
24:50 Centering With Viewport
29:07 Recap
32:50 Ending
Переглядів: 1 766

Відео

Getting Individual Cel Data In AsepriteDotNet #aseprite #dotnet
Переглядів 20310 місяців тому
This is just a quick video to talk about just one of the many things you can do with my AsepriteDotNet library. It isn't limited to just the built in provided parsers. You have access to the full data of the Aseprite file, so you can get image data all the way down to to the individual cel level if you need. The Aseprite file used in this video is from the Animated Pixel Adventurer asset pack b...
Axis Aligned Bounding Box Collision Detection | MonoGame
Переглядів 1,2 тис.10 місяців тому
In this video, we go over how to perform Axis Aligned Bounding Box (AABB) collision detection in MonoGame. Aether.Physics maintained by nKast: github.com/nkast/Aether.Physics2D Patreon: patreon.com/aristurtledev Twitter: aristurtledev Twitch: twitch.tv/aristurtledev MonoGame Discord: discord.gg/monogame Timestamps 00:00 Introduction 00:11 Thanks Patreon Supporters 00:27 Why this vid...
Demystifying the Content Pipeline | MonoGame
Переглядів 1,3 тис.10 місяців тому
In this video, we'll take a dive into the black box known as the Content Pipeline in MonoGame and peek into the internals of how the various parts work in concert to automatically build your content and place it in your project output. Patreon: patreon.com/aristurtledev Twitter: aristurtledev Twitch: twitch.tv/aristurtledev MonoGame Discord: discord.gg/monogame
Visual Studio Extension: CSV Translation Lookup
Переглядів 21111 місяців тому
I recently created a Visual Studio extension in response to a question asked on twitter by Tyler Glaiel. This extension is for game developers that use CSV files to organize localization translations for their games. The extension will parse the keyword tokens from the CSV file, then if you hover over any text within your code files that matches a keyword token, it will display information abou...
MonoGame RenderTarget2D Independent Screen Resolution Rendering
Переглядів 2,9 тис.11 місяців тому
In this tutorial I discuss how to use a RenderTarget2D to achieve independent screen resolution rendering in your MonoGame game. @GameDevQuickie also has a video on using RenderTarget2D for independent screen resolution rendering, be sure to check it out and subscribe over there as well: ua-cam.com/video/lpFCseClnA4/v-deo.html Image used in game is from the Pixel Platformer package page from Ke...
Demo 2
Переглядів 63Рік тому
Another song just messing around with
MonoGame and VSCode Development Environment Setup (2024)
Переглядів 7 тис.Рік тому
A quick video on setting up your development environment to build games using MonoGame and VSCode instead of the full Visual Studio IDE #monogame #vscode #gamedev Reference - dotnet SDK Download dotnet.microsoft.com/en-us/download - VSCode Download: code.visualstudio.com/ Twitter: aristurtledev MonoGame Discord: discord.gg/monogame
Demo 1
Переглядів 90Рік тому
Just a short demo of a new song I've been working on.
I Will Play My Game Beneath The Spin Light Cover
Переглядів 102Рік тому
Me, playing a cover of I Will Play My Game Beneath The Spin Light by Brand New.
Setting Up Nez + MonoGame In VS Code
Переглядів 2,1 тис.Рік тому
MonoGame subreddit user elafito asked if it was possible to setup Nez to work with MonoGame when using VSCode www.reddit.com/r/monogame/comments/18aa97i/is_it_possible_to_make_nez_work_on_vs_code/ In this video, I go through the basic setup steps you would need to get your MonoGame Nez project going inside VS Code. References Nez GitHub: github.com/prime31/Nez MonoGame Discord: discord.gg/monog...
Jitter-free Pixel Art Scaling in MonoGame
Переглядів 1,4 тис.Рік тому
This video is in response to a question asked by a user in the MonoGame subreddit. They were looking for a way to do the Jitter-free pixel art scaling in GoDot from the video by @uheartbeast at ua-cam.com/video/2JbhkZe22bE/v-deo.html but in MonoGame. So here is the video showing it working in MonoGame while I ramble on about it, as I tend to do. You can find the source in the GitHub repo at git...
Unity and Unreal Devs Will Never Believer This one Simple Trick
Переглядів 711Рік тому
How did he do it?
ContentManager Caches Assets For You | MonoGame Short Discussion
Переглядів 792Рік тому
A lot of new users coming into MonoGame look for ways of caching assets that they've loaded in through the ContentManager. What they don't realize is that the ContentManager already caches the assets for you. In this video, I go over a brief discussion about the ContentManager and show in the source code where it does the asset caching for you, and how you can take advantage of this with multip...
MonoGame Content Pipeline Extension Tutorial | Deep Dive | MonoGame 3.8.1.303
Переглядів 1,7 тис.Рік тому
MonoGame Content Pipeline Extension Tutorial | Deep Dive | MonoGame 3.8.1.303
MonoGame Aseprite Update - Tilemap Importing Working
Переглядів 1,4 тис.2 роки тому
MonoGame Aseprite Update - Tilemap Importing Working
It's Snake, But Every 10 Seconds The Food Blocks Become Walls Trailer
Переглядів 1002 роки тому
It's Snake, But Every 10 Seconds The Food Blocks Become Walls Trailer

КОМЕНТАРІ

  • @kordass2519
    @kordass2519 14 днів тому

    Thank you man very much

  • @ВладиславЛудищев
    @ВладиславЛудищев 17 днів тому

    It's very beautiful. Inspires me to live another sunny day

  • @broomybroomybroomy
    @broomybroomybroomy Місяць тому

    Dude you are the MAN. Thank you so much... this would have taken me forever.

  • @Unavailable8923
    @Unavailable8923 Місяць тому

    Good stuff!

  • @LinearAnimatrix3253
    @LinearAnimatrix3253 Місяць тому

    Super helpful thanks

  • @SalisburyAaron
    @SalisburyAaron 3 місяці тому

    I've noticed that while using this technique; when the scale is something other than one, passing a layer depth of anything besides zero to the Draw method prevents the texture from being drawn. Would anyone know how to advance on this independent resolution technique by honoring layer depths?

    • @Monogame-Guy
      @Monogame-Guy 3 місяці тому

      Layer Depths are hard-coded to values between 0 and 1. Simply scale your Z value to fit this range using Z / max(Z). The Z scale is the .M33 value in the scaling matrix.

    • @SalisburyAaron
      @SalisburyAaron 3 місяці тому

      @@Monogame-Guy Interesting. Thank you so much.

  • @GivanioMelo
    @GivanioMelo 3 місяці тому

    Thank you for this awesome video!

  • @Benox-Dev
    @Benox-Dev 3 місяці тому

    thank you soooo much

  • @GarrethandPipa
    @GarrethandPipa 3 місяці тому

    just change it to a console app and both will show

  • @QuantumWitchGame
    @QuantumWitchGame 4 місяці тому

    Thank you! Finishing off my scene managemant and wondered why I was losing everything when going to a new location in the game... needed a scene specific content manager!

  • @KayhenHD
    @KayhenHD 4 місяці тому

    Thank you for this video!!

  • @stevphiericardo2790
    @stevphiericardo2790 4 місяці тому

    this causing negative value on both width and height which making the rendertexture being flipped

  • @JoeyG-o8r
    @JoeyG-o8r 4 місяці тому

    (Found this video on reddit). God bless you brother, this was something I've implemented using a different tutorial but never understood what I was doing. Now I fully understand every line of code and it doesn't feel like a black box. Thank you!

  • @beziic
    @beziic 5 місяців тому

    Yes Thanks

  • @komz69
    @komz69 5 місяців тому

    great video! Is this method more performant than RenderTarget2D?

    • @Monogame-Guy
      @Monogame-Guy 3 місяці тому

      Yes. Other than the recalculations performed on changes, the matrix multiplies and memory utilization is the same as the default matrix, and it does not require the round trip to the video card providing almost double the unbounded FPS (based on the CPU/Memory to GPU bottleneck, VSync is still an issue) when compared to RenderTarget2D.

  • @emhean
    @emhean 5 місяців тому

    Oh, so that's why. Thank you!

  • @emhean
    @emhean 5 місяців тому

    Great video! We need more of this!

  • @cody31
    @cody31 5 місяців тому

    Great episode. Thank you.

  • @cody31
    @cody31 5 місяців тому

    This was absolutely clear. Great tutorial. Thank you very much. All the best from Germany.

  • @CoolModderJaydonX
    @CoolModderJaydonX 5 місяців тому

    This is quite handy. Thanks!

  • @NgocNhiemNguyen-si9fv
    @NgocNhiemNguyen-si9fv 6 місяців тому

    Thank you so much!

  • @CraftiroIL
    @CraftiroIL 6 місяців тому

    Thank you so much! Great help

  • @kwyrky
    @kwyrky 6 місяців тому

    Thank you for the video, will help me very much getting a good start trying to work using LM22 for MG dev 😊

  • @binghil5014
    @binghil5014 6 місяців тому

    perfect tutorial!

  • @spaffx
    @spaffx 6 місяців тому

    Hey thank you for explaining everything it was very helpful.

  • @Blorbsnorg
    @Blorbsnorg 6 місяців тому

    My terminal isn't working like that, it only gives me errors if I include any spaces, can anyone help?

  • @JaviepalFordring1
    @JaviepalFordring1 6 місяців тому

    First of all, I love your videos, I used you method of Scaling using matrix and changing the transformMatrix on the SpriteBatch Begin, I like it a lot, it do its work on a very simple way, at first look that way, then I try to implement nkast Aether.Physics2D physics engine and when trying to draw the debug shapes using its Diagnostic tool, pass the matrix to the debugRenderer but shapes were weirdly render (ovals instead of circles etc...) and they lost position if I move my custom camera (that was working fine to move the character), I was trying to find a solution for 2 days and it was difficult but find a way to render the debug lines fine, finally I end up creating an independent orthographic projection and then calculate aspect ratio for both width and height, sum those by 1 before creating the orthographic matrix and then I created a Scale Matrix and use a magic number, I don't like it but it worked fine 2 magic numbers for that matter, now the debug shapes render fine, here is that code Vector2 aspect = new Vector2((float)game.viewport._virtualWidth / (float)game.viewport._virtualHeight, (float)game.viewport._virtualHeight / (float)game.viewport._virtualWidth); Matrix _viewMatrix = Matrix.CreateOrthographic(aspect.X+1f, aspect.Y+1f, 0f, 30f); Matrix translation = Matrix.CreateTranslation(-player._playerBody.Position.X, 0, 0); Matrix Zoom = Matrix.CreateScale(1.34f * camera.getZoom()); _debugView.RenderDebugData(_viewMatrix * Zoom, translation); I added my camera zoom on the scale so it considers the camera zoom, all working fine, do you know another way to do it?, do you think it was a good way to solve it? can you do it with out creating a new matrix and 2 magic numbers?

  • @MichaelHoffmannG
    @MichaelHoffmannG 7 місяців тому

    Thanks for making this. I've been diving into MonoGame after using XNA a ton about 10 years ago, and there's a dearth of good video tutorials that are up to date and not just about how XNA used to be.

  • @DonYurik
    @DonYurik 7 місяців тому

    Thanks a lot for all these videos, they are really helpful. The thing I cannot figure out at the moment about this tutorial is how to load content from any other class that is not Game1. Im working on a sort of engine, and I already have a class that is supposed to handle the loading of level data. But I cannot read the Content class inside Game1 from any other place. I was wondering how an example of that would work. Thanks again

  • @halocrash7994
    @halocrash7994 7 місяців тому

    I did this and it resize perfect, the only issue is the mouse input goes offset. Any idea on how to solve it? (Im new with MonoGame)

    • @Monogame-Guy
      @Monogame-Guy 3 місяці тому

      Create a another class variable: Matrix _screenScaleMatrixInverse; Set _screenScaleMatrixInverse = Matrix.Invert(_screenScaleMatrix); in UpdateScreenScaleMatrix() after the matrix is updated. The mouse position Vector2 is _mousePosition = Vector2.Transform(new Vector2(_ms.X,_ms.Y),_screenScaleMatrixInverse); Where _ms is the current MouseState. You may need to Add the centering adjustments from the viewport(may depend on the platform).

  • @real_rulebot
    @real_rulebot 7 місяців тому

    Hi, thanks for sharing your knowledge in such an understandable and detailed way! I came back to XNA/MonoGame after many years. Back then, the Content Pipeline actually was some kind of occult knowledge that books and forums weren't able to properly teach about this topic. The video title actually does what its title says. Especially the red border that you drew in your diagram helped a lot! Thanks again! This content is very appreciated!

  • @rc3043
    @rc3043 7 місяців тому

    Very nice video! I had to do something differently though otherwise it was not building the content folder correctly <ItemGroup> <None Include=".\Content\**" CopyToOutputDirectory="PreserveNewest" /> </ItemGroup>

  • @Adamthegeek70
    @Adamthegeek70 8 місяців тому

    I am used to full version of Visual Stupid, does VS Code have nuget?

    • @aristurtledev
      @aristurtledev 8 місяців тому

      It doesn't have a NuGet Manager window like Visual Studio has. Instead you use the cli to add packages. Just open a terminal/command prompt in the directory that your .csproj is in and use the command dotnet add package NameOfPackage and it will add the NuGet Package

  • @FRomeDev
    @FRomeDev 8 місяців тому

    I'm having a problem, when I do everything the button rectangles in my game change to a higher place than where the button texture is, any ideas what it could be and how to fix it? I am new to developing video games and also using MonoGame

    • @FRomeDev
      @FRomeDev 8 місяців тому

      The clue I have is that it has to do with the Viewport

    • @Monogame-Guy
      @Monogame-Guy 3 місяці тому

      The ViewPort code is inconsistent across platforms. I suggest creating a _translationMatrix * _screenScaleMatrix and passing that to SpriteBatch.Begin()

  • @Alejandro-Luna
    @Alejandro-Luna 8 місяців тому

    Thanks so much. I was trying to understand it myself but I was having a hard time to really nail it. This videos was a great help to verify my understanding of it, and to clarify parts I just didnt get at all.

  • @vocebotafe
    @vocebotafe 8 місяців тому

    Excellent content! I learned a lot.. Thanks! =D

  • @cyra9544
    @cyra9544 8 місяців тому

    Thank you!

  • @RezDisciple
    @RezDisciple 8 місяців тому

    I'm struggling to understand how adding the resizing boolean is keeping CalculateRenderDestination from being called repeatedly if its being set from true to false within the same block. Could you please explain this?

  • @Rafloka
    @Rafloka 8 місяців тому

    Great work, thank you very much!

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

    Thank you so much, mate!

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

    0:40 That cat is looking directly into my soul.

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

    Just want to say the quality of this content is outstanding. Thank you for donating your time to share this information!

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

    Good communication, you definitely "got me" with the scale default value of zero.

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

    Is there any point trying to run the monogame content builder on a mac M1? Trying to get some doc or tutorial of some kind and its kind of dead! Besides the fact that mgcb is not ready for M1 with .NET8

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

      It's a hassle for sure on an M1/M2, and even with current known workarounds in the community they don't resolve 100% of the issue. I can't say for sure when 3.8.2 is gonna drop, but I and others are doing work to resolve the M1/M2 issues for mgcb on Mac. You can follow this issue to stay up to date github.com/MonoGame/MonoGame/issues/8124

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

    Yo this is nice, I just recently used tiledcs + made some of my own logic for maps :)

  • @Ne1gh_
    @Ne1gh_ 10 місяців тому

    Nice and thanks!!

  • @SuperJerryMouse
    @SuperJerryMouse 10 місяців тому

    This is perfect! thank you sir