Which physics engine is working with MonoGame?

Gah @craftworkgames now I don’t know which post to reply to, so I’ll do this one.

Awesome if you got the entire of the MonoGame branch running in a PCL, didn’t have time to fully test that out.
Now comes the rub, as a PCL can only reference another PCL you would need a PCL version of MonoGame with those class/struct definitions in it.

However the current direction of MG seems to be heading along the path of using platform specific libraries. Yes it looks increasingly that MG will be broken up in to several different namespace DLL’s (unclear how many yet, probably not as much as XNA) but they will stay class libraries.

However as you know from my Portable repo and my other work with MG that I am passionate about PCL’s and continue to fight to keep it a platform option. Talk with the core team progresses and they see the merit in it but there are bigger fish to fry.

As MG breaks up I will still continue to maintain a PCL varient of MG until such time as it can be effectively adopted into the mainstream and a 1st class citizen.
Keep an eye on the GitHub sight, big discussions are coming on this soon.

Tonight I put a working version of Farseer Physics as a PCL on github here:

It’s compiled against the MonoGame Portable NuGet package that @SimonDarksideJ created and in theory should work in any MonoGame project that can reference a PCL (most platforms) without the need recompile the source code.

If I’m right, anyone should be able to download this compiled DLL and reference it from their MonoGame projects and start using physics.
http://www.craftworkgames.com/blog/wp-content/uploads/2014/05/FarseerPhysics.Portable.zip

Based on the way the “bait and switch” method works, I think it will work on project’s that reference the official version of MonoGame. If this is true, we now have a really easy method of adding physics to MonoGame projects :smile:

Could I please get a few people to try it out on different platforms and see how it goes.

1 Like

@craftworkgames

This is what i get when i tried your .dll on my WindowsPhone Monogame Project. ( 3.2 )

Imgur

I think i need to recompile it for WP.

According to this blog post, that error could be caused because the file was downloaded in a zip file and Window’s is blocking it.

Apparently, if you right-click the file in Windows Explorer and go to Properties you should see an “Unblock” button. Try clicking that and see if the issue goes away.

Sorry, I had no idea this would happen, it’s the first time I’ve seen that error.

@craftworkgames Yeap, worked when i did that.

Just namespace is changed a little :smile:

using FarseerPhysics.Dynamics;
using FarseerPhysics.Portable.Dynamics;

Ah right… that namespace change was not intentional.
Must’ve been when I did some re-factoring with Reshaper recently.

Anyway, that’s great news. It means we CAN have a reusable physics library that works with MonoGame :slight_smile:

Yes, one week ago i don’t have any idea how to work with farseer + monogame.

Now, we have a couple alternative :smiley:

MonoGame Portable is not working for me. I always get some error messages: How can I install the portable version of MonoGame?

@craftworkgames
Is it possible to use the Farseer DebugView with MonoGame?

Yeah, this is why it is usually a lot easier to use NuGet to distribute dll’s as it handles all the component registration stuff

If you got queries about the portable version @fox9 its better to log it on my MonoGame fork rather than on here, as its not officially part of the main MonoGame project (yet)

Just started blogging again with this : How to use Farseer with Monogame and Windows Phone

Nothing fancy and probably you guys now all this but, hey. :smiley:

@semih​masat
Will your Farseer .dll work with the original MonoGame or just with Simon​DarksideJ’s portable version of MonoGame?
I’m not sure if I should use the original or the portable version of MonoGame.

@Fox9 It is working with original Monogame i didn’t tried with Portable Monogame.

@semih​masat
Which version of Visual Studio are you using in your tutorial? I tried to add Farseer Physics Engine to my solution, but some of the Farseer projects are not getting loaded. Which version of Visual Studio should I use to add Farseer correctly to my solution? I use VS 2013.

I’m using VS2013 Ultimate but i don’t think that whould be a issue.

You only need one Project to load and it is “Farseer Physics MonoGame”. It is OK that others are not loaded.

@Fox9 Like, this is ok for me : http://i.imgur.com/NuZZQWr.png

I can’t find the Windows Phone templates in Visual Studio 2013. They are missing and I don’t know how to get the templates.

In addition, I couldn’t find the Windows Phone Class Library template online.

@Fox9, which version of VS you are using ?

Can you try downloading these ? http://dev.windowsphone.com/en-us/downloadsdk

You can select the one which suits you.

@semih​masat
The last video in your tutorial doesn’t show how to install “MonoGame.Binaries” to a WPCL project via Nuget.
I tried it like this:
I run the following command in the Package Manager Console: PM> Install-Package MonoGame-Portable
Is that how I should install “MonoGame.Binaries” to my WPCL project via Nuget?

After that, I build the Farseer .dll and referenced it to a MonoGame Windows Phone 8 project. But I always get many Vector2 error messages. They look all similar to this error message:

Body Ball.LinearVelocity = new Vector2(0, 2.0f);
Cannot implicitly convert type ‘Microsoft.Xna.Framework.Vector2 [c:.…\GameName1\GameName1\bin\WindowsPhone\x86\Debug\MonoGame.Framework.dll]’ to ‘Microsoft.Xna.Framework.Vector2’ C:.…\GameName1\GameName1\Game1.cs

What is wrong?

@Fox9 You don’t need to ( and maybe shouldn’t i don’t know that ) use Monogame.Portable.

I fixed the video from blog.

But error looks like your code is may be wrong. Can you send the full code ? If you .zip your entire solution and upload that to somewhere it would be great and easy for me to test the code.

Thanx. It works now. But I can’t use the Farseer DebugView. I get the following error message:

using FarseerPhysics.DebugView;
The type or namespace name ‘DebugView’ does not exist in the namespace ‘FarseerPhysics’ (are you missing an assembly reference?)
Is the Farseer DebugView not in the created .dll? How can I use the Farseer DebugView in my MonoGame Windows Phone 8 project?