Game Development Community

[CLOSED] - Farseer Phsyics Integration - Any pointers?

by Ron Barbosa · in Torque X 2D · 07/29/2010 (12:51 pm) · 234 replies

Hey all...I've just recently started looking at some demos and videos for Farseer Physics.

I was curious if anyone here had done or is considering a Farseer integration with TorqueX. If so, how's it going for you?

I am admittedly ignorant in the use of the physics engine, so I have no idea where to begin...but I'm just curious if folks are even trying this and whether or not it integrates fairly simply or if it will detract too much attention from my game build.

I don't want to take a 2-month detour from my game project just to integrate the physics. My game project is going to be a value proposition. I want to sell it cheap and see if I can push volume...so if it doesn't have a proper physics implementation, or uses only the TX physics...that's ok. But if I can spend a couple of weeks or a month on the Farseer integration...that might help push sales volume.

Thanks!
--RB
#101
08/23/2010 (9:01 am)
@Henry: there are Engine changes in this so I don't really see a binary only integration. It'll work but the developer workflow will be different having to use the FS components only to operate on the SceneObject so it's not the best way to go.

I guess people will move to the Pro version if they want this, IMO it's the best way to go.
#102
08/23/2010 (9:46 am)
If binary owners want physics then they have the option of using Will's APE engine port, of course.
#103
08/23/2010 (12:22 pm)
Hey all...the latest updates are in. Sync your checkouts or download the latest rev of the online repository to check them out.

Enjoy...
--RB
#104
08/23/2010 (4:51 pm)
@Pino that is exactly what I was wondering about. I guess I could have paid more attention to the SVN however I don't know what are bug fixes and what are changes to deal with Farseer.

Does the latest SVN also reflect the changes that TorquePowered made to the engine and posted on the 17th?
#105
08/23/2010 (5:16 pm)
Ga If only I had this feature 2 years ago what my game could have been ;). I'm very excited to see this physics solution integrated. Next project!
#106
08/23/2010 (5:21 pm)
@Henry...just to be clear...I don't want to call the engine changes I've made "fixes." They are more like integration updates. Basically once you've positioned a body in the Farseer simulation, Farseer keeps track of its location and updates the simulation each tick.

You may have 10 other components associated with the SceneObject that modify its position, rotation, and/or velocity. The integration updates I made ensure that those modifications done through the stock TX2D classes are reflected in the simulation.

Binary users would have to ensure that ALL changes to position, velocity, rotation, or any other spatial property of the body are done STRICTLY through the Farseer components. Any updates done through stock Torque X classes would desynchronize the visual objects from their physics simulation counterparts.

Hope that clears things up...
--RB
#107
08/23/2010 (5:51 pm)
@Henry: in the SVN Commit description is written if it's a fix or an enhancement or whatever else :) Our engine has all the fixes included in last 3.1.5 and more that will be included in next official version ;)

Have you seen my post on CCO? I even found a name for this engine of ours :)
#108
08/23/2010 (6:10 pm)
@Pino...I have not been very active at CCO, and I couldn't find your post. Can you link to it here?

I'd be interested in seeing which forums on CCO are worth paying attention to.

Thanks!
--RB
#109
08/23/2010 (7:10 pm)
So: My question would be is TX faster, or is farseer faster? Farseer obviously has the better toys, but what if I'm simply doing a number crunching simulation - who wins? Maybe I'll cook up a sim level tonight to see what happens. My game is in the *very* early stages right now and which I choose to work with will be 100% predicated on overhead. As things stand currently there's no direct benchmark - perhaps I should create one...

My next game project may want to have as many as 1000 physics driven objects on screen at once (predominantly bullets that will die if they touch something they can actually collide with) so I'm curious which one is faster. The sim I'm doing doesn't need gravity like a plat former, so I'm really just interested in which one will perform better. Now that I have a choice, I'm curious.
#110
08/23/2010 (10:37 pm)
@Christopher: With the new Farseer integration you are able to utilize a lot of the farseer engine with the GUI of TXB (example: add your objects, set them up with the component of choice and your colliding, flying ... or falling).

Let me know if you need help setting up the SVN after you get it.
#111
08/24/2010 (12:11 pm)
Hey all...I've recently ordered parts to build a new PC, and they will be arriving tomorrow.

Typically, I do most of my game work during a few hours every other night or so and on weekends. This weekend, I will almost certainly NOT be doing any development since I will be building my new box and getting my OS and build environment back up and running.

I just wanted to pause and take the temperature of the Farseer integration and ask if there are any little tidbits that you feel you absolutely NEED over the next couple of days? If there are a few things that I could maybe spend a few hours knocking out between now and the weekend that would make the integration more useful to you, please speak now.

Things that you will NOT get because I just won't have the time this weekend:

  1. Collision categorization
  2. Polygonal bodies and geoms
  3. Controller definition and integration

;)

Think more along the lines of maybe hitting a few more stock Torque X integration areas, or exposing some more properties in the various springs and joints (although I don't think there are any left). I may also take a stab at the Weld joint, which doesn't show up in the docs at all, but is there in the code. That one might be a worthwhile addition.

I'm open to thoughts on where to focus my next few hours...I'm just trying not to leave any gaping holes since my next significant update will most likely not be done for at least another week and a half.

Thanks!
--RB
#112
08/27/2010 (1:07 am)
@Pino: Sent you some code to test. I am trying to update the scene Gravity value in the assigned FSPhysicsManagerComponent, but nothing is happening.
#113
08/27/2010 (12:00 pm)
Hey all...quick update...my new parts for my PC came in, but the motherboard is exceptionally flaky, so they overnighted me a replacement board. I'm hoping that solves the problem, but I won't get the board until today.

I'm going to be a few days before I get my build environment set up and get back to work on the Farseer stuff.

Please post any bug findings or update requests here.

I dismantled my old workstation to make room for my new box, so I don't really have a machine to work on right now.

I'll be back in action soon...thanks for your patience.
--RB
#114
08/27/2010 (4:23 pm)
Hey guys,

I'll have a look at this issue, sorry for the delay but the time zone difference is not helping :)
#115
08/27/2010 (5:41 pm)
Ok then,

I had a quick look and found a small inconsistency. I've corrected it and just committed to the SVN repo.

I didn't run a test because it looks to me quite evident, let me know if this has actually fixed the Gravity issue.

Cheers,
Pino
#116
08/27/2010 (5:55 pm)
@Pino...good catch. I looked at the diffs. Must've been asleep at the wheel when I missed that one. :)

@Aaron...what Pino found (if I'm reading the diffs correctly) was that the FSPhysicsManagerComponent was capturing changes to gravity, but not communicating them down to the Farseer phsyics simulation. This would allow changes to be recorded only between scene loads and not realtime.

Please post your findings and let us know if it works.

Thanks, Pino!
--RB
#117
08/27/2010 (6:03 pm)
@Ron: I make myself a lot of those mistakes because of the crazy hours... coding in the middle of the night entails that :)
#118
08/27/2010 (9:13 pm)
Just to document this I'm creatind some video:

#119
08/27/2010 (9:53 pm)
Wow that looks amazing!
#120
08/27/2010 (10:07 pm)
Here's a basic linear spring demo: