Developing Linux games with MonoDevelop

Source: Internet
Author: User
Tags microsoft website

Given that Microsoft will give up Xna,monogame will be a new choice for friends who like XNA, he is an open source implementation of the XNA game engine, and is cross-platform, which means you can use him to develop OS, Android, Windows and Linux applications, how to give a new choice! MonoDevelop is an open source integrated development environment for Linux, Mac OS x, and Microsoft Windows, primarily for the development of mono and. NET Framework software. MonoDevelop for Monogame is like Microsoft's VS2010 and XNA, this article will show you how to use MonoDevelop to develop monogame-based games under Linux, you will find game programming under Linux has never been easier!

Based on ubuntu14.04, this article explains:

1. Installing MonoDevelop

sudo apt-get install MonoDevelop

Or search Monogame in the Software center and select Xna-ide to install it as follows:

Installation of MonoDevelop will automatically install Monogame

2. Run a Linux-mono game

Open MonoDevelop, the interface is as follows:

  

Click "New" to start a new project, enter the project name, and working directory, and so on, as follows:

  

Then, just press F5 to run, we can see the familiar blank game----a blue box:

  

Although this is just a box, its meaning is significant, which means we can start a fantastic Linux game development tour!

3. Small trial sledgehammer----transplant XNA Standard sample program platformer

Platformer is a Microsoft to give a XNA sample program, can download on the Microsoft website, Baidu "XNA platformer" can.

It is not possible to open the downloaded platformer project directly in MonoDevelop, it may be that the project format of mono and VS is different, but it doesn't matter, we can create a new Platformerlinux project in MonoDevelop, Then add the files in the sample project to this project, as highlighted in several files, the Game1 file that comes with the new project can be deleted.

  

Note here that the content directory we did not add, because MonoDevelop cannot directly edit the resource files, slices, sounds, etc. into XNA recognizable format, that is, the XNB format. So even if you add it to the content directory, it doesn't help. We can compile these resources by building a XNA project in Windows VS, and then copy them directly to the bin/debug/content of the Mono project, and you can compile the resources directly using the XNA Compilation tool, which saves you the hassle of building a project in vs. There are already xna-compiler available under Linux.

Here, for convenience, we compile the sample version of platformer in Windows, and then copy the contents of Bin/debug/content directly to the bin/debug/content of the Mono project, and then press F5 to run directly, Exciting things have happened and run successfully! As follows:

  

The game is really running, but we found two obvious bugs:

1) The game starts with the player hanging off, press space key to continue on OK;

2) The game background music no sound, other sound effects OK;

For the first bug, I found that because of the eclisped time of the update in mono, I found that when Monogame was paused, Eclispe was walking. In the first run of the mono game, the update function gets a long gametime time, according to the logic of the game will naturally get the player to hang off the conclusion, the reader can self-elaboration. I can limit the elapsed variable in the Applyphysics function of the player class , as follows:

  if (Elapsed > 0.05f)
elapsed = 0.05f;

Then run again and discover ok!

As for the second bug found to be the Plateformer class Mediaplayer.play (content.load<song> ("Sounds/music")), this sentence carries some problems when loading music, Seemingly content can not load song type, this as a legacy, follow-up study.

Developing Linux games with MonoDevelop

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.