Moving Solids v1 Beta

  • ArolaunTech
    6th Mar 2023 Member 3 Permalink

    Moving Solids v1 Beta

     

    So I have been experimenting with moving solids in The Powder Toy, and this is the result. You can download the script to try them out.

     

    Download Link

     

    Please report any bugs or feedback that you find.

     

    Example save for testing: id:2986706

    Another: id:2989705

     

    Usage

     

    This script adds 2 new elements:

     

    VRTX - this is the basis of moving solids. A weird liquid. If the .tmp4 is set to 1, it gets pinned in place.

     

    EDGE - connects the VRTX specified (by id) in the .ctype and .tmp properties. .tmp2 controls the length - 64 is one pixel. .tmp3 controls the springiness. The default (0) is perfectly rigid, a .tmp3 of 1 is minimum rigidity, and increasing .tmp3 increases rigidity, with maximum rigidity achieved at a .tmp3 of 128.

     

    Together, these elements create a moving solid. Make sure to reload. This will prevent the moving solids from breaking upon reopening the save.

     

    Changelog

     

    v 1.2.1 Beta - Adds springs, performance improvements.

    v 1.1.3 Beta - To reload, you now need to press T, save, open the save again, press X, and save. Helps with bugs.

    v 1.1.2 Beta - Fixed reload function. EDGE now cannot connect to non-VRTX elements.

    v 1.1.1 Beta - Added pinning, VRTX with a .tmp4 of 1 are 'pinned' to a certain point. Reload is now Ctrl+Shift+R.

    v 1.0.2 Beta - Bugfixes

    v 1.0.1 Beta - Initial beta release

     
    Edited 10 times by ArolaunTech. Last: 26th Mar 2023
  • RebMiami
    6th Mar 2023 Member 0 Permalink

    This is really impressive! By far the best implementation of moving solids I've seen so far. Very excited to see how this develops.

    Oddities (which you may or may not be aware of) include:

    • Vertices are destroyed by walls and non-solid particles like powders and liquids.
    • Vertices bounce off of objects strangely, often going back-and forth in a ping-ponging motion.
    • Deleting a vertex connected to an edge while the simulation is paused causes the error "attempt to perform arithmetic on global 'a1x'/'a2x' (a nil value)" at move.lua:211
    • When you use the replace tool to change the type of a vertex, it still acts as part of the polygon and can be moved around (even if solid) but loses some of the vertex physics.

    I see that there are no features for creating edges between vertices without manually setting properties. Will the polygon element serve this purpose?

    The modified particle order reload function is a clever way to make saving/loading possible with this element.

  • Supercrafter
    6th Mar 2023 Member 0 Permalink

    I didnt even know it was possible to get actual moving solids, how did you do it?

     

    Edited once by Supercrafter. Last: 6th Mar 2023
  • ArolaunTech
    7th Mar 2023 Member 1 Permalink

    @RebMiami Thanks! As for the bugs you found, here are my responses:

    • Currently, vertices do not have collision with walls, so they are destroyed on contact (as they clip into the wall). I did not know about the powders and liquids however, I need to look into that. Seems that powders, liquids, and gases all get a velocity of "nan" when they touch VRTX. Fixed!
    • Sadly, the "collision" property in TPT only changes the y-velocity, not the x-velocity. I may need to implement a custom bouncing system to fix that.
    • This happens because the EDGE still assumes that the VRTX particle exists. Fixed!
    • EDGE doesn't check whether the particle it is attached to is VRTX or not. Seems kind of useful, so I'm going to say that's intentional.

     

    @Supercrafter It's hard to explain, maybe this article will help: Verlet physics engine

     

    The main difference between that and these moving solids is that TPT uses Euler instead of Verlet physics.

     

    1.0.2 Beta has released! Just a few bugfixes.

    Edited 7 times by ArolaunTech. Last: 7th Mar 2023
  • z4dg9ssw135
    7th Mar 2023 Member 0 Permalink

    My only successful attempt made a triangle that pinched(stretched ? i dont remember correct word) into a single dot and deleted itself lol

    Edited once by z4dg9ssw135. Last: 7th Mar 2023
  • Maticzpl
    7th Mar 2023 Member 0 Permalink

    The reload button is where the button for tptmp is already, maybe use a keybind or move it elsewhere.
    You could also display it only when VERT or EDGE are selected by the player

    Edited once by Maticzpl. Last: 7th Mar 2023
  • ArolaunTech
    8th Mar 2023 Member 0 Permalink

    @Maticzpl I'll probably change it to a keybind.

  • yesyesy
    30th January Member 0 Permalink

    this is very good, very hard to make one though