Hey all! My name’s Mike Burns and I just released my new game, Miles & Kilo, on Steam yesterday. I started working on it back in 2014 and finally got the PC/Mac version finished up. You can check out the trailer here:
Annnd the Steam page, of course!
Also wanted to give all the MonoGame developers a huge thank you for making such an excellent framework. MonoGame is a joy to work with.
Congrats and well done - I came across this the other day (can’t remember if it was on TIGsource or Twitter) and was thinking it looked really good. Didn’t know it was made with MonoGame.
Hello, I have this error when i launch the game :
`-----------------------------------------------------------------------------
Message: Une exception a été levée par l’initialiseur de type pour ‘SKT.SpriteRenderer’.
StackTrace: à SKT.SpriteRenderer.GetTextureOrigin(String textureName)
à SKT.Font…ctor(String imageName, Int32 charFrameWidth, Int32 charFrameHeight, Int32 charDrawWidth, Int32 frameOffsetX, Int32 frameOffsetY)
à SKT.SpriteRenderer…ctor(SpriteBatch spriteBatch)
à SKT.GameRoot.LoadContent()
à Microsoft.Xna.Framework.Game.Initialize()
à SKT.GameRoot.Initialize()
à Microsoft.Xna.Framework.Game.DoInitialize()
à Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior)
à SKT.Program.Main()
Date: 05/12/2017 10:49:02
Hrmm, this is a tricky one. I know one other person is getting the same error, and both of you have systems that aren’t using English as the primary language (I think his is in Russian), and as far as I know this doesn’t happen on English-language systems. The error has to do with loading spritesheet info from a JSON file. (So it’s unrelated to OpenAL).
I have a few ideas and I’m going to try one of them later when I get to my desktop. If I give you access to the beta build branch on Steam would you be able to do a little testing for me?
Also, thanks to everyone for the kind words!
Edit: Found the error. Has to do with number formatting in different languages and parsing numbers from text. So, by default, if you do something like:
float.Parse("0.2")
…it appears to parse the text based on your system’s default language. Most non-English languages use a comma as a decimal/radix point instead of a period, so that’s why the exception was being thrown. This is also why I wasn’t seeing this issue happen when I tested it with my English-speaking friends, haha.
Working on a fix at the moment, hopefully it’ll be up later today.
Edit 2: Pushed an update live. That should fix the issue, but let me know if you run into anymore crashes. Thanks!
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.
@Lufuki Thank you. 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.SetRenderTarget(renderTarget);
GraphicsDevice.DepthStencilState = new DepthStencilState() { DepthBufferEnable = true };
GraphicsDevice.Clear(Color.Black);
spriteBatch.Begin(samplerState: SamplerState.PointClamp, blendState: BlendState.NonPremultiplied);
// Draw the game's graphics with the spriteBatch here
spriteBatch.End();
GraphicsDevice.SetRenderTarget(null);
// 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);
spriteBatch.End();
base.Draw(gameTime);
}
This lets me use all the standard monogame rendering tools (including rotation) while still achieving that authentic pixel art look.
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.