Questions tagged [monogame]

MonoGame is an OpenSource implementation of Microsoft's XNA 4 APIs that allows developers to build games that run on Android, iPhone, iPad, Mac OS, Linux, PlayStation Mobile (2D only), Windows 8 Store, Windows Phone 8, and OUYA, while reusing their existing XNA code that runs on Windows, Xbox 360, or Windows Phone 7. It supports both OpenGL and DirectX rendering.

Filter by
Sorted by
Tagged with
0 votes
0 answers
10 views

Running MGCB causes errors and the editor doesn’t look like in the tutorial

I’m running macOS Sonoma using VS Code And when I select opening content.mgcb with the editor I get this in Output Users/<name>/Desktop/code/games/monogame/MyGame/MyGame.csproj : warning NU1803: ...
MCB's user avatar
  • 2,053
0 votes
1 answer
36 views

Attempted Perlin Noise in C# but results are all too close to 0

So I am trying to use 2D Perlin Noise for a Monogame project and I read through the wikipedia article (https://en.wikipedia.org/wiki/Perlin_noise) covering the approach and tried to code it. After a ...
Phlips's user avatar
  • 1
1 vote
1 answer
31 views

Multiply Matrix and Vector4 XNA

How do I multiply a Matrix by a Vector4 in XNA/monogame? Matrix a = Matrix.Identity; Vector4 b = Vector4.Zero; b = a*b; This gives an error. This should be allowed afaik. Do I ...
Gaming Gecko's user avatar
0 votes
0 answers
72 views

Attempting to create a state machine (?) in c# and monogame to change the menu

for a computer science project, i decided to do a poker game using monogame. i havent gotten too far and have gotten stuck on how to implement a fully working menu. i followed a tutorial on how to do ...
menbead's user avatar
0 votes
0 answers
29 views

Monogame project server issue spawning players

I'm making an RPG in monogame c# framework. I have a basic server using System; using System.Net; using System.Net.Sockets; using Microsoft.Xna.Framework; using System.Text; using System.Threading; ...
Daniel Young's user avatar
0 votes
0 answers
51 views

Array element reference being set to partially incorrect memory address and data

I am at the point in the custom ECS I'm making where I am trying to retrieve components I've stored. The issue is when I try to access the array element as a reference it ends up having a memory ...
RataEE's user avatar
  • 1
0 votes
1 answer
74 views

Deploying Xamarin app to iPhone - unhelpful "Deploy failed" message

I'm using Visual Studio 2022 for Windows, paired to a Mac Mini (which has an iPhone plugged into it). When I try to build-and-deploy my app to the remote iPhone, the build works but the deployment ...
CarlJ's user avatar
  • 143
0 votes
1 answer
137 views

.NET framework application takes 1m30s to start on a specific machine

I have a MonoGame application that runs fine on most machine, however on my main PC it takes 1 minute and 30 seconds to start. While debugging it hangs just before 'ZodFortressMono3.8.exe' (CLR v4.0....
Alex's user avatar
  • 33
0 votes
1 answer
39 views

How can i rotate a vector light source?

I have a 3d Vector, lets say (-0.7f, -1, -0.5f). I want this to be the forward direction of the light source and then have it rotate/spin to create a sunlight effect around an object. I'm attempting ...
servvs's user avatar
  • 100
0 votes
1 answer
62 views

What is RenderTarget?

I am reading a book called "Monogame Mastery" about Monogame framework for .NET. And in the chapter-04 there is a part that explains how we scale and locate our content of game to properly ...
Алинур Сейсеков's user avatar
0 votes
0 answers
81 views

How to do collision in MonoGame properly?

I've been making a game using MonoGame framework, but I came across a problem when I tried to handle collisions, to be more specific, player collisions. I tried to search some things on YouTube and ...
Absol's user avatar
  • 101
1 vote
0 answers
40 views

mgcb-editor does not allow my project to start

I am making my game on MonoGame, a technical demonstration, I have already fixed all the errors, Visual Studio does not issue any errors and warnings, but when launching it displays the mgcb startup ...
Андрей Тарасов's user avatar
0 votes
1 answer
64 views

how do I set the speed of animations?

I'm using a Monogame template in Visual Studio. I have a Player.cs, which holds the WASD movement of my player, and the Game1.cs, where the Player class is updated. I figured the next step, now that I ...
Tiny's user avatar
  • 27
0 votes
0 answers
68 views

Compiling Monogame Shaders on MacOS - preloader: Warning: failed to reserve range 0000000000010000-0000000000110000

I recently got a new mac and I'm setting up wine to compile shaders as this link says. I had to edit the mgfxc_setup.sh file to account for it downloading a 32-bit version of the SDK, but even before ...
Danger Penguin's user avatar
-1 votes
1 answer
81 views

C# - how do I get the code to work in different classes?

I'm making a new game (in Visual Studio, using MonoGame template), and I figured that classes make everything tidier and easier to find/work with - my one problem is that I have no idea how to link ...
Tiny's user avatar
  • 27
9 votes
2 answers
639 views

Why do I get "Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))" error when opening Monogame pipeline?

When I try to open MonoGame pipeline (MGCB Editor), I get an error that says either "Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))" or "The Extender Provider ...
Absol's user avatar
  • 101
0 votes
0 answers
30 views

How would I load a Texture2d in another class?

Here’s some of my code for the player class. namespace My_Game.Content.Sprites { internal class Player : Sprites { public Player() { setDefaultVariables(); } ...
Jackson Kidwell's user avatar
0 votes
0 answers
41 views

How do I keep obstacles from spawning on top of each other?

I'll keep this quick - how do I get obstacles (like the cacti in chrome dino) to spawn always with a gap big enough for the player to actually fit between two obstacles? They're just slapping ...
Tiny's user avatar
  • 27
0 votes
1 answer
41 views

Ray vs Rect collision detection not working properly

I've been following this tutorial to make a collision detection algorithm for a game in MonoGame. But for some reason it's not working properly. The first part of the algorithm is a funcion that ...
SaloCh's user avatar
  • 11
0 votes
0 answers
30 views

How to use SpriteFont in a generic class for C# MonoGame

I'm trying to create 2 classes for my UI system, i don't want to know if a library in this style exist, i'm actualy in a training center, and i need to make a standalone project, it's only a training ...
Tomsone's user avatar
0 votes
1 answer
32 views

hero character jumping in monogame doesn't work

I'm creating a game in monogame. I'm trying to have the character jump and have gravity pull it down after a while, currently any movement just takes "priority" which means you can just move ...
ArneVC's user avatar
  • 5
0 votes
4 answers
96 views

C# - why is my countdown timer not working?

Am I missing something? I've got my timer: private int timer = 10; And in my Update class, I have it so that when the timer reaches 0, an object will move across the X-axis. do { timer--; } while (...
Tiny's user avatar
  • 27
-1 votes
2 answers
85 views

foreach is throwing 'Collection was modified' error

I'm using a monoGame template in Visual Studio, and I'm making an endless runner (similar to Chrome Dino). In the LoadContent class I've used Enqueue to put my obstacles into a Queue list. Note: I've ...
Tiny's user avatar
  • 27
1 vote
0 answers
26 views

How to apply transformation to imported Assets?

I am trying to make a simple program that displays 3 different imported assets at different locations in the world. They are all rendering properly, but I can't figure out how to apply transformations ...
Tim Fox's user avatar
  • 11
0 votes
1 answer
35 views

C# visual studios mono games Array overflow error tile map

im trying to make a tile map for a strategy game however i keep getting array overflow error and i don't know why the file its reading from isn't the issue the code is nearly identical to a working ...
Dylan 's user avatar
0 votes
1 answer
121 views

How do I make a random enemy spawner?

This may be a lil stupid, but I'm making an endless runnner and I can't make my obstacles spawn properly... To elaborate, I have 3 different obstacles, and I can't get them to be picked at random, as ...
Tiny's user avatar
  • 27
1 vote
1 answer
445 views

Unable to open Content.mgcb in Visual Studio 2022

I'm attempting to make my first Monogame project, and I want to add some graphic assets to it. I tried double-clicking the Content.mgcb file in the Solution Explorer window, but nothing happens. Tried ...
Leonide's user avatar
  • 235
0 votes
0 answers
49 views

Difficulty installing MonoGame extension in Visual Studio 2022 (Install Failed error)

I'm encountering difficulties while trying to install the MonoGame extension in Visual Studio 2022. I followed the standard installation process, but it consistently fails with an "Install Failed&...
MyamsarV's user avatar
0 votes
0 answers
27 views

Drawing borders between colors using shader and MonoGame

Today I decided to learn somthing about shader and already stuck. I'm writing for MonoGame in HLSL. As I still have problems with language semantics, I don't understand why it is not working. Image ...
これは 聡明 な文章だ's user avatar
0 votes
0 answers
32 views

When you disconnect the headphones from the computer, the sound disappears in the game on monogame. How to fix this?

Is there any way to detect that the audio output device has been disconnected/connected? If so, how do I manually change the device when it is disconnected/connected? I found similar problems with ...
luvairo's user avatar
  • 19
0 votes
1 answer
100 views

Unit Testable Monogame: Best approach?

I'm trying to set up a framework on top of monogame. I'd really like the framework to be unit-testable. For example, I've written a SpriteComponent class. It'd be good if I could create a quick test ...
Thomas Slade's user avatar
0 votes
0 answers
153 views

Trying to build MonoGame content in MG Editor for MacOS M1

I am currently developing a game in C# using .NET 7.0.203 in Visual Studio 2022 for Mac (so M1). The MonoGame project uses DeskotGL and should be cross platform. The game will be developed using ...
Rares's user avatar
  • 7
1 vote
1 answer
57 views

3D audio not working in 2D game after switching from XNA to MonoGame

This is a problem I have never managed to solve for a 2D game I have ported to MonoGame 3.7.1 from XNA 4.0. The project is set up as DesktopGL, and uses .NET Framework 4.8. In the XNA version, 3D ...
MrJ's user avatar
  • 21
0 votes
0 answers
45 views

Cross-compiling monogame project for Apple Silicon/universal binary on x64 windows/linux

I have read the monogame documentation page for packaging and it seems like it only contains instructions for compiling for osx-x64. However I would like to compile for osx-arm64. So I ran this ...
SunnyMonster's user avatar
0 votes
0 answers
71 views

Dotnet run command giving me "error: XDG_RUNTIME_DIR not set in the environment." error

So I downloaded MonoGame onto VScode using ubuntu. I'm trying to test it out and run the file to see if it works. When I type dotnet run into the terminal I get an error message: error: ...
Virgomoon's user avatar
1 vote
0 answers
30 views

Xna Monogame C# Keyborad input issue with German keyboard

I would like to program a text input with xna, everything works, only the German letters "ö, ä, ü" are not recognized and there is no enum for these keys on the keyboard. When I enter it, ...
Anton Müller's user avatar
0 votes
1 answer
56 views

How to create a selection screen, where to select an text option the [w] and [a] keys are used to move up and down? (C# and Monogame)

I want to be able to select an option from a menu with only vertical movement. All available options are available to be seen by the player. The currently selected option should be visibly highlighted,...
lala popotw's user avatar
0 votes
1 answer
34 views

How to draw a Texture2D sprite appear as if it's growing upwards out of another Texture2D? MonoGame/XNA

I was wondering how to draw a Texture2D sprite to appear as if a vine is growing upwards, like in Super Mario Bros. Are there any options to make this work? I found this and this but it's not quite ...
nillawafers11's user avatar
1 vote
1 answer
69 views

Monogame, XNA measure FPS

Please could me someone explain to me how does work this calculation? this formula works (its derivation)? I do not get it :( framerate = (1 / gameTime.ElapsedGameTime.TotalSeconds); From ...
kubas126's user avatar
0 votes
0 answers
96 views

Tile selection on a 2D ortho fake infinite grid

I cannot find the right offset to get the tile that is selected on a simulated fake grid. I draw a grid on a texture (monogame renderTarget) that I offset in the center : GRID_CENTER_X = (...
Sanchez Milo's user avatar
1 vote
0 answers
69 views

Monogame - repeat texture on mesh when scaled

currently I'm developing a first person shooter with 3D meshes building my world. My meshes can have a texture on each side (front, back, left, right, top, bottom). That works very well. This is the ...
Canox's user avatar
  • 567
1 vote
1 answer
48 views

MonoGame: Load SoundEffect from MemoryStream

I figured I'd put all the .wav files into one file and then load them. I don't think it will be a problem but something is wrong. It reads the .wav file from the disk and then, using BinaryWriter, ...
Piasiu's user avatar
  • 11
0 votes
1 answer
59 views

Problem with Multi directional sprites in Monogame

I'm trying to implement multi directional sprites like they are in old FPS Shooters (Wolfenstein 3D or Doom). My sprite has 8 directions. OffSetX is the offset that gets the right sprite from my ...
Canox's user avatar
  • 567
0 votes
0 answers
220 views

How to draw multiple textures with a single Draw call using Monogame?

I am working on a 2D game where both the X and Y directions are horizontal directions, but textures are drawn ordered in the Y direction, so as to give the impression that objects with higher Y are in ...
onajihe's user avatar
0 votes
0 answers
129 views

Monogame font size - pixelart

I'm trying a pixel art style text rendering in C# with Monogame. I downloaded and tried several fonts online from dafont.com but I encounter the following issue. I import them as spritefonts with the ...
Peter's user avatar
  • 33
0 votes
1 answer
145 views

Microsoft.Xna.Framework.Content.ContentLoadException on VideoPlayer in Microsoft.Xna.Framework.Media (Monogame)

I'm trying to play a video in Monogame. I was having a bit of trouble because the easiest way is to use VideoPlayer, which is not in my Microsoft.Xna.Framework.Media for some reason. So I pointed my ...
Garousome's user avatar
0 votes
1 answer
122 views

Optimizing C# memory allocation

I ran into a rather peculiar thing today when trying to optimize. I use the Monogame framework and want to create textures on the fly. I use .NET 6 in Visual Studio Community 2022. So this is the ...
Tornseglare's user avatar
  • 1,027
0 votes
2 answers
91 views

C# Monogame Code Skipping Ahead While Calculating Next Move (Chess)

I'm currently programming a chess AI and I'm using Monogame for the graphics. I want to add an animation of the computer's pieces sliding to the square they moved the piece to, but my code won't work. ...
Jack Newport's user avatar
0 votes
0 answers
46 views

UIKit.UIKitThreadAccessException has been thrown when I try to open my app settings on iOS

I have created a button in my game's menu.cs to display if push notifications are enabled or not. When the user clicks on this button then my game's settings on iOS should open so that the user can ...
John_Kub's user avatar
0 votes
1 answer
39 views

Recalculating Normals Of Edited Heightmap

I have a terrain editor written in C# and Monogame. Once I edit the terrain, I would like to only recalculate the normals for the vertices associated with the triangles that actually changed position. ...
servvs's user avatar
  • 100

1
2 3 4 5
38