Miles & Kilo is out now on Steam! It's a tough retro platformer I developed using MonoGame.

Nice art style!
How did you handle “rotated pixels”? Do you have a shader or something?
When I have made games with pixel art, they lose the “pixel look” when I rotate them, but it only happens when the assets or screen are scaled up.

1 Like

Thanks everyone!

@Maybeking Hooray! Glad it’s working for you now. :slight_smile:

@Lufuki Thank you. :slight_smile: No fancy shaders – I render the game’s graphics at 1:1 scale to a small RenderTarget2D, then scale that up and render it to the screen. Here’s an example:

protected override void Draw(GameTime gameTime)
    // Render the game to a small texture first

    GraphicsDevice.DepthStencilState = new DepthStencilState() { DepthBufferEnable = true };

    spriteBatch.Begin(samplerState: SamplerState.PointClamp, blendState: BlendState.NonPremultiplied);
    // Draw the game's graphics with the spriteBatch here


    // Now render the texture scaled up to fit the screen

    spriteBatch.Begin(samplerState: SamplerState.PointClamp);
    spriteBatch.Draw(renderTarget, new Rectangle(0, 0, screenWidth, screenHeight), Color.White);

This lets me use all the standard monogame rendering tools (including rotation) while still achieving that authentic pixel art look. :slight_smile:

1 Like

You should not create a graphics resource like this every frame. I recommend you add a field that stores the custom DepthStencilState (and dispose of it when it’s no longer needed) or use one of the built in DepthStencilStates. In this case the created DepthStencilState is equivalent to DepthStencilState.Default.

1 Like

Oh good call, thanks.

I figured it was something like that, thanks for answering!

Congratulations, the games look very nice and funny.

1 Like

Why should he ever do? Is it illegal not to do it?

Was my question a demand? I figured Did You? is a question, not sure what your impression here is…

No. It’s not.
But it’s a nice move to include such a notice somewhere, though not mandatory.
As a matter of fact I’m just thinking about including such a notice in my own game and if it would help or harm MG as a project if I did :slight_smile:

1 Like

Nice one!

I’m pretty sure it will help :slight_smile:

1 Like

Oh sorry, I don’t think I ever replied to MrValentine. Yep, there’s a “Made with MonoGame” credit in the credits screen on the main menu. :slight_smile:

By the way, Miles & Kilo is coming to the Nintendo Switch pretty soon, courtesy of Four Horses Games! Super excited.


Then I’ll do it. :slight_smile:
I’ll make an entry on the Wall of Fame.

1 Like

No Linux version :open_mouth: :frowning:

Nah, I didn’t want the extra hassle of supporting linux, especially since it accounts for such a small percentage of users. Even supporting Mac has just barely been worth it. It’s something I might consider doing if the game becomes super popular one day, though that’s not super likely tbh.

Assuming you are using DesktopGL platform for Mac, there should be no extra hassle, it comes with both Mac and Linux libs, and MonoKickstart comes with both Mac and Linux libs as well. The launch script that needs to be run in MonoKickstart is also the same between the platforms.

TLDR. If you are using DesktopGL for the Mac version, those same binaries will run on Linux as well.

1 Like

Ahh I wasn’t aware of MonoKickstart, I’ll look into that! Seems pretty handy. We’re adding some new features/polish to the Switch version so I’ll look into adding Linux support when I get around to updating the Steam version.


Hey, sorry to resurrect this but the game looks brilliant. I noticed it because I was actually looking for a way to allow my pixel art to rotate correctly! Could you provide more details please?

What are the settings you use for the renderTarget?
Where you say “// Draw the game’s graphics with the spriteBatch here”, what parameters do you use in spriteBatch.Draw()?

Do you essentially design your sprites at a standard resolution but smaller than you want so when they’re scaled up they become pixelated? This is what I had in my head too but couldn’t get it to work.


1 Like

Sure, I can explain it a bit more.

First off, yes, I draw all my sprites at 1x. They are not scaled up at all. It’s the game engine’s job to do any desired scaling.

So to make things simple, let’s say my “native” resolution (i.e. when the pixel art is completely unscaled) is 320x180, and I want to display the game in a 1280x720 window. I first render all my sprites to a RenderTarget2D, and then I draw the RenderTarget2D to the screen scaled up by a factor of 4.

Here’s how I construct the RenderTarget2D:

renderTarget = new RenderTarget2D(GraphicsDevice,

When drawing sprites to the render target, you can use whatever parameters you want for spriteBatch.Draw(), but you want to draw them at 1x scale. So if you have a 32x32 spaceship texture, you could draw it to the renderTarget like:

    new Rectangle(spaceshipX, spaceshipY, spaceshipTexture.Width, spaceshipTexture.Height), 
    new Rectangle(0, 0, spaceshipTexture.Width, spaceshipTexture.Height)

Finally, when I draw the RenderTarget2D to the game’s window (after drawing all the sprites to the renderTarget), it would look like this:

spriteBatch.Begin(samplerState: SamplerState.PointClamp);
spriteBatch.Draw(renderTarget, new Rectangle(0, 0, 1280, 720), Color.White);

Notice how the renderTarget is 320x180 pixels, but when it’s drawn to the screen, it’s being stretched to 1280x720. Also, the SamplerState.PointClamp argument is important because it gives you a nice crisp pixel art look, by default it would look like a blurry mess.

I’m not always great at explaining things but hopefully this clarified things a bit for you, haha.


That’s awesome. I actually got it working last night but woke to see this and it’s a great explanation and clarifies what’s going on so thanks a lot!

Presumably, to make sure game positions/vectors don’t get too confusing it probably makes sense to get the whole game working correctly at the small resolution and then simply add in the scaling code?

Also, does it help to make sure you keep things in multiples of 720 and 1080?

Seriously great idea and saves me having to doing sprite atlases of correctly rotated pixel art!

Nice, glad you got it working!

Yep, for Miles & Kilo all the game logic operates at the small resolution so I don’t have to worry about scaling at all until the final step where I draw the renderTexture to the screen.

As for the multiples of 720/1080 thing – it’s a good idea to pick a native resolution for your game that will scale up cleanly to standard resolutions like 720p and 1080p. For instance 320x180 scaled by 4x is 1280x720, and scaled by 6x is 1920x1080, and scaled by 8x is 2560x1440. 640x360 scales up really nicely too.