Windows to Linux port, game runs too fast?

Hi everyone. I’ve developed a game on Windows using the DirectX template. It works great. I set up Monogame and Monodevelop in Ubuntu 14.04, recreated my project using the Linux template, and got it running with little fuss. The only problem is that it runs ways too fast. I had developed this on Windows with IsFixedTimestep=false and scaled my all values by gameTime.ElapsedGameTime.TotalSeconds. I have tried setting IsFixedTimestep=true on the Linux project, no effect. I have also tried lowering all my speed values, no effect. I was hoping someone could shed a little light on this. Thanks for any replies!

What version of monogame are you using on linux, and what version on windows?

Also what graphics driver are you using on linux?

I admit that I’m not a normal Linux user.

On Windows, I began development with MonoGame 3.2, and had changed to 3.3.0.2032 to take advantage of some new fixes.

On Linux, I’m actually not sure how to find out which version of MonoGame I installed.
I installed MonoGame and Monodevelop all at once by following the instructions here:

As far as graphics drivers, running this in the terminal:
lshw -c video | grep ‘configuration’

gives me this:
driver=nouveau latency=0

I have an nVidia card and this is a fresh install of Ubuntu 14.04

You are using a very old version of monogame(2.8.x). You can install the newest version of monogame by doing:

#removes old version of monodevelop and monogame
sudo apt-get remove monodevelop-monogame libmonogame-cil-dev

#installs the newest version of monodevelop
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get update
sudo apt-get install monodevelop monodevelop-nunit monodevelop-versioncontrol monodevelop-database

#installs few libraries than monogame depends on
sudo apt-get install libopenal-dev libsdl-mixer1.2 referenceassemblies-pcl

You can get the new addin from: https://www.dropbox.com/s/73eeppcx1g3uycl/MonoDevelop.MonoGame_3.3.0.mpack?dl=0 , install it by going tool > addin manager in monodevelop.

Now for the driver I’m guessing you are using the opensource driver. For nvidia cards open source driver is quite buggy, so I recommend you install the proprietary driver. You can do it by opening “Additional Drivers”, and then select a proprietary driver, It will say something like: “Using Video driver for the AMD graphics accelerators from fglrx (proprietary)”.

I think your game was accelerated because of the graphics card driver, I know that “Super Meat Boy” was sped up for me because of it.

Ok, thank you for your help! I ran into a few problems though.

First this line:
sudo apt-get install libopenal-dev libsdl-mixer1.2 referenceassemblies-pcl
threw an error: E: Unable to locate package referenceassemblies-pcl
I left off the “referenceassemblies-pcl” and it worked though.

After that, I got an error while trying to instal the addin in Monodevelop:
The add-in ‘MonoDevelop.MonoGame,3.3.0’ could not be updated because some of its dependencies are missing or not compatible:
required: MonoDevelop.Core,5.0, found:
MonoDevelop.Core,4.012
required:MonoDevelop.Ide,5.0,found:
MonoDevelop.Ide,4.0.12

I was able to chnage the driver to and nVidia one, but haven’t been able to test it yet because I’m not able to build my project.

I spoke too soon! Got it working! I had to update my package cache to get the newest Monodevelop, without it, it just installed the old version.

Using the version of MonoGame you provided actually fixed the speed problem and it works great with even the open source driver. Thanks again!

Silly me, forgetting “sudo apt-get update”, anyway I added it to the commands above so that nobody else gets confused.

One last thing. Attempting to run my release build on another linux machine that does not have Monodevelop installed, but it crashes. I have installed the dependencies as listed here: http://www.monogame.net/documentation/?page=Setting_Up_MonoGame_Linux

sudo apt-get install libopenal-dev libsdl-mixer1.2 mono-runtime

looks identical to the dependancies you listed above for a dev environment with the exception of the mono-runtime, so that leads me to believe that’s the problem.

I get this error when it crashes:

Missing method .ctor in assembly /home/will/Desktop/Zombies2600/MonoGame.Framework.dll, type System.Runtime.CompilerServices.ExtensionAttribute
Can't find custom attr constructor image: /home/will/Desktop/Zombies2600/MonoGame.Framework.dll mtoken: 0x0a00001b
* Assertion at class.c:5597, condition `!mono_loader_get_last_error ()' not met

Stacktrace:

  at <unknown> <0xffffffff>
  at TwinStick.Game1..ctor () <0x00013>
  at TwinStick.Program.RunGame () <0x0001b>
  at TwinStick.Program.Main (string[]) <0x0000b>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

    /usr/bin/cli() [0x4b73d8]
    /lib/x86_64-linux-gnu/libpthread.so.0(+0x10340) [0x7f86049dc340]
    /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x39) [0x7f860463cf79]
    /lib/x86_64-linux-gnu/libc.so.6(abort+0x148) [0x7f8604640388]
    /usr/bin/cli() [0x638575]
    /usr/bin/cli() [0x6386b6]
    /usr/bin/cli() [0x5298e6]
    /usr/bin/cli(mono_class_get_full+0xe2) [0x52a0c2]
    /usr/bin/cli(mono_field_from_token+0x105) [0x54b395]
    /usr/bin/cli() [0x450a5c]
    /usr/bin/cli() [0x421e2e]
    /usr/bin/cli() [0x4253cd]
    /usr/bin/cli() [0x425ecb]
    /usr/bin/cli() [0x4b845b]
    [0x40de9166]

Debug info from gdb:

ptrace: Operation not permitted.
No threads.

=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

The error is probably caused because of the mono version. You can either use the monodevelop repository to get the newest version of mono or you could try including mono with your game(ie. Mono Kickstart - https://github.com/OutOfOrder/MonoKickstart)

Great! Mono Kickstart worked and it’s a nice simple solution. Thanks for all your help!