Questions tagged [monogame]
Open-source implementation of Microsoft's XNA 4, for Windows, Mac, Linux, Android, and iOS, among others.
799 questions
0
votes
1
answer
122
views
Why does early z not work with fragment shaders using discard
I am currently trying to understand why using discard inside of a fragment shader disables early z.
I am using a simple cutout shader, which discards fully ...
1
vote
0
answers
118
views
How can I address multiple collisions within a single frame?
So, in my breakout clone, I've encountered issues where the ball will sometimes phase through bricks and the borders if it collides with one and then immediately collides with another after. My guess ...
0
votes
0
answers
68
views
Analyzing lag spike in Monogame
The game I am making is having big lag spikes once every 10 seconds or so while running. The spikes seemed to correlate with garbage collection (although I can't be 100% sure), so I thought my problem ...
0
votes
0
answers
100
views
Understanding C# Tasks
I use a lot of path finding in my Monogame project which is taking a toll on the framerate, because in the worst case finding a path can take 200ms. So I looked into using Tasks to spread path finding ...
0
votes
0
answers
63
views
Wrong colours when importing from Blender to Monogame
I have created a model in Blender and exported it as a .fbx file to Monogame, and the colours come out wrong. Here is the model as seen in Blender and as seen in my game respectively:
All the settings ...
0
votes
1
answer
50
views
Problems supplying per-vertex alpha data to Monogame shader
I am trying to make a trail renderer in Monogame. What I have currently is a procedurally created trail-mesh with properly applied UV coordinates, and what I have left to do is apply a per-vertex '...
2
votes
1
answer
351
views
Implementing animation curves using cubic bezier curves
I am trying to implement an animation system using cubic bezier curves. It was easy to setup the calculation of the curve itsself. Only evaluating the curve at a specific time x gives me headaches.
I ...
1
vote
1
answer
68
views
Move mouse from one viewport to another
I am currently implementing a map editor for a 2D platformer and run into trouble with my viewport and mouse movement.
I have two viewports: one main viewport in the top 2/3 of the screen which has a ...
3
votes
1
answer
120
views
My Monogame Android game fails to launch on Release build, failing to find ContentTypeReader
Today I struggled with the problem that appears on building my Monogame Android game with Release option. On Debug, everything is OK, but for some reason my game crashes on launch with Release build.
...
0
votes
2
answers
132
views
Weird behaviour with SpriteBatch.Draw in MonoGame
I'm creating a rhythm game. I'm trying to move automatically Notes from upside but something went wrong. Notes just stuck.
Below is code, thanks in advance for help because I don't understand what I'...
0
votes
1
answer
146
views
I got some wierd bug while building TMX files in Monogame
Today I tried to implement tilemaps to my game that I'm developing on Monogame. Those tilemaps were created by using Tiled map editor.
For implementing my tilemaps I used Monogame Extended. I ...
0
votes
1
answer
154
views
How to change layer depth according to player location?
I would like to change the layer depth of objects, so that the player can go behind them. Right now it looks like this when the player is behind the object:
The problem is that the layer depth doesn'...
0
votes
1
answer
122
views
How to add gameTime to movement with acceleration and diagonal normalization?
I recently started rewriting my engine from scratch, because the old one was my first attempt and the structure was very messy. Everything has been going great, but now I'm being held back by some ...
0
votes
0
answers
508
views
How does Monogame achieve a target FPS?
So in monogame, in your Game1 class you can write something like this:
...
0
votes
1
answer
65
views
How to correctly position a set of cuboids based on a direction property in MonoGame
I am trying to create a map for my game using a list of cuboid sections that are defined like this:
...
0
votes
1
answer
196
views
Is there a simple way to find where our code is keeping references to disposed/pooled objects?
In our c# game we use object pools to store sprites once the Dispose() method gets called.Then when the Sprite.Create method gets called if a sprite is in the pool it gets depooled, cleared and ...
0
votes
1
answer
329
views
How to make 3D particles in Monogame?
I have made a 2D game and right now I am converting it to a 3D game. All fine so far, only for the particles I had used the particles library from monogame extended but this library only supports 2D ...
0
votes
1
answer
980
views
Drawing Sprites and Primitives with layers in MonoGame
I'm writing my own 2D engine using MonoGame and I want to be able to draw 2D primitives (using DrawPrimitives) along with sprites using SpriteBatch.
But when I draw them, the primitives are always ...
0
votes
1
answer
266
views
Problems with rotating Child Objects
I'm writing a Transform script for a Monogame project and I'm trying for a few days now to fix the Rotate method of this script, but without success.
Currently, the Parent transform only rotates ...
1
vote
1
answer
396
views
D3D11 ERROR ("invalid arguments") from HLSL shader
I am using MonoGame 3.8.1.303 with Windows/DirectX.
I am just rendering a TriangleList using DrawIndexedPrimitives, but I am ...
0
votes
1
answer
115
views
correct matrix to draw mesh as flat object
I need to draw a tilemap for a 2d game. For that I created vertices with their relative positions already hard baked. The coordinates start top-left with (0f, 0f) and z is always 0.
I rendered them to ...
0
votes
1
answer
253
views
Monogame - When to reuse buffers?
So - how do these work exactly?
Right now I am making a buffer and setting the data every frame for my object, but I heard you can reuse the buffer, too. If the object is not changing in any way ...
0
votes
1
answer
252
views
How to modify single-scene ECS setup to support multiple local players in different scenes?
I'm currently developing a game in Monogame / C#. I have the underlying game engine set up in the following way:
Entity/Component/System architecture
A Scene includes a map, cameras, and a list of ...
0
votes
1
answer
302
views
Apply bloom effect to RenderTarget without affecting UI
I'm currently rendering my whole game to a RenderTarget in order to stretch the scene to any resolution. I also have a bloom effect rendered with the scene. I'm now ...
0
votes
1
answer
831
views
Drawing Textured Quads
I've been starting to write some XNA / Monogame code lately, and wanted to draw a quad with a Texture2D attached to it.
After searching the internet for a while, I've come up with this render code:
<...
0
votes
1
answer
86
views
Rotate and Zoom a group of tiles
I'm working on a tile-based game and I'm trying to rotate my tiles as a group around the center of the screen and want to have the ability to zoom in and out. Here my code:
...
0
votes
0
answers
260
views
Best way to implement a weapon/tool swing
In some games like Keplerth or Archvale, a weapon basically points towards the mouse and stays around the player sprite. But when you attack the weapon swings. I don't believe this is done with a ...
0
votes
1
answer
87
views
Remove gaps between 2D trail that is based on particle engine
Hi I'm using a particle engine suggested from this answer
I'm trying to create a seamless particle trail effect every similar to this (same) question
However, when the vehicle is travelling too fast ...
1
vote
2
answers
1k
views
Combining palette-swaps and smooth scaling in a pixel-art shader
I am creating a pixel-art game in MonoGame, and have written a shader to perform various effects on a sprite when rendering it, such as performing palette swaps, highlighting outlines, etc.. Most of ...
1
vote
1
answer
172
views
Best way to draw a tile (a floor) all over the screen?
I wanted a tip, a guidance perhaps to know the best way to draw a tile all over the screen. This tile is a 16x16 tile that should be the floor in my top-down map. I set my resolution to 1280x720 and i ...
1
vote
1
answer
115
views
Meshes seem to get distorted when I use rotate or zoom transforms (XNA/Monogame)
Whenever I seem to create a rotation matrix or try to zoom, the meshes that I draw to the screen get stretched and distorted.
I've tried to make a simple rotation matrix like this:
...
3
votes
1
answer
292
views
Proper way to build sensible object graphs?
The Context
I'm currently working on a game and its engine using C# and MonoGame. The engine is data-driven and I want people to be able to mod the game or make their own using my engine. All the ...
1
vote
1
answer
9k
views
How to handle octave & frequency in the Perlin noise algorithm?
I would like to implement a Perlin noise algorithm into my MonoGame project in order to procedurally generate 2D terrain. I've been using engines in the past (Godot, mostly) where there was an API to ...
1
vote
1
answer
413
views
How can I get correct coordinates from a diamond isometric map created in Tiled?
I am rendering a diamond isometric map created in Tiled using Monogame.Extended.Tiled package.
Here is where I'm trying to spawn a player with an object at ...
0
votes
1
answer
144
views
Monogame - SpriteFont build error
I am quite new to Monogame. When I try importing a .spritefont file using the Monogame Pipeline GUI Tool and then build it, it gives me an error: "System.DllNotFoundException: Unable to load DLL '...
2
votes
1
answer
497
views
Floats vs. Ints for position and collision
So I’m writing a player class and using floats to store the positon and velocity (Vector2) as well as using it when drawing. When it comes to collision I get the player bounds using this code:
...
1
vote
1
answer
140
views
Decouple shared data from consumers
I am a former Unity user, and after a big pause in game dev decided to try out Monogame (I'm a software engineer IRL so I'd figure this is the best way to go).
In Unity I was using scriptable objects ...
0
votes
0
answers
234
views
How to mask 2D tile sprites
I want to use masking technique to be able to reuse tiles. Basically I have the base texture and an array of masking textures for different corners and positions and want to combine the two to get a ...
0
votes
1
answer
2k
views
Something goes wrong when using System.Diagnostics.Process.Start to open a Monogame project
I am trying to develop a menu application for a homemade arcade. However, when I use Process.Start(path) to open my monogame projects' ...
1
vote
0
answers
151
views
How do I play multiple animations at once with an MonoGame skinned mesh?
I am working with the SkinnedMesh from this tutorial.
I am at the point where I want to let my character run (which already works), but when I press the punch key on my keyboard, I only want the upper ...
0
votes
2
answers
258
views
How do I create an infinite tower
So I had this idea of creating a 2D game where the player would just climb a tower the furthest he could.
I do already have a camera and a scene class somewhat ready, but I'm not sure how I would add ...
0
votes
1
answer
152
views
Will a game made with .Net Desktop Development, be able to run on Windows' desktops?
I am new to making games (I have experience only with pygame), and I want to start creating with C#. I've found out that Monogame is a very good engine. On my way of setting up, in the part where I ...
0
votes
1
answer
425
views
How to do topdown collisions properly?
I'm trying to achieve grid/tile based collisions like "a link to the past"; here is an article showing it off (sliding off the corners and such). I'm currently using this type of collision ...
0
votes
1
answer
158
views
How can I find the direction a sprite is moving?
I'm trying to get the direction a sprite is moving (up, down, left, right). My current approach is to get the x and y coordinates of the target and the sprite (the sprite is the thing that I'm trying ...
1
vote
2
answers
245
views
Exported FBX to Monogame doesn't translate all meshes
I'm taking a crack at a minecraft clone in Monogame, and I am trying to get my model to render as it's shown in Blender 2.9.1. When I look at the model in Blender, it looks great. When displaying in ...
0
votes
1
answer
281
views
How to select a sprite with the mouse in c# XNA?
I'm attempting to create a chess game, for the movement I need to be able to click on a piece with the mouse, and then the square I'd like to move it to. Each piece on the board is a sprite, and I'm ...
0
votes
3
answers
226
views
How do I show only the level in monogame? [closed]
How do I remove the blue background shown here
So that only the level is visible without making the sprites/map larger or the window smaller?
0
votes
0
answers
70
views
Advices on multiplayer implementation
I am developing a top down shooter and my singleplayer is pratically finished so now I want to move on to develop multiplayer but I have some questions and I am seeking for some advices.
In my game a ...
1
vote
0
answers
266
views
Matrix transforming with translation/rotation/scale at center of screen
I'm trying to create a camera using matrix transforms, the gist is as follows:
...
0
votes
1
answer
192
views
how to order entities by their distance from 0 on the x axis
I'm creating an infinite runner game in which you control several characters at once. Right now when you press the spacebar, they all jump at once but, I want them to jump at separately, one after ...