(SOLVED) Porting Complex XNA 4 Game to Monogames need Sharder Help!

This game looks awesome! Keep us posted on progress please! :smiley:

1 Like

Be happy to keep everyone posted… once I get this ported over and working correctly in mono I plan to go public with it and setup the website etc.

1 Like

Thanks again for everyone’s help, and speaking of help can someone tell me which Content.mgcb should be in the content folder?

I have one that is there by default when the project is made, then I have one that is created by the pipeline tool. Currently I’m using the one that was created in the content folder by default and I set Build Action: to MonogameContentReference.

Currently the application is crashing in Game Initialize on the base.Initialize();
An unhandled exception of type ‘System.NullReferenceException’ occurred in MonoGame.Framework.dll

I did some testing and its where I go to use the Content for the first time when my engine Initializes while it does not break in the engine initialize code it will break on the base.Initialize. If I remove that code that uses the content it will no longer crash but nothing runs since the engine is not setup. So my guess is I need to use a different .mgcb the one I made by the pipeline tool?

Thanks again for any help.

More detail: the error is happening at Microsoft.Xna.Framework.Game.InitializeExistingComponents()

Never mind… I found a null component getting added at my engine initialization… odd thing is code has not changed in the port… weird

If the exact same code did not crash in XNA, that’s a bug in MonoGame.

There are some things that are good to know about content building in MG that might save you some headaches further down. The .mgcb file is not used at runtime. If you open it with a text editor you can see what it actually does. It stores files to build and settings for the content processors. If you build it, it will produce a bin folder with the xnb’s of all built content. If you set the build action to MonoGameContentReference what it will do when you build your project is, it will check if any content changed (so it requires to rebuild) and build that, then copy all output xnb’s to the output folder of the project. So basically it just automates building the content and copying it over.

Thats good information thank you!

Great progress on the game now! got it up and running only failures I see now are every custom effect, and 3D sound. But good thing is everything else looks like its working and is playable again.

main menu is up it works since it only uses basic effects for now… (have not added particles etc to it)

The planet effect is not doing well I copied the updated effect code back to my original xna project and just changed the shader levels and it works fine below it that test.

Should look like:


but currently looks like:

What MonoGame version and what project template are you using?

I’m using version 3.5 from the download page and using the Windows game template

http://www.monogame.net/documentation/?page=Custom_Effects contains some nuggets. Check the input and output parameters and use SV_POSITION in place of POSITION.

I Finally got the planet shader working!!! I don’t have bloom converted correctly yet so the atmosphere is not as soft and fuzzy as it will be but I think its looking good and it works better in a lot of ways.

Thx to everyone for the help; had to do a lot of re-configuring of the shader code in addition to ensuring the Vertex output matching ps input and using SV_POSITION; I also had to redo all my sampler code.

In case anyone is wondering what that change required:

Old:

texture2D textureMap;
sampler myTexture = sampler_state
{
	Texture = <textureMap>;
};

New Had to drop the variable and change how the texture was set

sampler myTexture= sampler_state
{
	Texture = (textureMap);
};

Also had to change my PixilShaders method to no longer use “out” parameters and change them to the following format:

float4 PixelShader(VSOutput input) : SV_Target0

If you don’t have SV_Target0 or COLOR0 it will not work.

here is the shader up and running:

1 Like

Excellent work. Good to see the shader issues were solved. They are one of the areas that are most difficult to handle for cross-platform and cross-device.

Your issues were almost the same as mine, I started porting a week before you and made similar posts and questions…

I saw your posts and was reading through them before I had started my conversion.

I think the biggest problem now is that some shader bugs only appear on some systems.

Conversion is all done, finally got the bloom and particles backup!!! Thank you everyone that helped me out it was very much appreciated.

Earth with bloom back on:

Start the fire works:

Once I’m ready to go public with the game I will post a show case here. I think MonoGame is an excellent framework and deserves more credit and attention then it is getting.

Glad to see you got them working! Woah, man! Those effects look so good. Do you maybe have any videos :stuck_out_tongue:

Couldn’t agree more :smiley:

Indeed I do have movies while most are keep under wraps as the are dev works in progress and I will show off a ton of stuff when I go public I can show an old video of the weapon I took a screen cap from above. This is an older video and there have been improvements but gives a good idea of the effects for that weapon even if the shockwaves are a bit smaller which makes the applied shock-wave physics a bit harder to see.

1 Like

I agree, looking at the screen on this post, and some of the other recent games I’ve seen around here.