1. Trouble with the game?
    Try the troubleshooter!

    Dismiss Notice
  2. Issues with the game?
    Check the Known Issues list before reporting!

    Dismiss Notice

Calculus in BeamNG physics

Discussion in 'General Discussion' started by Funky7Monkey, May 26, 2016.

  1. Funky7Monkey

    Funky7Monkey
    Expand Collapse

    Joined:
    Oct 12, 2014
    Messages:
    977
    I'm doing a project in my Calculus class and would like to know how Calculus (specifically differential and integral) is used in the BeamNG physics engine.And to be honest, I just outright curious.
     
  2. amarks240

    amarks240
    Expand Collapse
    Guest

    It isnt. They just fudge everything and somehow it works pretty well.
     
  3. tdev

    tdev
    Expand Collapse
    Developer
    BeamNG Team

    Joined:
    Aug 3, 2012
    Messages:
    3,031
    whahahah xD
     
    • Like Like x 12
  4. tdev

    tdev
    Expand Collapse
    Developer
    BeamNG Team

    Joined:
    Aug 3, 2012
    Messages:
    3,031
    We have like 2M+ lines of game engine code, so somewhere its certainly used ;)
     
    • Like Like x 8
  5. estama

    estama
    Expand Collapse
    Developer
    BeamNG Team

    Joined:
    Aug 7, 2012
    Messages:
    267
    The basics of physics engines are Newton's laws of motion:

    https://en.wikipedia.org/wiki/Newton's_laws_of_motion

    On top of that you need to add a kinematic numerical integrator:

    https://en.wikipedia.org/wiki/Numerical_integration

    http://physicsforgames.blogspot.com/2010/02/kinematic-integration.html

    Looking at above you'll see that most of the differentials and integrals are being applied on vectors.

    Most of the equations that you'll see in a physics engine are of the differential kind, but there are times when you'll need to do the opposite and use the integral form of an equation.

    Apart from the laws of motion there are other physics phenomenons that are important in a physics engine. Such as friction, aero/hydrodynamics, pressure (for tires, balloons) and so on. For each of these phenomenons the corresponding physics equations need to be used [1] (in differential or integral form, depending on the problem ).

    The other big problem in physics engines are collisions. And more specifically collision detection which is a very difficult problem. Collision detection finds out pairs of objects that touch with each other. It also needs to find the specific points where the two objects touch. Having found that, collision resolution needs to happen to separate the two objects.

    If you are familiar with programming there are heaps of physics engines with available open source code [2]. There are also tons of tutorials and books about physics simulation freely available.

    [1] In BeamNG we have a huge dislike of "cheating" the physics. So we use the real physics equations. Other physics engines have different priorities (which is understandable) and may use simplifications or even not use anything resembling the real physics equations at all.

    [2] IMHO, a quick way to decide how much a physics engine's source code "sucks", is to count the number of trigonometric functions that you see in the physics core code. Each trigonometric function increases the "suckiness" factor (start from suckiness = 0). If suckiness is > 4, reading the source code is bad for you :p .
     
    • Like Like x 14
  6. James Smith

    James Smith
    Expand Collapse

    Joined:
    Mar 16, 2016
    Messages:
    265
    What do you mean by "suckiness", is that how accurately it depicts real physics?
     
    • Like Like x 1
  7. Josh

    Josh
    Expand Collapse

    Joined:
    Jul 21, 2013
    Messages:
    1,082
    lol, that made my morning.
     
    • Like Like x 1
  8. Funky7Monkey

    Funky7Monkey
    Expand Collapse

    Joined:
    Oct 12, 2014
    Messages:
    977
    That, and how hard it is to understand. Trig can be irritating, especially with calculus.
    --- Post updated ---
    Your post is greatly appreciated. I plan to research further into the topic. Do you mind if I quote you on some of this, because I would like to share it, and give credit to you.
     
  9. iheartmods

    iheartmods
    Expand Collapse

    Joined:
    Aug 8, 2012
    Messages:
    1,482
    A God has spoken.
     
    • Like Like x 4
  10. amarks240

    amarks240
    Expand Collapse
    Guest

    Please offer to license your physics engine to space engineers. I fell head over heels in love but havok is doing them dirty. If you haven't checked it out please do, they have a stupid awesome idea but the physics could use a genius injection from likes of you. Cheers @estama , your an all right dude.
    Edit: to me beamng is an engine first game second. If you guys managed to do what epic games did with unreal, the gaming landscape would be forever changed for the better. I'm not actually trying to tell you guys what to do with your tech, just letting you know I value it over world peace.
     
  11. iheartmods

    iheartmods
    Expand Collapse

    Joined:
    Aug 8, 2012
    Messages:
    1,482
    Havok physics disgusts me.
     
    • Like Like x 1
  12. amarks240

    amarks240
    Expand Collapse
    Guest

    It's a huge issue. Its a 10th as good as beam and it uses way less resources. Havok physics had its time and place in history, 2004.
     
    • Like Like x 1
  13. austint30

    austint30
    Expand Collapse

    Joined:
    Aug 7, 2013
    Messages:
    219
    The game The Crew uses the Havok engine and the game if very notorious with very glitchy collision physics.
     
    • Like Like x 1
  14. amarks240

    amarks240
    Expand Collapse
    Guest

    Explain this. The physics slows down with big ships in space engineers. Sure the ships are bigger than a beam car but there's a lot going on under the skin of the beam car. The kicker tho? Space engineers has havok updating 60 times a second. That's a far cry from the 2000 the beam team manages with their INFINATLY more accurate engine.
     
  15. SixSixSevenSeven

    SixSixSevenSeven
    Expand Collapse

    Joined:
    Sep 13, 2013
    Messages:
    6,960
    There is one major slowdown for space engineers that doesnt impact BeamNG. BeamNG is native C/C++. Space engineers voxel deformations arent calculated in the havok side, they are done in C#, a non native language. C# compiles to CIL bytecode run within the .NET virtual machine.
     
  16. amarks240

    amarks240
    Expand Collapse
    Guest

    Well thanks for that insider look on what's really happening. I hope they fix it somehow. The world needs a new engine that everyone can use. These indy devs would be putting triple a outfits out of business if they had the tools that the big dogs do. 15 guys are making better games than 150 man teams. Beamng and keen software house are perfect examples of the little guy doing it big.
    --- Post updated ---
    Well thanks for that insider look on what's really happening. I hope they fix it somehow. The world needs a new engine that everyone can use. These indy devs would be putting triple a outfits out of business if they had the tools that the big dogs do. 15 guys are making better games than 150 man teams. Beamng and keen software house are perfect examples of the little guy doing it big.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice