2d – High-performance update of a bitmap grid

the accuracy should be in 1-2ms intervals

You are out of luck here, getting high and steady frame-rate in WPF is impossible by design. Still, you can get decent 60Hz, and anything above requires high-frequency display anyways — I expect those to be rarity in a business environment.

I am planning to use writeable bitmap 800x40px.

D3DImage should be a better fit, especially for performance reasons. Drawing a NxN pixels rectangle is easy with either API.

Most importantly they move independently, so I cant (I can but I would like to not) have a sort of refresh rate.

Objects’ independence is irrelevant. So many objects could be (most probably will be) updating at same time, allocating a separate timer for each object is just unreasonable.

To set WPF to continious rendering mode, you need to subscribe for a certain event. Then in each frame you have to update animation states and redraw each particle.

In this period of time the states can change multiple times so I should be able to abort outdated animation, move object “instantly” to new cell and start more recent object animation which could have taken over the “old” cell.

That can be easily achieved by associating a particle (“object” of yours) with an animation. Animation instructs how to interpolate particle’s properties (location and size) between 2 states, it consists of 2 key-frames and a time range. When assigning new animation to a particle with existing animation, don’t forget to force previous animation (copy last key-frame’s properties as is, no interpolation is necessary).

On each frame a particle should re-calculate it’s state from it’s animation. First, calculate the animation alpha (capped at 100%) based on current time (a = (now - Start) / Duration), then use it to interpolate particle’s properties. Once 100% alpha is achieved, delete (or deactivate) the animation.

where would you start?

Let the code speak:

    record Keyframe(Point Location, int Size);

    record Animation(Keyframe From, Keyframe To, DateTime Start, TimeSpan Duration);

    class Particle
        public int Id { get; }
        public Point Location { get; private set; }
        public int Size { get; private set; }

        public Animation Animation { get; set; } // null = disabled
        public void Update(DateTime now); // recalculate itself from the animation

    class SimulationViewModel
        List<Particle> particles;
        void Update(DateTime now); // for each particle do ...
        void Move(int ParticleId, Keyframe from, Keyframe to); // setup the animation; duration is constant, start time is now