Why is physics so fun?

Discussion in 'Game Development (Technical)' started by zoombapup, Jul 12, 2010.

  1. zoombapup

    Moderator Original Member

    Joined:
    Nov 25, 2004
    Messages:
    2,890
    Likes Received:
    0
    So I spent a day and added physx to my engine to replace some of the Box2D functionality and to replace my own raycast code I'd been using (I need some swept box stuff for cover selection for my game).

    Why is physics so much fun to noodle with?

    I uploaded a youtube video of a work-in-progress when I was part way done (I've fixed the dodgy box transform rotations now), so I thought I'd share.

    http://www.youtube.com/watch?v=V5AIKvoSLW8

    Now I've got to concentrate on the FPS controller for a bit. Getting that right is very important to the game after all. Then its a fun part with the squad controller.

    Since I've been doing it almost fulltime, I'm really enjoying it again!
     
  2. Desktop Gaming

    Moderator Original Member Indie Author

    Joined:
    Feb 24, 2005
    Messages:
    2,296
    Likes Received:
    12
    I think you have to appreciate the maths behind it. Otherwise wouldn't we be equally impressed and gaze in wonder at bits of paper blowing about in the street?
     
  3. Applewood

    Moderator Original Member Indie Author

    Joined:
    Jul 29, 2004
    Messages:
    3,859
    Likes Received:
    2
    You will change your mind when you come up against the minutiae. Like balls not rolling over slivers, bullshit radii (can't think of a better term) for small objects, etc. etc.

    It's funny, but I've grown to hate physics engines with a passion. None of the engines "just work". The closest we've ever got to something that does is ODE, but the flaw there is that there isn't a single person on the entire planet who can explain how to set up the friction coefficients without being a smart arse.

    /grump
     
  4. Swattkidd

    Swattkidd New Member

    Joined:
    Oct 22, 2007
    Messages:
    62
    Likes Received:
    0
    I think it has to do with the fact that we create a little world or box full of "objects" that react to each other in so many ways that even you get surprised and can enjoy things that happen because you didn't code it to be that way. It is like breathing life into your objects almost.
     
  5. zoombapup

    Moderator Original Member

    Joined:
    Nov 25, 2004
    Messages:
    2,890
    Likes Received:
    0
    Hahaha, you grumpy git. Luckily I only needed it for the raycasts and swept collisions rather than any physics response. So I'm off the hook for any of that nonsense.
     
  6. zoombapup

    Moderator Original Member

    Joined:
    Nov 25, 2004
    Messages:
    2,890
    Likes Received:
    0
    Actually, that would be pretty fun too. Maybe its just my simplemindedness :)
     
  7. hippocoder

    Indie Author

    Joined:
    Mar 18, 2008
    Messages:
    591
    Likes Received:
    0
    Box2D is the least fiddly one I've played with but then it is 2D and meant to be a bit simple. My current game is physics based and its good fun in 2D to play around with.

    In 3D its a bit of a mare indeed, I recall playing with ODE and Tokamak. Tokamak was really spot on, it pretty much just worked. But not actively developed like the others.
     
  8. vjvj

    Indie Author

    Joined:
    Sep 25, 2004
    Messages:
    1,732
    Likes Received:
    0
    Welcome back to PhysX, teeheehee :p

    Yep, it's fun as hell, and I really learned a lot from the documentation. I remember first getting started in Bullet and pulling my hair out trying to get things to work the way I wanted to... Then I started reading the PhysX docs on stuff like character controllers and it was like I leveled up in game programming.

    We aren't using physics for anything super complex, but the base combination of simple dynamics + triangle soup for static geometry + kinematic objects + character controllers is a huge time saver and is applicable to practically every action game imaginable.

    Was this for that pool game you guys worked on? What solution did you end up settling on?
     
  9. Applewood

    Moderator Original Member Indie Author

    Joined:
    Jul 29, 2004
    Messages:
    3,859
    Likes Received:
    2
    This is now why we have ODE integrated into our engine.

    It can't deal with slivers too well either with the default setup, but you can at least handle that by hand as you make your own contact normals (easily). You don't need a bullshit radius like you do with some engines, either.

    As I hinted at above though, the problem is that friction is something you largely have to plug in yourself and it just doesn't work as you'd expect/hope. I agree with a previous poster that Tokamak provided the best interface for that, but it's a long since dead project. Source is now available but I found it a bit of a mare to read through tbh.

    I have to say that having tried practically all the solutions available, I was left slack jawed that actually none of them could take spheres the size of pool balls and collide them with an arbitrary mesh without problems. The physics engine in Carmageddon could do this over a decade ago.

    (We still work closely with Stainless and we almost got free rights to use that in return for modernising the interface a bit, but the lawyers got in the way and it ended up seeming too much trouble.)
     
    #9 Applewood, Jul 13, 2010
    Last edited: Jul 13, 2010
  10. hippocoder

    Indie Author

    Joined:
    Mar 18, 2008
    Messages:
    591
    Likes Received:
    0
    Have heard good things about bullet but yet to try it myself.
     
  11. Applewood

    Moderator Original Member Indie Author

    Joined:
    Jul 29, 2004
    Messages:
    3,859
    Likes Received:
    2
    That's the one with the bullshit radius. Sort of like quantum foam :)

    So you just scale everything by x100 and then you get "world too big". I've spoken a lot with Erwin and it's on his todo list. Once that's fixed I think it might be the best option, but right now it's among the worst because of that imo.
     
  12. vjvj

    Indie Author

    Joined:
    Sep 25, 2004
    Messages:
    1,732
    Likes Received:
    0
    Good to know and very interesting... We've been mulling over doing a small handheld project and I've been thinking about alternatives to PhysX vs. rolling our own. Integrating some OSS like ODE certainly gives me something to think about.

    From a featureset standpoint it is reasonably complete; many features are not finished, but it's open source so you can always fill in your own code. However, documentation is completely non-existent, so I don't recommend it to physics newbs (like me).
     
  13. Game Producer

    Moderator Original Member

    Joined:
    Jan 13, 2006
    Messages:
    1,418
    Likes Received:
    2
    I'll second this.
     
  14. zoombapup

    Moderator Original Member

    Joined:
    Nov 25, 2004
    Messages:
    2,890
    Likes Received:
    0
    So do you guys get that same vibe from AI characters too? They fascinate me, even though I program them and know its all smoke and mirrors.
     
  15. FlySim

    Indie Author

    Joined:
    Jul 30, 2004
    Messages:
    352
    Likes Received:
    0
    I wrote some physics code for a kite simulator. As an after thought, I added an option to "deflate" the kite (reduce the stiffness of the structure). The kite flapped like a bird and I figured the my physics code was whacked. A year later, I am kitesurfing in the S.F. bay and my kite starts flapping like a bird. I manage to land it and sure enough, the inflation valve had blown and the kite was flat.
    Pretty surprised!
     
  16. dewitters

    Original Member

    Joined:
    Dec 19, 2005
    Messages:
    128
    Likes Received:
    0
    Yes, even more than with physics. It's just always fun to see those little guys doing their own thing (that you programmed), especially when they're doing something you didn't anticipate.
     
  17. Richard Nunes

    Richard Nunes New Member

    Joined:
    Nov 10, 2008
    Messages:
    202
    Likes Received:
    2
    I'm always surprised when an AI character I designed comes up with something I hadn't expected. With a board game I designed, the AI came up with a strategy I hadn't seen before.

    Physics is fun to watch. It's like when a pile of boxes can't settle so they're jiggling like Jell-O for a few minutes. I'm reminded of the game Truck Dismount from years ago. Fantastic game, a little morbid.
     

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer