Efficiency?

  • DreamingWarlord
    6th Mar 2020 Member 0 Permalink

    Idea is that the particlemap'll be divided into 4 pieces, there'll be also 4 thread for each piece. When a particle enters a piece, it will not be handled by other threads. Each thread is connected to one simple timer that sends an update signal to threads that actually has to do some stuff with pieces. If a piece doesn't contain any particles, it won't be updated or rendered.

  • jacob1
    6th Mar 2020 Developer 0 Permalink
    If it were this simple, we would have done it already.

    Multithreading is possible, and it would involve separating the particle map into regions like this. A lot more than 4 regions though. And we would separate the regions into groups of non-bounding regions and do multiple passes. This is the model Noita (a rougelike particle simulation game on steam) uses.
    There are also other ways to do it, we could just multithread the particle updates only and leave the movement in one thread.
    Also there are tons of exceptions to both movement and particle updates that can never be run in parallel. Separating these out is going to take a while. These exceptions need to be run in a single thread.