Rigidbody/Softbody physics mod Journal

  • m3101
    31st Jul 2020 Member 8 Permalink

    Good day, y'all!

     

    It's me, a random person who's been playing TPT for a while.

     

    A few years ago (ok... some 5 or so. Not so few) I found this game randomly and fell in love with it. After some time I completely forgot about it, but destiny brought me upon it once again, so I decided to do something to the community as a way of thanking y'all for its existence.

     

    I've worked on a few physics/raytracing projects recently, so I've got a bit of experience in writing physics engines, so I decided to implement a little Rigidbody system for TPT.

     

    By the way, I'm doing this purely for fun. I know many others have done similar things. I just wanted to do it too, as it's the kind of thing I enjoy doing as a hobby.

     

    This thread will serve as a sort of development journal and a way of getting feedback from you people in later stages of development.

     

    My fork is accessible at this link (though I avoid comitting unstable things, so there's probably nothing there yet, or later, there'll be very little until things progress a little further).

     

    Entry 1 - About 1 day of work

     

    With about an afternoon of programming, this gif is what I have so far. The engine supports concave polygons of any shape, but it is highly unstable, as you can see. I've used some bit wizardry to store the angular velocity and x/y velocity components all in the "tmp" property, so two of the components were reduced to a single byte. This makes it so small forces don't get registered, causing this erratic behaviour (only strong interactions are possible).

     

    I'll try and figure out another way of doing it better tomorrow.

     

    Simple collisions

     

    That's it for today. See you later, folks!

    Have a nice day.

     

    Entry 2 - About 2 days of work

     

    Yesterday's engine had some pretty grotesque maths mistakes. I corrected some things and it suddenly started working much better. There's still a pretty bad clipping problem and the particles are unsavable (the system depends on the IDs, which get reassigned when saving. Thus, when the save is loaded, the system undergoes undefined behaviour and generally crashes/freezes). Anyways... I believe that was quite a bit of progress in a few hours.

    I should stop working late at night. Yesterday's mistakes were very obvious today.

     

    By the way, I made the first commit, as this version is somewhat stable, so you may clone the repository and compile it for yourself if you want to (I won't make a release yet, in case you're wondering. That'll be for when I actually trust the system won't freeze your computer or do other weird things in situations I didn't predict).

     

    Gif 2

     

    Another day is over. Au revoir!

    Edited 4 times by m3101. Last: 1st Aug 2020
  • INFINITY-BOI
    31st Jul 2020 Banned 0 Permalink
    This post is hidden because the user is banned
  • CALVIN1390
    31st Jul 2020 Member 0 Permalink

    nice you kind of made a moving solid but with limited collision, another idea is that you setup a github for it or provide a download

  • m3101
    1st Aug 2020 Member 0 Permalink

    @CALVIN1390 (View Post)

     Yes. The idea is basically that, but I'm also working on a softbody system (so not only "moving solids", but "moving jello" and "rope"-like things).

     

    I have forked the project and am working under that system, but I haven't yet committed anything, as it's still very unstable. I'll be adding a link to the main post anyways, though. Thanks for the reminder.

  • CALVIN1390
    1st Aug 2020 Member 1 Permalink

    wheres the compiled version, where is the main download for this? EDIT: i just realized you havent added your changes yet lol

    Edited 2 times by CALVIN1390. Last: 1st Aug 2020
  • m3101
    1st Aug 2020 Member 1 Permalink

    @CALVIN1390 (View Post)

     That fork doesn't have any new commits yet. I'll only commit the system when it's minimally stable (which it is still not), so the project's commit history doesn't get polluted (it's very nicely organized by the collaborators so far, and I don't want to mess that up). In the current rate, that'll probably be in a few days, still (I can't dedicate much time for hobbies lately).

     

    I hadn't thought about publishing compiled releases yet, as it's fairly simple to compile it by oneself (and a nice exercise in case you don't know it yet. The modding community is a nice place to learn about this stuff).

     

    After your request, though, I'll certainly consider it. I'll probably be using github's own release system (check the right-hand side of the interface. There's a section called "releases" with some tags. There you can access all the releases.).

     

    EDIT: Sorry! I took so long to write this I didn't see your edit. Yep. I'll hopefully be committing it soon, though.

     

    At the moment I'm completely rewriting the engine, as there were some pretty obvious mistakes I overlooked yesterday (it was late, ok?). The engine was always calculating the collisions based on a weird projection artifact, so it only worked from a specific angle for some more complex shapes (a.k.a. not triangles). I've solved that already, and am now just finishing implementing the new system (which I'm quite proud of tbh. It's just pure simple linear algebra, no complicated tests or anything, which is what most of my earlier stuff was based on).

    Edited 2 times by m3101. Last: 1st Aug 2020
  • i3ima
    1st Aug 2020 Member 1 Permalink

    Amazing. Keep it up.

    Edited once by i3ima. Last: 1st Aug 2020
  • CALVIN1390
    2nd Aug 2020 Member 0 Permalink

    i cant compile so just give a google drive of the compiled versions

  • i3ima
    3rd Aug 2020 Member 0 Permalink

    @CALVIN1390 (View Post)

    I compiled it, very unstable at the moment
    zip

  • Peng1029
    27th Feb 2021 Member 0 Permalink

    Id love to see this when its done

Locked by LBPHacker: dead mod, will reopen at mod author's request