Pluralsight blog Where devs, IT admins & creative pros go for news, tips, videos and more.
Pluralsight + Digital-Tutors - 3,000 tech & creative courses - starting at $29/month Get it now →
September 20, 2012

Meet the Author: John Sonmez on Cross Platform Game Development with MonoGame

By

In today’s episode of our Meet the Author podcast series, Fritz Onion talks to John Sonmez about his course Cross Platform Game Development with MonoGame.  In the interview John explains the correlation between MonoGame and Microsoft’s XNA framework and how projects can move between the two environments to support building games for Windows, XBox, Windows Phone, iOS, and Android.  He also take the opportunity to predict the future of of MonoGame in the Windows 8 world.

Listen to the Audio (MP3)

Meet the Author:  John Sonmez on Cross Platform Game Development with MonoGame

Transcript


[Fritz] Hi this is Fritz Onion. I’m here today with John Sonmez to talk about his new course, Cross Platform Game Development with MonoGame. John is a longtime C#, .NET developer with roots in C++. He’s recently been building applications for Android and iPhone and has started to put a focus on mobile application development. He spent many years working as a consultant for a number of projects and has deep ties to the agile community. He’s also very interested in automated testing using tools like WatiN or Selenium. On any given day John could be programming in C#, Java, Objective-C, VB.Net for perhaps all of the above. Welcome back John.

[John] Thanks Fritz.

[Fritz] So this new course of yours, Cross Platform Game Development with MonoGame, really interesting topic especially with the proliferation of platforms we have going on today for developers, let me just outline the course for everyone. You introduce MonoGame, and then you walk through the process of building a little game, in this case it’s a Pong clone. And then you go ahead and deploy it to a number of different target platforms including Android, IOS, Windows Phone 7 and several others. So I have to share a little story with you that kind of struck–made me think of my experience in Game Development as I watched your course, which was I built a game in C for the Macintosh back in the early 90′s called Club Racquetball which is published through Version Games, and I remember at that time writing in C and I think the whole game was like 10,000 lines of code, and I used the Mac toolbox to do my frame flipping and spray animation. And it was a daunting task but I got through it. But looking back that was such a narrowly scoped platform at the time, that if I were writing something similar today and I wanted to have more than just a Mac, it would take a significant development effort to really get something out there. So this concept of a single platform for doing game development is really intriguing. Have you had a similar experience yourself?

[John] Yeah just in non-game apps as well just in trying to create apps for Android and then porting them over to iOS and so forth. It’s a lot of work when you’re not able to share the code, when you don’t have a single platform; and on the game side as well it’s always been somewhat intimidating to try and build a game. I think a lot of people would love to get in game development but the big problem is you invest a lot of time, a lot of energy into the game and then you want to get at least some kind of return on it or you want to be able to run this in multiple platforms and so it kind of puts this barrier in place where you don’t want to invest all that time and effort knowing that you’re just building an Xbox game, or you’re just building a Windows game, but that’s the neat thing that I think about MonoGame is that now you have a little bit more motivation. Because if you can build a game you can use whatever tools you want, you could build it on Windows 7 and then import to iOS and Android. You can build that game one time and then pretty much build it right on all those platforms, put in all those app stores and you’re really able to be somewhat of a single person developing a game versus all these large game studios that have hundreds of developers working on a game.

[Fritz] Yeah that’s really enabling. So let’s talk about exactly what MonoGame is. You mentioned it’s cross platform and it’s Mono so I assume that it’s part of the Mono project so it’s something–I’m sure you use C# to develop with it and what exactly does it use for a platform?

[John] Sure so it is basically just a portion of XNA so you can really replace the word MonoGame with XNA and you can think of it as running XNA on everything. Because that’s really what the goal is so everything that you’re–looking for information on MonoGame can really search for XNA and that kind of helps because there’s so much information out there on XNA. So really when you think about what can you do with MonoGame and what is MonoGame, in the simplest terms it’s just a port of XNA. You in fact in my course you can experiment with the real XNA game, I take an XNA project or I take a MonoGame project and I convert it directly to XNA for Windows Phone 7. So it’s really that compatible. It’s really almost the same thing, and that’s the best way to think about it because it’s sometimes confusing to try and say oh how exactly does MonoGame work and what is the environment. You can really just think of it as XNA, whatever you use in XNA so you use C# to develop an XNA game; and the same type of techniques and tools, and then you could even start an XNA and then just take that XNA game and just a few simple steps to turn it into a MonoGame.

