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.
HOW TO USE
- Download the “MonoGame Project Creator v0.1.7z“
- Extract somewhere
- Open a PowerShell terminal and cd to the extracted folder
- Edit the PowerShell script (.ps1) and change $NewText variable string
- Don’t forget to Set-ExecutionPolicy Unrestricted in order to run the script
- Run the script in the PowerShell terminal (using ./projectRename.ps1 )
- Open the *_WindowsGL.sln and run
- If everything’s OK, this will show up:
- 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 !