1. Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

razaron's Physics Engine Project Log

Discussion in 'Programming & Webmastering' started by razaron, Jan 31, 2012.

  1. razaron

    razaron

    Joined:
    Apr 26, 2008
    Messages:
    1,107 (0.48/day)
    Thanks Received:
    177
    Location:
    london
    I'm currently making the physics engine for an action rpg.

    Here's the engine. You need Java and a gpu/igp that supports openGL.

    Controls:
    -Enter pauses/plays the simulation
    -R resets the simulation
    -1, 2 & 3 selects a shape
    -A & D rotates the selected shape
    Feature checklist(not done, half done, done):
    -Rigid bodies
    -Cloth bodies
    -Fluids
    -Variable masses
    -Variable friction coefficients
    -Variable restitution (bounce) coefficients
    -Magnetism
    -Destructible rigid bodies (cracking, breaking)
    -Destructible cloth bodies (tearing)
    02/02/2012
    -Added different shapes
    -Made the screen bigger (800*600)
    -Under the hood changes

    31/01/2012
    -Functioning rigid body simulator
    [​IMG]
    If it closes on start up try changing the first word ("java") in the batch file to the path of your Java executable. Make sure to include the quotes around path.
    E.g. Change java to "C:\Program Files\Java\jre7\bin\java.exe"
    Last edited: Feb 2, 2012
  2. Maelstrom

    Joined:
    Sep 10, 2008
    Messages:
    534 (0.25/day)
    Thanks Received:
    159
    Location:
    VA/PA
    So i DLed it, extracted it, and doubled clicked the "Start" batch file, and nothing really happened. CMD popped up for a second, but that's about it. Am I doing something wrong? I have java installed and I know my gpu supports openGL.
  3. cheesy999

    Joined:
    Jul 2, 2010
    Messages:
    3,899 (2.61/day)
    Thanks Received:
    575
    Location:
    UK
    5002 on a phenom II x4

    CPU-Z + screenshot --> [​IMG]
  4. razaron

    razaron

    Joined:
    Apr 26, 2008
    Messages:
    1,107 (0.48/day)
    Thanks Received:
    177
    Location:
    london
  5. helloWorld New Member

    Joined:
    May 29, 2011
    Messages:
    177 (0.15/day)
    Thanks Received:
    32
    Location:
    USA
    I have Java 6 Update 30 installed and the nVidia 290.53 drivers installed with a GTX 580, so I believe that I am good on the software and hardware installed.

    However, I am running into the same issue that Maelstrom ran in to. Every time I try to execute the program, a command prompt pops up and then disappears within a second.
  6. pantherx12

    pantherx12 New Member

    Joined:
    Jan 2, 2009
    Messages:
    9,714 (4.77/day)
    Thanks Received:
    1,699
    Location:
    ENGLAND-LAND-LAND
    When I get to around 70 polys I get a massive performance hit.
    System specs <--
  7. razaron

    razaron

    Joined:
    Apr 26, 2008
    Messages:
    1,107 (0.48/day)
    Thanks Received:
    177
    Location:
    london
    You have to change something in the batch file but I'm not sure what. Sorry.


    Odd. I can get to 105-110 polys before the performance drops.
    This is probably because I've coded it in Java 1.7 (then ran it using Java 1.7).
  8. razaron

    razaron

    Joined:
    Apr 26, 2008
    Messages:
    1,107 (0.48/day)
    Thanks Received:
    177
    Location:
    london
    Change the first word ("java") in the batch file to the path of your Java executable.

    E.g. Change java to "C:\Program Files\Java\jre7\bin\java.exe"
  9. theJesus

    theJesus

    Joined:
    Jul 20, 2008
    Messages:
    3,965 (1.80/day)
    Thanks Received:
    859
    Location:
    Ohio
    And make sure to keep the quotes so it doesn't parse the space in "program files"
    razaron says thanks.
  10. theJesus

    theJesus

    Joined:
    Jul 20, 2008
    Messages:
    3,965 (1.80/day)
    Thanks Received:
    859
    Location:
    Ohio
    I can't get much past ~135 polys without it crashing (I assume due to the squares having to overlap at that point). At 128 polys it was ~1000fps
    razaron says thanks.
  11. theJesus

    theJesus

    Joined:
    Jul 20, 2008
    Messages:
    3,965 (1.80/day)
    Thanks Received:
    859
    Location:
    Ohio
    You have to press enter to start the simulation.
    Maelstrom says thanks.
  12. Maelstrom

    Joined:
    Sep 10, 2008
    Messages:
    534 (0.25/day)
    Thanks Received:
    159
    Location:
    VA/PA
    Reading comprehension fail on my part xD. I'm an idiot. Thanks though.

    OK, 2nd go. At around 90 blocks the program just crashes. FPS was way above 60 when it happens.
    razaron says thanks.
  13. razaron

    razaron

    Joined:
    Apr 26, 2008
    Messages:
    1,107 (0.48/day)
    Thanks Received:
    177
    Location:
    london
    Added different shapes
    Made the screen bigger

    Next up; friction and "bounce".
    Last edited: Feb 2, 2012
    theJesus says thanks.
  14. Maelstrom

    Joined:
    Sep 10, 2008
    Messages:
    534 (0.25/day)
    Thanks Received:
    159
    Location:
    VA/PA
    DL'ed the new version. It's entertaining, but I made it crash again, this time at only 25 polys (I had shapes flying all over the place).

    Edit: got it to crash even quicker. I created 4 blocks very quickly in the same position and it crashed. It doesn't appear to know how to handle lots of stuff overlapping.

    Edit 2: Yep, it is an overlapping problem. I created 7 block in the same area, pressed enter, and this happened:
    [​IMG]
    Crashes if you try to create more shapes.
    Granted, that's not the way you're supposed to use it.
    Last edited: Feb 2, 2012
  15. razaron

    razaron

    Joined:
    Apr 26, 2008
    Messages:
    1,107 (0.48/day)
    Thanks Received:
    177
    Location:
    london
    I think the crash happens because something is divided by (a number very close to) zero, lol.
    For the next update I'll make it so you can't stack 3 or more shapes on top of each other.
  16. pantherx12

    pantherx12 New Member

    Joined:
    Jan 2, 2009
    Messages:
    9,714 (4.77/day)
    Thanks Received:
    1,699
    Location:
    ENGLAND-LAND-LAND
    Downloading new version, is multi-core support something you will be implementing at all?

    New version is a whole lot better got to 196 before the frame rate took a massive hit and then crashed.

    I'd say 170 would of been above 300 fps still though.

    Will retry ina bit.
  17. razaron

    razaron

    Joined:
    Apr 26, 2008
    Messages:
    1,107 (0.48/day)
    Thanks Received:
    177
    Location:
    london
    After I've finished the physics engine I'll try offloading it to the GPU. If that fails I might make it use 2 threads. This is because the engine is for use in a game with a VERY big scope, so I'll need other threads to handle AI etc.
    theJesus says thanks.
  18. pantherx12

    pantherx12 New Member

    Joined:
    Jan 2, 2009
    Messages:
    9,714 (4.77/day)
    Thanks Received:
    1,699
    Location:
    ENGLAND-LAND-LAND
    Looking forward to GPU acceleration! :toast:

    Love apps that use my gpu XD

Currently Active Users Viewing This Thread: 1 (0 members and 1 guest)

Share This Page