Multithread mod

  • Bekas
    8th Dec 2012 Member 1 Permalink


    Here it is a little test that i did trying to add multithreading to the simulation.
    Atm it runs on 2 threads, i could easy add more but the chance of instabilities appear would increase.

     

    For a simple test fill the screen with dust while the game is paused, unpause an look a the fps's.
    Repeat the process with the unmodded exe.

     

    https://github.com/Nylok/The-Powder-Toy

     

    Zip with exe
    https://github.com/Nylok/The-Powder-Toy/downloads

  • Candunc
    8th Dec 2012 Member 0 Permalink

    How hard was this to multithread for you? Are the changes small enough that is could be combine into the official source?

  • Bekas
    8th Dec 2012 Member 0 Permalink

    Easy but they wont. They can destabilize the simulation, there are ways araund that though

  • fireball5000
    10th Dec 2012 Member 0 Permalink

    whats multithreading? sorry to be a nooby newbie...

  • plead-for-destruction
    11th Dec 2012 Member 0 Permalink
    @fireball5000 (View Post)
    I do believe it has to do with utilizing multiple cores on a computer. :)

    I benefit from this due to my new laptop carrying quad i5 cores. :D
  • Uberness
    11th Dec 2012 Member 0 Permalink

    Benchmarking: Destroyable City 5

    Multithread: About 50fps Nothing, 35fps Fancy.

    NormalTPT: 50fps Nothing, 40fps Fancy 

    Not really a difference.

  • jacob1
    11th Dec 2012 Developer 0 Permalink
    @Uberness (View Post)
    I think the way this is designed, it only does anything and creates a new thread if more than half the screen is full. It might be better if it was, if a certain amount of particles, split the updates in half between 2 threads maybe. Although there were a few glitches, but we really do need multithreading somehow.

    Edit: I might try using code like this to add multithreading to other things that maybe cause less funny glitches. I didn't know how to do that before.
  • Bekas
    11th Dec 2012 Member 0 Permalink

    i tried splitting the particle updates between 2 threads equaly, it got even more glitches

  • plead-for-destruction
    11th Dec 2012 Member 0 Permalink
  • Bekas
    11th Dec 2012 Member 0 Permalink

    particles disapearing ( beeing killed ) every frames