Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Begin Paused without Agents prior to Step 0 #122

Open
ptheywood opened this issue Mar 13, 2023 · 2 comments · May be fixed by FLAMEGPU/FLAMEGPU2#1052
Open

Begin Paused without Agents prior to Step 0 #122

ptheywood opened this issue Mar 13, 2023 · 2 comments · May be fixed by FLAMEGPU/FLAMEGPU2#1052

Comments

@ptheywood
Copy link
Member

The fix from #120 only fixed beginPaused when there are agents present prior to the start of simulation step 0.

I.e. if agents are created in a hostLayer function during step 0, or in a step function at the end of step 0 the simualtion will not begin paused, and will pause at some arbitrary frame later.

This might also require changes to splash screen closing logic.

@Robadob
Copy link
Member

Robadob commented Mar 25, 2023

Started looking at this.

I tried stripping out has_agents from this function.

https://github.com/FLAMEGPU/FLAMEGPU2/blob/c5007d284da9d8efbf0e937bb02034f571a7b0ef/src/flamegpu/visualiser/ModelVis.cpp#L37

But that leads to the visualiser being stuck at step 0 (with the splash screen open) when the model begins with no agents, regardless of pause state or beginPaused setting.

Debugging shows it's stuck waiting for vis to confirm it's done the initial buffer allocation.

            while (!visualiser->buffersReady()) {
                // Do nothing, just spin until ready
                std::this_thread::yield();
            }

Not too sure best way to handle this. Either strip out this check (or rather replace it with something that merely check's vis init flow is complete). Or give buffers a default allocation so they are ready assuming initial agent account is <= default.

I attempted this fix by:

  • Init required size ~1024
  • change updateBuffers() to only increase requiredSize, not outright overwrite it,
  • change splash screen close logic to not check for agent allocation

This now pauses with splash screen closed at step 0, but agents are not visible in the paused frame if they are created before the sim.

@Robadob
Copy link
Member

Robadob commented Mar 25, 2023

I think it would be easier to change the beginPaused logic so it always pauses at the first step with agents.

Would this be acceptable?

(I think it would just require has_agents to be calculated differently, and the step count checks in the above ModelVis fn to be removed).

@Robadob Robadob linked a pull request Mar 25, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants