Water simulation

  • Michael238
    5th Feb 2014 Member 0 Permalink

    Actually, we already have water physics. There is an option in the menu along with the heat simulation option that enables realistic water physics. It does cause lag with huge amounts of water.

  • tugrul_512bit
    5th Feb 2014 Member 0 Permalink

    Is it using GPU compute capabilities or CPU multithread? 

  • boxmein
    5th Feb 2014 Former Staff 0 Permalink
    @Michael238 (View Post)
    Old!
    @tugrul_512bit (View Post)
    Neither. TPT is basically single-threaded. It wouldn't work well. TPT as a falling sand game really needs the single threadedness in order to make particle updates feasible, and a lot of things rely on that working well. The only thing branched off into a separate thread is Newtonian Gravity, and see how well that is in sync with the rest of the game.
  • tugrul_512bit
    5th Feb 2014 Member 0 Permalink

    Then Im continuing my opencl branch on TPT. Right now, only UpdateAir is complete. I will bench after I wire all constants to it.  Will onform later. You can use it easily to convert any demanding loop into opencl. My classes are last message on opencl topic.

  • h4zardz1
    6th Feb 2014 Member 0 Permalink

    @Michael238 (View Post)

     anyway, @andypat is right if it was other element used: ACID, for example, even with water equalisation used, it wont work like equallisated water; it is MUST work on all liquilds.

    AEDIT: it works on all liquids

     

     

    Edited 5 times by h4zardz1. Last: 6th Feb 2014
  • tugrul_512bit
    6th Feb 2014 Member 0 Permalink

    @h4zardz1 (View Post)

     

    For testing, I added a std::cout and a printf into the Air::Air(Simulation & simulation) function but it prints nothing to console or msvc output when I run TPT . Flushing cout doesnt help too. Maybe air simulation is not working?

     

    I mean the part which starts with:

     

         //Simulation should do this.

         make_kernel();

         std::fill(%bmap_blo......

         ........

     

    Edit: update_air is certainly working. Adding multiple instances of update_air makes lag in simulation function.

    What is causing cout/printf not working?

    Edited 3 times by tugrul_512bit. Last: 6th Feb 2014
  • nucular
    6th Feb 2014 Member 0 Permalink
    @tugrul_512bit
    It gets redirected to stdout.txt by SDL if you're on Windows. You should be able to redirect it back by compiling with WINCONSOLE defined.
  • tugrul_512bit
    6th Feb 2014 Member 0 Permalink

    @nucular (View Post)

     

    :D I was nearly filling entire remaining HDD space :D

     

    Okay, bug fixing / learning the SDL way is becoming harder than implementing GPU acceleration lol

     

    Update Air is done, next is update air heat then update particles_i . These look demanding ones. update air alone doesnt change overall performance.maybe update_particles_i can. My GPU is HD7870 and CPU is fx8150 so I expect 10x performance at least.

     

    Edit: update_particles_i is 15 times longer than update_air. Converting that can take months :S

     

    Edit2: also when I change XRES,YRES values, I get memory corruption error. Why? If I cannot change XRES or YRES then why were they defined? Edit4: changing CELL from 4 to 1 gives same error too! What to do?

     

    Edit3: update gravity async seems simple in the core but those threadings and async copies seemed harder to disable. I dont want to break the integrity by playing with thouse pthreads. Medium strength GPU could handle 25k particles easily realtime without any acceleration strcuture for O(N^2) complexity (all-pairs).

     

    Edited 6 times by tugrul_512bit. Last: 6th Feb 2014