A few weeks ago Hon and I played a game on the Xbox360 called Aqua Kitty. We really liked it, so I searched it up on Google to read about the developer. It turns out he has ported the game from Xbox 360 to Playstation Mobile. A few things went through my mind at that moment:
1. What the hell is PlayStation Mobile?
2. How did he port the game over so quickly?
3. I need to get in on this.
I found out that PlayStation Mobile is a digital distribution platform that targets certain Android Tablets, mostly Sony tablets, and the PlayStation Vita. Awesome! I can make a PlayStation Vita. Next I discovered that the Aqua Kitty developers, Tikipod Limited, used MonoGame to port over to PlayStation Mobile. Excellent! So after that I decided to try and port my latest game, Tokyo Hosto, to PlayStation Mobile.
Be warned Macintosh jerks, PsmStudio doesn’t work on Apple computers.
1. Sign up for PlayStation Mobile.
2. Download and Install the PSM SDK
3. Download the MonoGame source from GitHub
4. Create a new PSM Project in PsmStudio.
5. Import the MonoGame and Lidgren Frameworks from source.
6. Set a Compiler Directive
7. Modify AppMain.cs
8. Import your C# code files
9. Import your XNB files.
Sign up for PlayStation Mobile
Hit the regsiter button, go through the steps to make an account and you’re done.
Download and Install the PSM SDK
This step is also pretty easy, you’ll need to download an installer that contains the PSM SDK, the Mono Framework, and some really funny documentation. The documentation is really funny, the tone it takes is a bit too familiar.
You can check out the PSM documentation, but you don’t really need to since we’ll be using the MonoGame Framework. I suggest checking it out, in case you have a problem with doing things the ‘MonoGame way’ and want an alternative.
Download the MonoGame Source
There are no MonoGame templates in PsmStudio, and no DLLs for you to import, so you’ll have to import the entire MonoGame Project and link it to your project manually. It sounds scary, but it’s not too difficult. The first step is getting MonoGame’s source code.
Head over to MonoGame’s GitHub Page. Choose the ‘develop’ branch, and then choose ‘Download As Zip’
Once that’s done, unzip the entire contents to a nice location like Documents/Projects.
Create a new PSM Project
Open up PsmStudio, Click ‘Start New Solution’, expand out the C# option, choose PlayStation Mobile and then PlayStation Mobile Application. Give your project a name, and choose where you want it to live. PsmStudio is a horribly buggy on Windows 8, I don’t know why, but a lot of UI elements don’t fill properly. So you’ll need to do tricky stuff to get them to refresh.
Import MonoGame and Lidgren Frameworks
Your game needs to reference the MonoGame Framework, and the MonoGame Framework references the Lidgren Framework. So you’ll need to import these projects to your project. Right click on the Solution and choose Add –> Add Existing Project.
Navigate to wherever the FUCK you unzipped the MonoGame project, go to ThirdParty/Lidgren.Network and import the Lidgren.Network.PSMobile.csproj file. You have imported the PSMobile version of the Lidgren Network Framework. Good. Next we want to import the MonoGame Framework.
Navigate to wherever the fuck you unzipped the MonoGame project, go to MonoGame.Framework and import the MonoGame.Framework.PSMobile.csproj
Your solution should look like the above image. Next we need to add references to your Game’s project. Right click on your game project’s references and choose Edit References. Check the Lidgren.Network.PSMobile and MonoGame.Framework.PSMobile projects.
Set a compiler directive
If you’re like me, a hot shot gun programmer, then you’ll probably want to link in your source files, and XNB files instead of copying them in. Gun programmers do this so they have less code to write, but your code should behave differently when it’s targeting different platforms. So let’s define a compiler directive of PSM for our Debug and Release builds.
Right click on your game project –> Options. Expand the build menu –> Compiler define PSM as a symbol. Define PSM for the Release Configuration as well.
AppMain.cs is where your application begins executing. It also contains definitions for Initialize(), Update() and Render(). Woah woah woah PSM, we’re MonoGame developers, MonoGame is going to take care of that stuff for us. Delete the other functions. Your AppMain.cs file should look like this. If it doesn’t, feel free to kill yourself for being a failure.
Import your C# Code Files
Right click on your Game project, Choose Add –> Add Files from Folder. Navigate to the folder where your XNA Game’s code lives and choose that folder. Choose include all, then go through and uncheck all the files that are not code files.
Next you’ll be asked if you want to Copy the files to your Project, Move them, or link them in. I suggest you link them in, but if you don’t care about being a good programmer, you aren’t interested in maintaining one code base and you are basically an asshole then choose to copy the files in.
Now you should have a happy project files with lots of C# source code files. All we need to do now is create a Game1 object in AppMain.cs, and then get it to run infinitely.
You might be able to get it to build, but chances are it just wont. I had to remove references to XACT, File.IO and some other stuff to get it to work. You should be able to figure it out on your own, if you can’t? Your probably not a very good programmer. Sorry.
Once you get it to build you will almost certainly run into a run-time error because you haven’t linked in any textures. But that’s good! It means you got it to build, and you can move onto the next step.
Import your XNB files
MonoGame doesn’t have a Content Pipeline, that was too much work, and too annoying for them to deal with, so basically we use XNA’s Content Pipeline. We want to import all the XNB files created by our XNA project. First up, create a folder called Content and place it in the root directory of your games project. Right click on Content and choose Add Files from Folder. Choose all the XNB files and just as before. Link them in if you are a real man, copy them if you are a jerk.
Next we need to set all of these XNB files to have a build type of Content. You can manually go through them and set them to Content, but if you have a lot of XNB files that will take a long time. What would a real programmer do?
A real programmer would open up the csproj file in a text editor and do a find and replace. Converting all the <None Include tags into <Content Include tags.