Best Techniques for Smooth Spaceship Movement in a Game
Asked by
GalacticNomad42
I'm developing a video game focused on spaceship dogfights and aiming for a style similar to Starcraft or Factorio using prerendered graphics. My challenge lies in figuring out whether to use sprite sheets or create a different solution. Since the spaceship can move in any direction with pitch, roll, and yaw, I'm concerned that I'd need an excessive number of sprites, which might not provide satisfactory angle increments. Additionally, the camera angle is fixed, and I plan to release on mobile, so I'm limited on resources. What's the best way to approach this?
Answers
You can definitely use a sprite sheet with fewer positions than the rotational angles. A simple way to handle it is to 'snap' the angle to the nearest sprite. For instance, if you have 16 sprites and need to cover 360ยฐ, you can calculate the correct sprite index with the formula (int)(angle / 360 * 16). This will help you keep the sprite count manageable.
Reply to this answer
Consider what you're aiming for with prerendered graphics in the first place. If itโs for aesthetic purposes, the methods you use will differ compared to if you're focused mainly on performance. Understanding your priorities will help in choosing the best approach.
Reply to this answer
Add your answer
Answers are reviewed before publication.
SpriteMaster99: Exactly! My rough calculations suggest around 22.5ยฐ increments for pitch, roll, and yaw results in about 4096 sprites, which could take up around 100MB of VRAM, making smooth animations like twirling barrel rolls feel choppy. If you stick to those 16 sprite positions, you could animate in-engine for the angles in between, kind of like billboarding. Have you seen any examples of that technique?