Skip to content

Conversation

@Wardergrip
Copy link

I implemented Coroutines with the goal for them to be similar to Unity while still being able to use generically (think std::generator)

This draft is to open a discussion about 2 main things:

  • Where will the coroutine system be integrated in?
  • How will IEnumerators know what the state is of the game loop?

If we want a co_yield WaitForEndOfFrame(); we need a way to globally access the state of the internal gameloop. It seems to be that is a part of SceneManager but then I wonder why it was advised to make the coroutine system be a part of the GameContext.

Code is partially tested but not fully battle tested so it is very possible that stuff fundamentally doesn't work yet. I feel like I need to incorporate it to the engine before I thoroughly do that.

@Wardergrip
Copy link
Author

Talked to @AtlantiaKing

One of the ideas was to have an enum that is kept in the SceneManager or GameContext that is set at various places.

Thoughts?

@LeeVangraefschepe
Copy link
Owner

I would implement the coroutine handle inside SceneManager since this class already has all the calls attached to it. The defined enum seems okay but will it work for yield seconds?

@Wardergrip
Copy link
Author

Yield real time seconds is already implemented using std::chrono. Yield seconds will probably be using the Update part of the enum and use elapsed seconds.

Added EngineExecutionState and more default IEnumerators
@Wardergrip
Copy link
Author

Everything is in place now. Now it's fixing and testing. Seems to be an issue with moving the coroutine but figuring that out is for another time.
Feel free to take a look already or see how the issue can be fixed.

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 this pull request may close these issues.

2 participants