Cross-Platform MonoGame project creator v0.0.1

Standard

While researching about MonoGame to use it in some college projects, one of the first issues was the project architecture, figuring out the best solution for cross-platform project architecture, having the core game code shared across all platforms and platform specific code in platform specific projects.

In a future post I will do a tutorial on how to achieve this from the start but, if you understood the last paragraph, it won’t be that hard to replicate the same for a new platform.

I’m leaving this here as a quick solution for advance users. I’ve created and configured all the projects with a placeholder name, and a PowerShell script to change the name of everything to the desired project name.

TL;DR

DOWNLOAD

HOW TO USE

  1. Download the “MonoGame Project Creator v0.1.7z
  2. Extract somewhere
  3. Open a PowerShell terminal and cd to the extracted folder
  4. Edit the PowerShell script (.ps1) and change $NewText variable string
  5. Don’t forget to Set-ExecutionPolicy Unrestricted in order to run the script
  6. Run the script in the PowerShell terminal (using ./projectRename.ps1 )
  7. Open the *_WindowsGL.sln and run
  8. If everything’s OK, this will show up:
MonoGame Cross Platform Hello World ! Featuring Nightcrawler (yeah I know he's awesome)!

MonoGame Cross Platform Hello World ! Featuring Nightcrawler (yeah I know he’s awesome)!

REMARKS

  • Add shared game files in the base project and refresh the Solution Explorer
  • Notice the linked .xnb’s and .cs files in the platform specific project. Don’t discriminate, they are just as part of the Platform Specific project as any other file!
  • DON’T add the Content project to the platform specific solutions, that will pollute the Solution Configurations unnecessarily
  • If you don’t know what to do to support other platforms specific projects, don’t forget to check my blog for the tutorial! o/
  • All of this was done on Windows (hence PowerShell) so, don’t expect it to work elsewhere. That being said, check the overall file naming convention and placement + platform specific project .csproj and try to replicate!

PowerShell script was adapted from here: http://stackoverflow.com/a/9512638/859738

If you have any question, hit me up on Twitter @vvolkgang !

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s