Potentially making a "Flash" Powder

  • The-Fall
    18th Jun 2012 Member 1 Permalink

    Title says it all. But before I begin I need some specifications on TPT Programing.

    Is each "Element" in TPT a class within the program, held in an array? OR something else?

    The Pressure wind map;

    Is it an grid of vectors? Or a grid of units containing the particle velocity and wind velocity / heat data?

    Would using a vector be more efficent for the pressure / wind map work better?

     

    Once I have this information I will post a thread in the modding section with updates a they come along. Obviously Posting the source will be different as I will not be using the actual source of the game, so if anyone would fill me in on the details of how I need to deal with distributing the source.

     

    We'll see how this goes.

     

    What I know this version of the game will have is:

    Moving solids.

    Yes, Because I had done this section of code before everything else, IF I make this, the mod is guarenteed to have moving solids.

    The Current iteration with wind is heavily CPU intensive, as  I am still trying to figure out a method of using vectors in a grid at certain X-Y coordinates evenly spaced to propagate air flow efficiently.

    Basicly my method is that if wind grid point detects a "Object" with AS3 fuction Hittestobject wind will deflect "Arround" the object by approximating its area with the Wind / Air Vector cells that return true for function HitTestObject 

  • RedFlash
    18th Jun 2012 Member 1 Permalink

    Please make it red :D

  • The-Fall
    18th Jun 2012 Member 0 Permalink

    Red?

  • jacksonmj
    18th Jun 2012 Developer 0 Permalink
    You say "I will not be using the actual source of the game". But since you are asking about how Powder Toy is structured, I assume this means you are using some modified source code from TPT? If this is the case, you need to provide a link to your source code for any executables you distribute.

    Each element is just a load of data in some arrays. No classes involved yet. The arrays can be found in src/elementdata.c. They include some function pointers, the corresponding functions can be found in src/elements/. Allocation of a number to each element (which should match the order of the data in the arrays in elementdata.c) is in includes/powder.h.

    Air data is in four separate 2D arrays of floats. Particles interact with the air in update_particles_i() in powder.c.

    pv = air pressure. hv = air temperature in Kelvin (only when ambient heat is on). vx = x velocity of air. vy = y velocity of air.

    TTAN and walls block airflow by setting the appropriate cell in bmap_blockair (another 2D array) to 1. This causes the air simulation code to prevent airflow through that cell.