[Fritz] Hmm I see. And just to be clear XNA is the platform for game development for the Xbox as well as for targeting Windows applications in .NET. So the other question I had I guess is how cross platform is this? If you build something in XNA and I assume you can do this in Visual Studio or MonoDevelop, those are the two environments where it works, where do you…what’s involved with bringing it to multiple platforms? Can you kind of give us the rundown of how that works?

[John] Oh sure. So it’s actually pretty simple, pretty straightforward. So it depends on the platform. There’s a few steps of getting yourself set up with MonoGame on that platform, but for example let’s say that you had like the simplest conversion might be from a Windows 7 XNA game to a Windows 7 MonoGame. All you’re doing is just creating a new project that’s a MonoGame project, and then you’re just copying all your files in or linking to them and it will just run just like that. Now if you wanted to let’s say develop for or convert your game into Android, what would you need to do? Well you would need to have mono for Android installed on a Mac because you need the basic development environment that you would develop in Android application and for a mono for Android application. Which a lot of people could look at the different ways to develop those so the courses that we have on MonoTouch and Mono for Android would be helpful there. The basic idea is once you have that environment set up and the only thing you really have to do specifically for MonoGame is you just have to create the bootstrap code so just a launcher. So for Android we use an activity to launch it so we would just create a regular Android project, move our files and reference our MonoGame DLL’s and then just create an activity that launches our game and that’s pretty much it. And for each platform it’s pretty much just that simple.

[Fritz] So you just created a project in the Mono environment appropriate for that platform, bring your code in or reference it as an assembly I assume, and compile it and off you go.

[John] Exactly.

[Fritz] Great. So the other question I had for you John was what is the future of the XNA platform if it’s so compelling and easy to use and deployed to multiple platforms, how much is being invested in it and are we going to continue to see support in even more platforms in the future.

[John] Good question so I think that and I don’t have a crystal ball, but I would speculate that MonoGame is going to continue to grow and that it’s going to continue to grow larger and there’s one really compelling reason why I say this. And this is–right now let’s say that you wanted to do Windows 8 game development. Well your only real choice right now as a developer is to use Direct X11 directly and use C++ because there is no XNA for Windows 8 and there may never be according to Microsoft. So the MonoGame platform actually in the latest version in the development branch, supports Windows 8 and so you could actually develop an XNA game or a MonoGame for Windows 8 using MonoGame and also in that development platform. There’s support for the new PlayStation platform that’s going to come out here, there’s probably going to be support for Windows 8 phone devices and you have full 3D support and there’s some interesting games that are already out there. In fact, one game to check out is called Armed and that game is in the Windows 8 store right now and it’s a very nice looking game, very smooth graphics, and it’s actually built with MonoGame.

[Fritz] That is encouraging. One last question for you which is when you’re dealing with a platform like this that is cross platform, an environment that is cross platform; you often pay a penalty in performance for building it once and trying to deploy it in multiple places. What is your experience in using MonoGame for efficiency and actually can you do full 2D animation on full screen with this thing?

[John] Yeah actually I’ve had pretty good experience with it and one good demonstration I always go back to is there’s a game called Infinite Flight and I mention this in my courses–well I’ve got the link in there. But if you just search on the Apps store in iOS for Infinite Flight you can see a full 3D flight simulator built using MonoGame and it is very smooth animation and that’s 3D graphics and it works really well. So I’m sure there’s some differences in the frame rate, but it definitely works well enough at this point to launch games with it and I know it’s being improved all the time, but this is one of those things where you can have a lot of micro optimizations because once the XNA API is built out, they continue to work on this little obviously performance tuning and things like that and in the development 3D branch which is the development branch of MonoGame, I know there has been a lot of work to improve the performance.

[Fritz] Well that’s great to hear. Awesome well this is John Sonmez with his new course Cross Platform Game Development with MonoGame. Thanks very much John.

[John] Thank you.

About the Author

is a Chief Architect specializing in large scale distributed system development and enterprise software processes. Paul has more than twenty years of development experience including being a former Microsoft MVP, a speaker at technical conferences such as Microsoft Tech-Ed and VSLive, and a published author. Prior to working on the Windows platform, he built software using a vast array of technologies including Java, Unix, C, and even OS/2.


Discussion