Farseer Physics Engine in Blitzmax Demo

Community Forums/Showcase/Farseer Physics Engine in Blitzmax Demo

AlexO(Posted 2008) [#1]
Hi,

I've ported a majority of the functionality found in Jeff Weber's Farseer Physics Engine that was originally written in C# for XNA/Silverlight. Below is a link to a video showing some of the same demos running in native Blitzmax, along with a link to the demo app itself.



YouTube Video
Another video showing Angle Limit Joints

Demo zip file:
Farseer Physics BMX

Requirements:

- Windows XP/Vista
- Direct X 7 or higher capable video
- Minimum supported screen resolution: 1024 X 768

Known Issues:

- In Vista the fps are lower (and in some demos locked to 60 instead of 100 fps).

I'd be interested in two things for any of those that give the demo a try:
1. What are your computer specs and also average FPS in demo 4 and demo 8 when you are:
a) sitting idle
b) moving and bumping into objects a lot

2. If anyone knows why in Vista the FPS are really crappy when using the D3D7 driver. When I switch it to openGL my FPS go back to normal as if it were on XP.

For more info on what I'm planning with this Blitzmax version of Farseer you can check it out here.
:)

***EDIT***
5-28-2008
- added another youtube video link
- made a blog post with a status update of the engine.


slenkar(Posted 2008) [#2]
looks very good

I got 0 FPS on the 8th demo but that could have been the sheer number of sprites on the screen because my intel video card has a very slow fill-rate.

On the other demos I got about 60 FPS


AlexO(Posted 2008) [#3]
thanks!

was that on vista or XP?


EOF(Posted 2008) [#4]
Demo 4 = 2FPS in motion and 4FPS if i leave everything alone
Demo 8 updated roughly 1 frame every 1.5 seconds

XP Pro on Sony Vaio laptop Intel 915GM 128MB integrated gfx

Nice music on the youtube video!


ziggy(Posted 2008) [#5]
Vista renders DX7 translating the api calls to DX9, so it is slower always. I've got the same drop down in all my projects under Vista when using DX. By the way, that looks completelly awesome. Loved the debug mode :D


M2PLAY(Posted 2008) [#6]
Awesome!!! Good work!!
In all the demos 100 FPS even with debug actived
XP Profesional, Intel Core2Duo 3GB RAM, Nvidia 5800GT 512Mb



M2PLAY(Posted 2008) [#7]
Oppps sorry !!!
Nvidia 8500GT 512 Mb


GfK(Posted 2008) [#8]
100FPS on everything except number 8, which was 2-4fps.

Athlon XP3000 @ 2.2GHz, 1.5GB RAM, Nvidia 7600GT 256MB, Windows Vista.

Are you throttling the frame rate at 100fps?


Yahfree(Posted 2008) [#9]
100 FPS on everything, 70 FPS on 8(while everything was running around the screen)

P4 3.0GHz, 1 GB RAM, NVIDIA 9600GT 512MB, Windows XP


nawi(Posted 2008) [#10]
Only on Windows = Useless. BlitzMax is supposed to be multiplatform. Next time choose an open an free physics solution.


AlexO(Posted 2008) [#11]
@Jim Brown
I'm curious on the performance on the other demos if those two were so low. Are they all sluggish also? Thanks for that info, will be looking to see if I can improve that a lot. As I want this to run on as many machines as reliably as possible.

@M2PLAY and @Ziggy
Thanks! Glad you liked it!

@Yahfree
Thanks for the info!

@Gfk
Thanks for the info. I'm going to be doing some extensive testing on lower end machines in the coming weeks. I wonder if it's the fill rate, my fixed-time step logic, or the actual physics engine not being efficient enough. I imagine it's a combination of those three that's causing some people to get bad frames during the more intensive demos.

The FPS was set to 100 in the graphics call (the hertz rate). While 100 isn't realistic for most games, it helps me benchmark actual performance tweaks I implement on the engine so I can see visible improvements.

Going to be doing another build with more extensive diagnostic tools in the coming weeks along with more engine features.


AlexO(Posted 2008) [#12]
nawi

Only on Windows = Useless. BlitzMax is supposed to be multiplatform. Next time choose an open an free physics solution.



There's nothing stopping this from being a mac and linux solution either. It's 100% written in Blitzmax. I just don't happen to have a mac or a current linux install to compile on. I intend to get both working, but want to get the engine feature complete first.


xlsior(Posted 2008) [#13]
Only on Windows = Useless. BlitzMax is supposed to be multiplatform. Next time choose an open an free physics solution.


Apparently it would work on non-windows as well, but still: Just because blitzmax in general is multi-platform, it doesn't mean that certain code that is platform specific isn't appreciated as well.

Not everyone writes code for all platforms, after all.


slenkar(Posted 2008) [#14]
was it difficult to port C# code over to blitzmax?
did you have to convert it to C ?


AlexO(Posted 2008) [#15]
The C# physics engine lent itself pretty well to porting to Blitzmax. Since it was designed from the ground up to be fast it stayed away from a lot of the 'C# candy' (for example: delegates) for the most part. There is very little difference, implementation-wise, between the Blitzmax and C# version. In fact, there were some portions of the C# code I ended up copying/pasting directly into Blitzmax with no syntax changes. So no, the port wasn't difficult just takes a while to do it plus debugging :). I did not have to convert any part of the code to C. I hope to keep it that way.


nawi(Posted 2008) [#16]
There's nothing stopping this from being a mac and linux solution either. It's 100% written in Blitzmax. I just don't happen to have a mac or a current linux install to compile on. I intend to get both working, but want to get the engine feature complete first.


Okay, I just thought that the lib itself was Windows only.


EOF(Posted 2008) [#17]
> @Jim Brown
I'm curious on the performance on the other demos if those two were so low. Are they all sluggish also?

All others are rather good Alex. I get 100FPS most of the time.
Having restarted the laptop and set performance to HIGH I can now get:

Demo 4 = 70FPS moving or static
Demo 8 = 4FPS moving or static

Hope that helps


AlexO(Posted 2008) [#18]
Thanks Jim that data is helpful. I forgot that some laptops operate at slower clock speeds and what have you with lower power consumption.


Armitage 1982(Posted 2008) [#19]
Laptop on Windows XP SP2
Intel Core 2 Duo CPU T7250 @ 2ghz
2Go RAM
Nvidia GeForce 8400 GS
1280x800x32 @ 60Hz (probably why the refresh is poor in window mode)

Every Demos except 8 : 100fps~102fps Idle
with demo 8 : 88fps~98fps Idle
Playing with demo 4 : 86fps~96fps
Playing with demo 8 : 79fps~101fps (look better than idle ?)

Do you have plan to release this as a module community or something ?
And any idea about the license ?


AlexO(Posted 2008) [#20]
Thanks for the info Armitage. I do plan on releasing this to the community to use. I imagine a 'module' is the preferred way to distribute reusable blitzmax code for the community, but I may also just distribute the source as-is for those that want to keep the source with their game project folders and just do an 'import farseer.bmx'. Any comments/suggestions on that matter would be appreciated.

Also, Armitage I've replied to your above questions and the ones you posted on my blog in the comments section.


AlexO(Posted 2008) [#21]
For those interested in keeping up with the status of this engine I've posted a youtube video of some of the new joints I've ported over.
More info can be found on my blog. The youtube video can be found here.


Axel Wheeler(Posted 2008) [#22]
Great stuff!

I got about 40-100 fps normally in demo 4 regardless of activity level (but see below).

In demo 8 it went from around 14 fps with nothing happening to 1 with lots of stuff happening.

I noticed two cool/odd things in demo 4:

1. Even though the blocks clearly have friction (they slow down quickly when sliding) they seem to have a constant microscopic jiggle which causes them to move slowly. The pyramid will collapse by itself in time. I had fun just trying to keep this from happening! I would "fix" the pyramid by dragging the blocks as needed, but it eventually always falls. Add a timer and you've got yourself a game!

2. As I adjusted the blocks I sometimes found the framerate dropping way down (to 1 sometimes) until I stopped adjusting things (then it would slowly return to normal). The sluggishness was unrelated to the actual activity level; only to how frequently I was clicking and dragging.

I have a Dell Dimension 2600 w/ Intel integrated graphics (82865G).
P4 2.8 GHz
XP Pro SP2

I hope this helps.

-Axel