Cannon simulation
Posted: 2022-May-14, 00:39
TFXplorer gets a cannon API. It’ll be much like the engine API that was added lately.
As a start, I have repaired the rendering of bullets. (It was broken since I separated the legacy EF2000/TAW renderer away from TFXplorer’s renderer.) This commit is not yet pushed; I will probably push it after some testing together with the new API.
Unforeseen Consequence 1: Ammo
Since TFXplorer has to take care not only of managing the cannon’s recoil/SFX/GFX, but also of its bullet physics, I have to add an API for ammo as well. This lead to the question: When should ammo be assigned to a plane?
I have those vast air routes with hundreds of planes. They cannot be simulated efficiently if planes start to keep track of every round of ammo. So the ammo question should be resolved only when a plane transitions from the en route or parked state to the simulated state.
This is also a good point for dynamic campaign simulation to roll the dice over remaining ammo for flights that have taken part in combat.
There was, however, no vehicle API for all of this yet. So I had to add it. I’m still cleaning up the vast junk I found along the way.
Unforeseen Consequence 2: Vibration
TFXplorer’s screen will shake in a few situations:
Here’s what the F-22 code already needs to take care of:
This, however, uncovered a few bugs in how F-22 pilots move their heads under g load. I gotta figure this one out before I can complete the cannon API …
As a start, I have repaired the rendering of bullets. (It was broken since I separated the legacy EF2000/TAW renderer away from TFXplorer’s renderer.) This commit is not yet pushed; I will probably push it after some testing together with the new API.
Unforeseen Consequence 1: Ammo
Since TFXplorer has to take care not only of managing the cannon’s recoil/SFX/GFX, but also of its bullet physics, I have to add an API for ammo as well. This lead to the question: When should ammo be assigned to a plane?
I have those vast air routes with hundreds of planes. They cannot be simulated efficiently if planes start to keep track of every round of ammo. So the ammo question should be resolved only when a plane transitions from the en route or parked state to the simulated state.
This is also a good point for dynamic campaign simulation to roll the dice over remaining ammo for flights that have taken part in combat.
There was, however, no vehicle API for all of this yet. So I had to add it. I’m still cleaning up the vast junk I found along the way.
Unforeseen Consequence 2: Vibration
TFXplorer’s screen will shake in a few situations:
- Rolling fast on the ground, for simulating a bumpy ride.
- When huge aerodynamic forces affect the vehicle.
Here’s what the F-22 code already needs to take care of:
- Compute vibration dependent on gear load and speed.
- Compute vibration dependent on aerodynamic force.
- Do not shake the screen if the game is paused.
- Do not shake the screen if in exterior view.
This, however, uncovered a few bugs in how F-22 pilots move their heads under g load. I gotta figure this one out before I can complete the cannon API …