Bust! Some physics requests…

About Monkey 2 Forums Monkey 2 Development Bust! Some physics requests…

This topic contains 48 replies, has 7 voices, and was last updated by  DruggedBunny 5 minutes ago.

Viewing 15 posts - 1 through 15 (of 49 total)
  • Author
    Posts
  • #14509

    DruggedBunny
    Participant

    Uncontrollable Kinda now-controllable Thrust clone, Bust!, with constraint-based orb…

    It’s very hard to control, but stick to small amounts of left/right only and you can keep it going for a while.

    Couple of things I ran into (also while looking into constraints to try and understand that chain-distance thing, which I still don’t get):

    • My rocket keeps rotating, but I can’t see that we have (at least Monkey-side) angular damping, so I think that’s needed to make this a little more controllable (along with me figuring out the best way to handle applying the directional forces relative to the camera);
    • Can we have fixed constraints added? I think this is the one I should have asked for originally, as I believe it would allow me to assemble bodies made from multiple bodies, eg. main rocket body, plus separate engines that can be boosted to move the main body.
    • Unrelated: how do you export PixelFormat.I8 from a paint program? What’s it known as? My demo heightmap was saved from Gimp as Indexed, 255-colour (I selected 256 but it defaulted back to 255!).

    Messy Bust! source

    #14510

    Ethernaut
    Participant

    This one ran incredibly slow on Firefox and Chrome (10fps average)… but 60fps on Safari, somehow!

    😼

    #14511

    DruggedBunny
    Participant

    Sounds like they may be going into software-rendering mode for some reason, whereas Safari isn’t. If your stuff runs OK in FF/Chrome then my ill-informed guess would be that something isn’t implemented in their WebGL versions (assuming you’re on Mac?) and it goes into software mode.

    All runs 60 fps on Firefox/Windows 7 here!

    #14512

    DruggedBunny
    Participant

    Oh, yeah (for Mark) — in addition to last set of queries, is there a way to detect collision at the moment? I couldn’t see it!

    Just found that giving the orb body a bit of restitution (0.5) makes for much nicer interactions with the ground, though of course it needs to explode on impact…

    #14513

    Mark Sibly
    Keymaster

    Working well here on chrome/nightly, windows 10, 60fps all the way. Like all games these days, too freakin’ hard for me though!

    My rocket keeps rotating, but I can’t see that we have (at least Monkey-side) angular damping

    Will add linear/angular damping for next release.

    Can we have fixed constraints added?

    Will add eventually. Are you using ApplyImpulse for thrust? Have you looked at the ApplyImpulse( dir:Vec3f,offset:Vec3f ) version? This should allow you to provide off centre, ‘local space’ thrust, ie: offset is similar to LocalPosition for child entities.

    Unrelated: how do you export PixelFormat.I8 from a paint program?

    I use paint.net and save as 8bit png.

    is there a way to detect collision at the moment?

    Yes, see: Entity.Collided. I did have it going in tests/shapes.monkey2 at one point, but it’s commented out now I think. Still, should show you roughly how to use it.

    #14514

    Hezkore
    Participant

    I have no idea what I’m doing in this game/demo!
    But it runs great here on Win10 using FireFox, solid 60 FPS.

    #14515

    DruggedBunny
    Participant

    Thanks for the answers, Mark — and I feel the same way in regards to “Like all games these days, too freakin’ hard for me though!”

    Don’t anybody worry about not being able to “play” it — I can’t either!

    It’s just a simple demo/experiment using the new PointToPointConstraint feature. Best I can manage is to stick to very small left/right movements (don’t touch forward/back!), tapping/holding space for short periods to keep it in the air.

    I’ll look into the other ApplyImpulse options, but damping should really help control, I think, as will applying forces from the camera’s perspective — I’m currently using ApplyTorqueImpulse to lean the rocket and ApplyImpulse to boost it in the direction it’s pointing.

    I do really like the AddComponent way of building physics bodies, by the way, does make it pretty easy, even if I’m still ropey on the whole Component concept (despite previous explanations)… I don’t really need to grasp it to use these, though!

    #14519

    DruggedBunny
    Participant

    Happy to report that angular damping has made a massive difference to controllability!

    However, I believe it would also need constraint damping to be added, in order to be able to tame the rotation of the orb.

    This now defaults to rocket only (no orb) — O now toggles Orb on/off:

    Bust!

    I’ve also temporarily limited control to left/right only, though you can still end up being knocked into the z direction by collisions with ground. (R resets!)

    Just try to hover the thing, or boost at an angle (to put it out of default straight landing), then try to land gently.

    Crude cheat of a smoke particle effect thrown in. Turned off particle collisions, as smoke colliding with ground was cool, but I need to set up collision groups to only collide with ground (otherwise throws rocket out!); also need to apply force to particles in correct orientation, just go straight down for now.

    [EDIT: If you lose FPS, it’s most likely just due to the particles not fading out quickly enough!]
    [EDIT2: Yeah, definitely need to be less generous with the particles… only shows up on web version!]

    Updated source is linked in first post.

    #14523

    DruggedBunny
    Participant

    Added collision groups — the smoke now collides with the ground (but not the ship), which is cooler, and clears up quicker, so seems to keep to 60 fps again here now, same link. (Source link is in first post.)

    Bust!

    Note that orb/rocket collisions with ground can still make for z-movement. Would need this to restrict to x/y movement entirely.

    That said, I do intend to try and make it controllable in all axes! More of a camera problem than anything…

    EDIT: Think smoke is colliding with orb, knocking it into z-axis…
    EDIT2: Nah, I haven’t grasped collision groups properly, smoke colliding with ground but not ship appears to be a fluke! Need to get properly into the whole bitmask thing…

    #14524

    Pakz
    Participant

    The framerate is around 13fps on chrome here on the last bust link. Not sure why.

    This is on the amd a8 cpu.

     

    edit: The gaming laptop with i5 and 1050 has 16 fps.

    #14529

    Mark Sibly
    Keymaster

    Working well here, are you using the new damping stuff? Does it actually do anything?

    Would need this to restrict to x/y movement entirely.

    No problem, will add it later today.

    Nah, I haven’t grasped collision groups properly

    Yeah, it is confusing, I will probably work on making it easier to use a bit later, but for now it’s just the way bullet works by default.

    The framerate is around 13fps on chrome here on the last bust link. Not sure why.

    Can you post some system specs including chrome version?

    #14530

    Mark Sibly
    Keymaster

    Would need this to restrict to x/y movement entirely.

    Another thing that would be fun to play with is transforming thrust/offset vectors from camera space to rocket space, ala the space->space transformation post from a while back.

    This would give you mario64-like control where left/right meant left/right in camera space, not model space.

    I have no idea if it’d fun or not but it’d be interesting to play with – it should at least be easier!

    #14531

    DruggedBunny
    Participant

    Hi Mark,

    Working well here, are you using the new damping stuff? Does it actually do anything?

    Yes, definitely — see the post before that one! You should find it much more controllable now, at least compared to the original… reasonably Thrust-like, as long as you don’t touch the ground and get knocked into the 3rd dimension!

    Yeah, I realise collision group/masking is down to Bullet, but of course if you can simplify the interface to it, all the better. Thanks for adding axis restriction when you do!

    I think the slowdown thing for some people surely has to be down to individual browser/driver/platform combinations. (I would guess that some don’t implement specific features and they drop to software-only?)

    Yeah, I was trying to do the transform stuff earlier this evening, but got confused — full 3D control from camera perspective is my aim, though suspect it’ll take me a lot of swearing/giving up/coming back.

    I did, however, get my smoke particles thrusting out from the ship correctly! Just needed:

    body.ApplyImpulse (rocket.model.Basis * Thrust)

    BTW Has the mserver thing been dropped? Doesn’t appear in my devtools after checkout/rebuildall2go any more (as of a few ‘develop’ versions ago).

    #14532

    Mark Sibly
    Keymaster

    Just pushed LinearFactor and AngularFactor properties to develop.

    You should find it much more controllable now

    Yes, I could actually fly around for a bit before crashing wildly into the ground!

    individual browser/driver/platform combinations

    Yeah, but I’m also reminded of the time glGetError() was causing major slowdowns on chrome, and the ‘100% cpu’ issue that was related to using glGet. In both cases, the fix was  easy, ie: don’t use glGetError or glGet. I wonder if there’s something else here I shouldn’t be doing…

    mserver has never been part of the repos, you need to install it separately from the downloads page.

    #14533

    DruggedBunny
    Participant

    I’ll try the axis stuff soon (maybe tomorrow), though do want to get the full 3D working too!

    Hmm, must have forgotten I was copying mserver manually!

    Email summary said you were looking for thing-on-a-string… guessing you’ve found it, but hit ‘O’ for orb! (Away from the ground.)

Viewing 15 posts - 1 through 15 (of 49 total)

You must be logged in to reply to this topic.