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

Weapons should work framerate independent #549

Open
xchrdw opened this issue Mar 31, 2014 · 3 comments
Open

Weapons should work framerate independent #549

xchrdw opened this issue Mar 31, 2014 · 3 comments

Comments

@xchrdw
Copy link
Member

xchrdw commented Mar 31, 2014

idea: Gun::fireAtPoint() should spawn bullets and forward them for (currentTime - lastShot - coolDownTime). Then update lastShot = lastShot + coolDownTime.
This should only happen if the player was fireing in the last frame!
Sound only needs to played once

@mrzzzrm
Copy link

mrzzzrm commented Mar 31, 2014

Another idea: #542 as my proposed solution for everything

  • GameElements would be a baseclass of Weapon and Bullet.
  • GameElement::updateFrequency() is the weapons frequency, so Weapon::update() is called for every bullet that needs to be spawned
  • GameElements have their own clock, progressed on GameElement::update(), and Bullets will be spawned with the timestamp the clock of the Weapon has when it fires that particular bullet.

The effect would be that bullets indeed would be spawned on the same position, but because their clocks have different "delays" on the next frame, they would be moved different distances.

This may sound complicated but I think once the base-architecture (=GameElement) is implemented, everything will be much easier.

I have quite some ideas for this that I will present tomorrow.

@gersseba
Copy link
Contributor

gersseba commented Apr 8, 2014

Have we discussed @mrzzzrm proposal yet?

@mrzzzrm
Copy link

mrzzzrm commented Apr 8, 2014

No, I'm still developing it (=the idea). Hope to introduce basics of it when doing #564

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

3 participants