How can I create a MonoGame project that uses "Mini-Games"

This question my get a little long, but this is the best way to describe it:
I want to create a game (actually already have several parts of it) that has a
main “controller” type game that when a map area is clicked on it launches a
“Mini-Game” of different sorts; (match 3, hidden object, puzzle) etc.

The main part of the question is this: How do I get the “Controller” program to launch
the other game? the mini-games are all part of the same project eg. “Solution Star Defender(10 projects)”.

Sample:
This is one game;
namespace ZodiacScreen
{
///


/// This is the main type for your game.
///

public class ZodiacScreen : Game
{
. . . .
}
}

This is the second game which will “Call” the first game to run:

using ZodiacScreen;

namespace Star_Defender
{
///


/// This is the main type for your game.
///

public partial class StarDefenderGame : Game
{
#region Variables
ZodiacScreen StartScreen;

}

}

Doing it this way generates this error:
Error CS0246 The type or namespace name ‘ZodiacScreen’ could not be found (are you missing a using directive or an assembly reference?

So I tried adding a reference to the project in the Solution Explorer, which got me this:

“A reference to ‘Zodiac_Screen’ could not be added. Adding this project as a reference
would cause a circular reference.”

Zodiac_Screen is the other projects name and the namespace and class name are “ZodiacScreen”
as shown above.

Each project runs fine on its own.

The best way is to not let the minigames have their entry point inheriting from Game. Only the main game should start from a class that inherits from Game. I recommend you let each minigames inherit from a custom class or implement an interface that exposes the methods you need (LoadContent, Unload content, Update and Draw probably) so you can easily run any of them from your main game. Hope that helps, feel free to ask for clarifications if it’s not completely clear :slight_smile:

There is a thing called GameModeBase, I think it is what you are looking for…

EDIT

Hang on, looking for the correct thing for you, that was for something else…

EDIT

Hard to place it but Game Levels seems your best simple bet other than creating a full framework…

I have a few books on creating such frameworks but I think that might be overkill for you…

I think you might mean GameComponent/DrawableGameComponent? Those could be used instead of a custom interface/class.

1 Like

I was trying to find the connection with that and GameHost… but yeah, pretty much that…

It has been quite a few years since I did any interface programming and I am VERY rusty.
I also got to thinking about a project That I worked on about a Year and a half ago that was
“basically” a screen manager for multiply screens such as options, high score, etc. and I
am thinking about “adapting” it. More on this later. . .

1 Like

Update: After doing some thinking and looking back over the screen manager code that I wrote before,
I have decided that using the screen manager and a simple “mini-game” class that this would be the easier
direction to pursue. This mini-game class will hold all the necessary “mechanics” (scoring, collision detection, etc.) while the content and such is loaded in the main game framework and then simply
passed to the game via the screen manager. This will also allow me to use the PCInput namespace that
I created to handle all the game input and, again, pass the needed info to the individual games.

Much thanks for your thoughts and insights.

1 Like

It looks like you came up with a solution that is very, very similar to what I did here:
http://forum.arcadecontrols.com/index.php/topic,156300.0.html

I wrote software to run on my (real) skeeball machine I threw a computer and monitor into.

I have a GameScreen class that inherits from DrawableGameComponent, and handles the main update and draw methods and implements keyboard handling. From there, I created a SkeeballGame class that inherits GameScreen implements a bunch of common functionality. (highscore handling, common fonts and textures, highscore display, attract mode settings per game, etc). Each of my games inherits form this.

My base Game class is just a screen manager. My Title screen, menu, and my individual mini games are each GameScreen components that are dynamically loaded and unloaded.