So I have been trying to implement a ball shooting character in directx 12. I am having trouble figuring out how many balls should I generate when player wants to shoot and how do I manage those balls?
Should each ball have separate world matrix?
How do I reuse balls that have hit the target enemy or went past the viewing dimension?
Here are ingredients I need to manage.
1) Vertex and Index buffer entry for a geometry named “Ball”. This can be same for all balls. Need not be repeated.
2) Constant buffer entry for storing world matrix of “a” ball. For multiple ball I will have to have separate constant buffer entry.
3) Since I am simulating physics for each item that can be rendered, I will have to have a separate physics object entry for physics engine.
For #2 Do I have to pre allocate a pre-defined maximum number of constant buffer for all balls ? Like say I can only render 20 balls on screen at max. This is possible if none of the ball hit any enemy and none of them went past the viewing screen? For other situation I can assume every balls not on screen can be reused again when player hit shooting key again.
Is there a standard game design pattern for ball shooting? Am I looking at right direction for my attempt at designing myself? Any optimisation?
Does cuphead implemented proven pattern ?? Picture attached.