Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Box2D version request — Gideros Forum

Box2D version request

ArtiomArtiom Member
edited February 2012 in Suggestions & requests
Hello atilim and gorkem!

I have a some special problem...
I was writing a game in some mexican beer engine and all was good, but than I discovered Gideros and loved it!
After porting my code I saw that my main game character which built on physics (it's using a lot of bodys and joints - near 100) is moving some different and wrong that crashes my gameplay. All physics parameters are identical as in corona version. After playing for a while with them I understood that there is nothing I can do with that. I think that the reason in Box2D version: Gideros uses 2.2.1 and corona 2.1.2 (May be developer of Box2D made some optimizations to the engine and that very influenced my physics model).
I don't want to come back to corona, it's much slower than Gideros and show 10 FPS less! Plus I love Gideros for a plugin system, offline builds, player and other nice things...
I just wanted to ask, is it possible to do for me special build with Box2d 2.1.2? I know that I'm asking too much and you guys have a lot of work to do, but maybe it's possible.. I just don't know what to do.. my game just unplayable with 2.2.1.
Also I hope that Gideros will be not slower on 10 FPS with the old version of Box2D.

Thanks.
+1 -1 (+2 / -0 )Share on Facebook

Comments

  • you may have checked already but these are the release notes for the updated version gideros uses, not sure if anything in there makes a difference in your code. The first one in 2.2 may be why you see such speed improvement?:

    2.2
    - The dynamic tree is now self-balancing, leading to significant speed improvements for large worlds.
    - Added wheel joint, friction joint, and rope joint.
    - Implemented b2ChainShape with smooth collision support.
    - The gear joint no longer requires static bodies to be used.
    - Many bug fixes.

    2.2.1
    Bug fixes
    Premake build system
    Custom Visual Studio 2010 and XCode 4 projects
    b2World::Dump to dump the world to a testbed compatible text file.
    Soft weld joint
  • atilimatilim Maintainer
    edited February 2012
    oh this is interesting. I would like to provide a version with 2.1.2 but unfortunately there are _a lot_ API differences between 2.1.2 and 2.2.1. :(

    And I've seen some differences between Gideros and Corona:
    - While creating a fixture, Corona named it as "bounce" but we named it as "restitution"
    - Also some default values are different:
    Corona:
    * density = 1.0 (dynamic body)
    * friction = 0.3
    * bounce = 0.2

    Gideros (we're directly using the default values of Box2D):
    * density = 0.0 (static body)
    * friction = 0.2
    * restitution = 0.0

    Other than velocityIterations and positionIterations are same. And physics scale is same (30).

    I hope this information helps you.
  • atilimatilim Maintainer
    edited February 2012
    on the other hand, 100 bodies and joints may cause any box2d implementation on mobile to moan :)

    Likes: JuanZambrano

    +1 -1 (+1 / -0 )Share on Facebook
  • ArtiomArtiom Member
    edited February 2012
    I'm using 50 bodys, 50 distance joints and 100 revolute joints. I think they should not have been affected by Box2D changes accept first.

    Thanks atilim.
    I didn't know about "bounce" and "restitution", but I was using bounce = 0.0 which is identical to restitution = 0.0 (while "bounce" is not recognized by Gideros, it sets "restitution = 0.0 by default).

    I have found an interesting thing..
    The default value positionIterations in corona is 8 and velocityIterations is 3. (http://developer.anscamobile.com/content/game-edition-box2d-physics-engine)

    But in Gideros it's 3 for positionIterations and 8 for velocityIterations - like Box2D defaults ("The suggested iteration count for Box2D is 8 for velocity and 3 for position.")

    It looks like corona is wrong...

    Position and velocity iterations is the main parameter that is very influence my character behavior. May be there is some mistake with this values...
  • ArtiomArtiom Member
    edited February 2012
    When my character is moving sometimes its bodies is stick in each other. In corona version they are very quick restored, but in Gideros version character continue to move with sticky bodies. This is very frustrating.
    If I increase velocity and positions iterations then my game became slow.
  • atilimatilim Maintainer
    @Artiom good catch about the issue about velocityIterations and positionIterations :) Meanwhile I've done a double check and as you said in Gideros it's correct. Still I wonder what's the difference.

    btw, there is a property "collideConnected" in joint definition table. You can set this field as false so that the attached bodies doesn't collide. Maybe you want to try it:
    local jointDef = b2.createRevoluteJointDef(bodyA, bodyB, anchorx, anchory)
    jointDef.collideConnected = false
    local joint = world:createJoint(jointDef)
  • Thanks atilim!

    I think it's became a little better.. They colliding anyway (but I need this). Plus I've changed some parameters and it's became better.
    Anyway I'll continue testing and I'll not come back to Corona :)
Sign In or Register to comment.