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

Add some delta time like feature for the game API #159

Open
AlecGoncharow opened this issue Apr 7, 2020 · 2 comments
Open

Add some delta time like feature for the game API #159

AlecGoncharow opened this issue Apr 7, 2020 · 2 comments

Comments

@AlecGoncharow
Copy link
Contributor

https://en.wikipedia.org/wiki/Delta_timing

@esaule
Copy link
Member

esaule commented Apr 15, 2020

I have actually thought about doing that. My decision at the time was that it was not worth it. Here is the rational.

The purpose of the game api is for early CS students. Because once you pass data structures, you will most likely find the restriction in sprite and number of cell annoying. And something like SDL or SFML, pygame, or whatever won't be too much to handle.

Delta timing is only helpful for games with some physics. This is probably over the level of a CS1 student, so I think the frame by frame approach is probably still the approach that we want.

That being said, my son is having fun with Unity these days. And the API for this pretty simple. The update function is called at every frame, but the engine exposes deltatime through the API. We could expose a function in nonblockinggame
protected float deltatime();
would that do what you need? Or were you thinking of this differently?

@AlecGoncharow
Copy link
Contributor Author

AlecGoncharow commented Apr 17, 2020

This came up as a discussing with regards to pong as it does involve some amount of physics. I agree with your initial logic, as the board resolution is prohibitive to a high variance the velocity of objects. The deltatime() function is fine. the only other approach I know of is having some publicly queryable member variable like super.deltaTime

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

No branches or pull requests

2 participants