Documentation Help!

Good Evening, first off, I’m new to Monogame and XNA and have been using it for a couple of weeks now and am finding the freedom of working outside of Unity/Unreal to be liberating.
I have been working through the ‘Monogame Mastery’ book and have found it excellent so far.

So I have a bit of a strange question that I guess I could arguably ask anywhere but seeing as though I’m learning Monogame - figured I would ask it here.

I would like to know where to start when wanting to find out about how something works.
For instance, I have blindly followed both the RBWhitaker tutorials and the Monogame Mastery book in adding a ContentManager to my project (I’m choosing this as an example), however a visit to the Monogame API shows how to call on the API and set it up but not how it works or what it does.

Another example is that I want to draw some 2D primitives which I have accomplished and have implemented them how I want. However, I did this without understanding the actual method - I simply followed a tutorial and would like to have a deeper understanding.

Can anyone give me any advice in how to find out information like this?

image

So take a simple square:
Square → 2 triangles
Triangle → 3 points

There are 2 basic ways to represent this in code:
→ Vertices only
→ Vertices and indices


Vertices only:
Referencing the above image you have v0, v1, v2, and v3. In order to draw a square, we will have to draw 2 individual triangles: 2 triangles x 3 points each = Vertices[6]. This not only tells the graphics which primitives to draw, but in which order they are to be drawn. This will look as follows:
→ Vertices = v0, v1, v2, v1, v2, v3
So v0, v1, v2 draws our first triangle, and v1, v2, v3 draws our second.


Vertices and indices
Referencing the above image you have v0, v1, v2, and v3. When you introduce indices, things work a bit different. Vertices tell the graphics which primitives to draw, but indices tell the graphics in which order they are to be drawn. Vertices can now share points, so they don’t need to be repeated: v0, v1, v2, v3 = Vertices[4]. The indices need to do the job of the previous “Vertices only”, so 2 triangles x 3 points each = Indices[6]. This will look as follows:
→ Vertices = v0, v1, v2, v3
→ Indices = 0, 1, 2, 1, 2, 3

Vertices can be in any order you like, as long as the indices point to v0, v1, v2, v1, v2, v3 (in that order):
→ Vertices = v1, v3, v0, v2
→ Indices = 2, 0, 3, 0, 3, 1

1 Like

Put loosely, this answer is fantastic! I really appreciate how much time and effort you put into answering this.

What I would like is a way for me to find out information like this for myself, any ideas?

Thanks
Shaun

Unfortunately the documentation for monogame isn’t extensive. The best place to look for answers is forums, whether it be the monogame forums, stack overflow, or just googling it. There’s a good chance that if you don’t know something, someone else also didn’t and received help on forums for you to view. You could also look up XNA specific topics, but a lot of code from back then doesn’t work now.

Other than this forum, I recommend our Discord community. https://discord.gg/monogame

It’s full of other people with extensive knowledge about any part of game development in MonoGame and in general. Most of us are also working on our own games so you can see what we’re working on and that’s bound to teach you some stuff. We can always recommend you stuff to read depending on what you need.