1
\$\begingroup\$

I'm trying to make a simplistic 2d shmup, simple enough to be implemented with a widget toolkit (like Qt, for example), without requiring a game engine.

Everything fits except for the smoke trails for rockets. For me, a simplistic trail without billowing smoke effects would be sufficient. Basically just a long, curved line, which will begin to slowly and smoothly fade out after a while, starting from its rear end.

They are supposed to cross most of the screen, and they can go diagonally or in a curved path. Therefore, each one having its own image in its own transparent layer would be horribly inefficient, as there should be dozens of missiles moving at the same time on the screen.

I thought of using a particle system, but it would just take too many particles to do it nicely.

My current approach is to have one big image covering the entire screen with one matrix of the same size, the cells of the matrix representing a time-to-live for its respective pixel. For example, when a missile passes over a pixel, the pixel lights up, its time-to-live is set to 255, it ticks down every frame, and if it's below 100, the brightness of the pixel will be reduced in proportion. This allows for multiple missiles at the same time, and needs only one image layer.

However, still every pixel of the screen has to be recalculated at every frame, with time wasted on lots of places where there is nothing to be done, as the total area of the smoke trails is very small in relation to the total screen area.

Are there any better methods than the one I sketched? There have been games over 20 or 30 years ago which could do this very nicely, on very primitive computers.

\$\endgroup\$
  • 1
    \$\begingroup\$ The games that have been doing it for 20 years do it just the way you think is wasteful: by using particles and by redrawing the entire screen each frame. \$\endgroup\$ – Maximus Minimus Apr 2 '17 at 9:18
  • \$\begingroup\$ "I thought of using a particle system, but it would just take too many particles to do it nicely." Have you tried it? \$\endgroup\$ – Philipp Apr 2 '17 at 10:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.