Beginner help request with Monogame 3.7, VS2017

Hello! I’m new here and even new to Monogame. I’m at a loss. I’ve been working with the online tutorials that I find and have run into a snag. I’m trying to work with parallax scrolling and am having no luck. Every tutorial I try is either outdated, references Xna (which Monogame is almost the same), only shows me the blue corn colored screen, or just plain crashes when debugging or testing. I know that this is a little vague, and I’ll give any further information needed. I’m trying to build a shmup type game and would love to work with monogame to do so. Is there a more up to date tutorial that I haven’t stumbled upon yet? Any recommendations?

Though I haven’t seen it, there’s a chance parts of @SolitudeEnt’s tutorial series might cover parallax scrolling, but it’s also a tutorial in general for learning how to work with MonoGame. Which tutorials have you tried so far? Most XNA tutorials should still be valid.

This one is the first one that I attempted, I found it by following a link in the tutorials section and is closest to what I want to do, but it is the one that crashes out with no errors :frowning: I read the comments and found that the community fixed some errors along the way but that didn’t help me either.

Corn blue screen with this one, although I changed it to orange because… why not haha.
http://www.jgallant.com/how-to-create-a-parallax-effect-in-monogame/

Here:

And here, Not much in the way of parallax but I figured I’d try and look

http://rbwhitaker.wikidot.com/monogame-introduction-to-2d-graphics

That’s when I ran across this idea: the 2D Camera class. I haven’t tried it as it appears intimidating or even above my skill level at the moment.
https://www.david-gouveia.com/2d-camera-with-parallax-scrolling-in-xna

I wonder if it is my setup in some way? Or are these tutorials missing something that I should already have in place?
I’ll take a look at those videos that you linked and see if I have better luck in the meantime :slight_smile:

Thanks for responding!

Windows 8 is no longer supported in MonoGame, and we switched from OpenTK to SDL and OpenAL for DesktopGL platforms. In addition, MonoGame now has its own pipeline tool, so the XNA Content Pipeline is no longer needed.

Since you’re new to MonoGame, I would recommend starting with getting a sprite drawn on the screen first and take it from there. If you have any questions, don’t hesitate to ask on here or in the Discord.

Enjoy reading through…

Thanks guys! I’m gonna look through my setup and try again. I’ll let you know how it turns out :slight_smile:

Ok yeah, I’m not having luck. Everything I try comes up blank.

So I read the basics and I can get things to the screen, but any time I go through a tutorial that involves creating and using other classes, I get zip. This is the most recent tutorial for me. I followed and commented my code and even watched the accompanying video and it does the same thing as the rest of them.

It’ll build and show no errors, but do nothing:

It’ll sometimes throw an exception about the image files and locations, even after loading, building and saving in the pipeline tool:


Across the net, I’m getting mixed answers about .xnb files, but either way, they are there. I’ve even copied them and moved them to where it claims the exception is. Then, it just tell me that they belong in a 3rd or 4th location.
Also noteworthy, no content ever shows up in my Solution Explorer… ever

I’ve even rebuilt the content and saved:

I’ve uploaded the project here in case anyone wanted to review my code.

I have noted an absence of “Viewport” in this tutorial, but I assume that the creator went a different route with graphics.ApplyChange() method.

And now, it’s time for me to go to my Programming class where we learn Windows Forms all day haha.

Thanks for helping!

The content you believe is missing is in the Content.mgcb database in the Content directory in your solution. This is why you are not seeing any images directly in your sample code hierarchy. To see the images in this database you have to use the MonoGame Content Pipeline tool.

BTW, if you are using MonoGame 3.6, NEVER, EVER delete a folder in the Content database. There is a very serious bug in the tool and it will wipe your project out permanently. So before you delete anything within this tool always make a backup of your entire project. They say that version 3.7 of MonoGame has corrected this but I wouldn’t take any chances and be on the safe side…

From what I’ve seen, 3.7 does fix this as I have added and deleted content in multiple projects. I see everything in the pipeline as shown above which is fine, but apparently my code doesn’t see it/doesn’t like it?

The code that actually loads the images (at least for the background) resides in the Level.cs class.

When I ran your solution it seemed to work for the most part…

Ok, then it has to be my setup. What ver. of VS ? Monogame are you using?

Can I see a screen of the result, please? I want to feel .5% accomplished! haha

I am still using MonoGame 3.6 as I haven’t really seen a reason to upgrade yet due to the type of development I am working on.

Here is a snapshot of the screen I am seeing when I run your solution…

I got it! Here’s what looks like is going on, on my machine anyway:
I got to thinking about the quoted text from SNaidamst and thought “What if the “DB” didn’t copy correctly?”
So I searched out every directory with the Content “DB” in it and it had the Content pipeline with the images loaded and saved to it there, but nothing else.

Ok, so the “DB” is there, but it apparently isn’t reading it or pointing at it in some fashion. So I searched out the image files by right-clicking on the built image in the pipeline output and that gave me the path to the image. I then had to copy the files and paste them in the Debug/Content and Release/Content folders.

When I ran the game, it came up!!!

But that now raises a new question:
In doing what I did, doesn’t that mean that the finished product will ship with multiple copies of the textures significantly increasing the file size and load times or does Monogame / VS filter out that “noise” in some way during build? And what about that “DB”? Do I even need it?

Oh and yeah, thanks for the image! I didn’t say it’d be pretty! I’m just glad someone else tested it and got it to work.

Thank you for all the help!

All you have to do when you deploy your software is to copy the entire contents of the Content directory, which will include the image sub-folders. MonoGame only uses the reference points in the Content.mgcb database so there will be no duplication in your software of multiple images.

Since I cannot see the actual data in the Content.mgcb database I don’t really know if it just holds image reference points or the entire image itself. However, you will have no problems by simply ensuring that the entire contents of the Content.mgcb database are included in your software’s deployment,

:slight_smile:

That makes sense. A good DB doesn’t contain the actual image, but a reference to it’s location. If that’s the case, then the DB is pointing at the right location and it was working just fine, but nothing was copied over automatically like I assumed it should be so I got a crash / cornblue screen / exception.
I wonder if its a Monogame 3.7 / VS 2017 Enterprise issue or just my machine?

Either way, this seems solved. Now I can continue with the tutorials. Thank you for all of the help!

My pleasure… :slight_smile: