Пікірлер
@SalisburyAaron
@SalisburyAaron 17 күн бұрын
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 9 күн бұрын
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 8 күн бұрын
@@Monogame-Guy Interesting. Thank you so much.
@GivanioMelo
@GivanioMelo 26 күн бұрын
Thank you for this awesome video!
@Benox-Dev
@Benox-Dev Ай бұрын
thank you soooo much
@GarrethandPipa
@GarrethandPipa Ай бұрын
just change it to a console app and both will show
@QuantumWitchGame
@QuantumWitchGame Ай бұрын
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 Ай бұрын
Thank you for this video!!
@stevphiericardo2790
@stevphiericardo2790 Ай бұрын
this causing negative value on both width and height which making the rendertexture being flipped
@JoeyG-o8r
@JoeyG-o8r 2 ай бұрын
(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 2 ай бұрын
Yes Thanks
@komz69
@komz69 2 ай бұрын
great video! Is this method more performant than RenderTarget2D?
@Monogame-Guy
@Monogame-Guy 22 күн бұрын
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 2 ай бұрын
Oh, so that's why. Thank you!
@emhean
@emhean 2 ай бұрын
Great video! We need more of this!
@cody31
@cody31 2 ай бұрын
Great episode. Thank you.
@cody31
@cody31 2 ай бұрын
This was absolutely clear. Great tutorial. Thank you very much. All the best from Germany.
@CoolModderJaydonX
@CoolModderJaydonX 3 ай бұрын
This is quite handy. Thanks!
@NgocNhiemNguyen-si9fv
@NgocNhiemNguyen-si9fv 3 ай бұрын
Thank you so much!
@IradDoronLearningMusic
@IradDoronLearningMusic 3 ай бұрын
Thank you so much! Great help
@kwyrky
@kwyrky 3 ай бұрын
Thank you for the video, will help me very much getting a good start trying to work using LM22 for MG dev 😊
@binghil5014
@binghil5014 3 ай бұрын
perfect tutorial!
@spaffx
@spaffx 4 ай бұрын
Hey thank you for explaining everything it was very helpful.
@Blorbsnorg
@Blorbsnorg 4 ай бұрын
My terminal isn't working like that, it only gives me errors if I include any spaces, can anyone help?
@JaviepalFordring1
@JaviepalFordring1 4 ай бұрын
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 4 ай бұрын
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 4 ай бұрын
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 4 ай бұрын
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 22 күн бұрын
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 5 ай бұрын
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 5 ай бұрын
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 5 ай бұрын
I am used to full version of Visual Stupid, does VS Code have nuget?
@aristurtledev
@aristurtledev 5 ай бұрын
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 5 ай бұрын
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 5 ай бұрын
The clue I have is that it has to do with the Viewport
@Monogame-Guy
@Monogame-Guy 22 күн бұрын
The ViewPort code is inconsistent across platforms. I suggest creating a _translationMatrix * _screenScaleMatrix and passing that to SpriteBatch.Begin()
@Alejandro-Luna
@Alejandro-Luna 5 ай бұрын
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 5 ай бұрын
Excellent content! I learned a lot.. Thanks! =D
@cyra9544
@cyra9544 5 ай бұрын
Thank you!
@RezDisciple
@RezDisciple 5 ай бұрын
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 6 ай бұрын
Great work, thank you very much!
@Rezm0ni
@Rezm0ni 6 ай бұрын
Thank you so much, mate!
@bradhodge1722
@bradhodge1722 6 ай бұрын
0:40 That cat is looking directly into my soul.
@earlmedina3530
@earlmedina3530 6 ай бұрын
Just want to say the quality of this content is outstanding. Thank you for donating your time to share this information!
@JamCamAbreu
@JamCamAbreu 6 ай бұрын
Good communication, you definitely "got me" with the scale default value of zero.
@isdogru
@isdogru 6 ай бұрын
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 6 ай бұрын
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 7 ай бұрын
Yo this is nice, I just recently used tiledcs + made some of my own logic for maps :)
@Ne1gh_
@Ne1gh_ 7 ай бұрын
Nice and thanks!!
@SuperJerryMouse
@SuperJerryMouse 7 ай бұрын
This is perfect! thank you sir
@kinsondigital
@kinsondigital 7 ай бұрын
Awesome video man!! Informative and clear! Keep it going. I myself want to start doing videos as well on my projects. 😄
@computersciencestudentriverbat
@computersciencestudentriverbat 7 ай бұрын
Came here from the Monogame Discord. Great stuff.
@aristurtledev
@aristurtledev 7 ай бұрын
Thanks
@Gbtx6
@Gbtx6 7 ай бұрын
Great video Aris! Quick question, is this how you basically implement zooming in and out? just making the matrix bigger or smaller or there's something else involved?
@aristurtledev
@aristurtledev 7 ай бұрын
Pretty much. Typically a "Camera" used in a game will create a matrix that you pass in the SpriteBatch.Begin statement. A full camera would create a matrix that does Translation * Rotation * Scale multiplication order, but if you only wanted zoom, then you can just make the scale matrix. However, this is going to create the problem still of the zoom only happening from the top-left position of the zoom. If you wanted to center the zoom you can make the scale matrix and multiply it by a translation matrix to set an origin where the x and y of the translation are the center of the viewport bounds. So something like Matrix centeredZoom = Matrix.CreateScale(zoom) * Matrix.CreateTranslation(new Vector3((int)Viewport.X * 0.5f, (int)Viewport.Y * 0.5f, 0.0f));
@Gbtx6
@Gbtx6 7 ай бұрын
@@aristurtledev ty based Aris!
@wazawoo
@wazawoo 7 ай бұрын
Thanks so much for this video. I’ve been fighting this problem for months. I’m a bit confused though. I was under the impression that you need to multiply pixel art by integer multiples when scaling up, otherwise the pixels won’t actually be square when scaled up. Does this somehow account for that? Or is the result different depending on if you have sized the window to an exact integer multiple of your target resolution vs scaling up by a fraction?
@aristurtledev
@aristurtledev 7 ай бұрын
If you're going for pixel perfection, ideally you would want the screen to only scale in integer values that match your aspect ratio. A common solution when using the scale matrix trick like this is to actually disable window resizing, and have an option in the game to resize the window by 1x, 2x, 3x, etc. Regardless, the pixel perfection is going to mostly come down to your actual draw code. You want the assets drawn at integer values and not float values before any scaling takes place.
@the_hello_world_channel
@the_hello_world_channel 7 ай бұрын
MG🎉