Results 1 to 10 of 10

Thread: Physics engines

  1. #1

    Physics engines

    I have been working a bit on game physics lately, especially on ragdoll physics, with lots of constraints. I have tried to make it work myself, and it isn't too bad... but it took some time.

    I have to ask me if I can save time by using a physics engine, but it is kind of hard to pick one. Some have FPC interfaces, like Chipmunk Physics, but I don't see any demos, at least not any without a lot of additional dependencies. Pappe seems not to be Mac compatible. Etc. The amount of work before I can see if an engine is anywhere near what I need mustn't be too big.

    Any suggestions for portable, Mac compatible physics engines with FPC interfaces (or, even better, written in FPC) without lots of dependencies and decent demos - in FPC?

  2. #2
    There is a full Chipmunk port to Delphi, which is very old and you will be needed to make an effort to make it works with FPC But it's can be done, year ago or so I done this, but then decided to make bindings instead of this

    Also there is a port of Box2D for Delphi. I don't know how it works now with FreePascal, but long time ago I didn't like it.

    like Chipmunk Physics, but I don't see any demos, at least not any without a lot of additional dependencies.
    That is ridiculous... really, if you just can't remove only one function(cpDrawSpace) of rendering via ZenGL(or just use latest svn revision from chipmunk-pascal with adding your own rendering functions), then I don't know... how are you planing to develop something using Pascal, world of which is far from "easy way to develop" in some cases? O_o At the end of the week I can spend some time for improving chipmunk-pascal and trying to port demos which I have to Linux/MacOS X(these demos use only OpenGL and GLUT, but now works only on Windows), but I don't think it will help you a lot... because if you want to develop something with non-Pascal libraries - you should understand C/C++ and be prepared for learning C/C++ demos. Just waiting for someone help, when almost everything is ready(bindings, simple demo) - luxury which other developers have no in other cases.

    Maybe I'm too rude, if so - excuse me, but text above is true.
    Last edited by Andru; 06-09-2011 at 04:40 PM.

  3. #3
    Quote Originally Posted by Andru View Post
    That is ridiculous... really, if you just can't remove only one function(cpDrawSpace) of rendering via ZenGL(or just use latest svn revision from chipmunk-pascal with adding your own rendering functions), then I don't know... how are you planing to develop something using Pascal, world of which is far from "easy way to develop" in some cases? O_o At the end of the week I can spend some time for improving chipmunk-pascal and trying to port demos which I have to Linux/MacOS X(these demos use only OpenGL and GLUT, but now works only on Windows), but I don't think it will help you a lot... because if you want to develop something with non-Pascal libraries - you should understand C/C++ and be prepared for learning C/C++ demos. Just waiting for someone help, when almost everything is ready(bindings, simple demo) - luxury which other developers have no in other cases.

    Maybe I'm too rude, if so - excuse me, but text above is true.
    I am not sure we are talking about the same thing. The dependencies I want to avoid are dependencies of large additional libraries, especially those that don't exist on all platforms. A package tightly integrated with some huge Delphi framework might take ages to port. If it uses a lot of Win32 calls, it can be complicated to replace that with something else (unless there is a well defined interface so there is only one place to make limited changes). If I can compile and run simple demos using only the package itself plus OpenGL, then it is pretty much perfect.

    The inspiration to the post came from the Box2D port you mentioned. It should be so right, but what I saw was a lot of porting work I had to do, for something I didn't even know if it worked properly. Coding in the dark is rather scary.

    However, Windows OpenGL code is no problem at all. Pretty much effortless.

    I do understand C/C++ code, and port (and to some extent - more often that I'd like - write) such code pretty much on daily basis. I have ported a lot of headers and code. But if someone has a comprehensive and complete API for FPC, then it would be a pity to be without just because I didn't know about it. My main target right now is to work from Chipmunk's C demos with the FPC headers... but maybe someone else had something similar, I thought.

  4. #4
    The dependencies I want to avoid are dependencies of large additional libraries, especially those that don't exist on all platforms.
    Strange, because Chipmunk(about which you wrote in first post) exists on every platform - Windows, Linux, MacOS X and some time ago I compiled it for iOS, so it can be used with FPC via static linking...

  5. #5
    Quote Originally Posted by Andru View Post
    Strange, because Chipmunk(about which you wrote in first post) exists on every platform - Windows, Linux, MacOS X and some time ago I compiled it for iOS, so it can be used with FPC via static linking...
    Yes, and that is my primary choice as I mentioned, and I have the static library on my disc already. But if someone had some FPC demos ready, it would be unnecessary to port the C ones. Or pointer to other alternatives which don't require major rewrites.

    But Chipmunk isn't generally what I see people recommend for ragdoll physics. They recommend Box2D, and there is also the Pappe library which promises support for ragdoll physics, but both these seem awkward to port to me.

    I am not afraid of porting code, far from it, but my time is limited and I must choose my battles. Small demos are easy to port, big ones are harder, and entire frameworks might take lots of time. Sometimes you just have to step back and see if there are other paths than the one you had in mind, before going too far on that one.
    Last edited by Ingemar; 07-09-2011 at 06:38 AM.

  6. #6
    Here the chipmunk demos for Windows. OpenGL and GLUT the only dependencies.

  7. #7
    thanks Andru , the speed is about equal to the original c++ demos , i recompiled it with delphi 2006 , seems delphi produce fast code than fpc

  8. #8
    Great! It compiled immediately, I have some link trouble so far but that should be managable.

  9. #9
    Quote Originally Posted by virtual View Post
    thanks Andru , the speed is about equal to the original c++ demos , i recompiled it with delphi 2006 , seems delphi produce fast code than fpc
    What is equal, Delphi? Do you mean Delphi is as fast or faster than FPC?

  10. #10
    Quote Originally Posted by Andru View Post
    Here the chipmunk demos for Windows. OpenGL and GLUT the only dependencies.
    It certainly is compiled, but an arithmetic overflow occurs at startup. Physics dovno not been updated, and of course with the current version of the compiler I think these errors are possible. How can I fix this? Or what other options there are, that would not suffer, and to connect the physics and can already be working.
    The very error occurs here:

    Code:
    if options.drawShapes then
      begin
        cpSpaceHashEach(space.activeShapes, drawObject, space);
        cpSpaceHashEach(space.staticShapes, drawObject, space);
      end;
    in the funtion draw by drawSpace module

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Comodo SSL