2nd agent fails to render
Robadob opened this issue · 1 comments
Video of the issue here, occurs at 00:28.
https://youtu.be/y8ISWOuWjKw
When visualising a simulation with 2 agents, periodically the red (2nd?) agent is not visible.
This began after I added in agent birth, which suggests it could be to do with buffer resizing (and simulation running very slow). Both agents request buffer resize, but buffer isn't resized by the time they send agent data, so the data gets dropped.
Solution options:
- On resize, block sim thread (similar to recent init patch), until vis has resized.
- Always copy as much data as possible, therefore newly birthed agents should just appear late?
- Allocate vis buffers with more aggressive lengths.
08d2666 fixes this.
However, worth noting that it is still possible for some agents to not display newly birthed agents, until after an extra sim step due to resize delay. This could only be solved by blocking the sim (like we do at init) until the buffers have been suitably resized. I'm not really a fan of this, as the vis shouldn't slow down the simulation, so haven't implemented it at this time.
This commit however retains old data on resize, and copies as much data as can be fit all the time. So it atleast allows continuity.