pierd.github.io


Project maintained by pierd Hosted on GitHub Pages — Theme by mattgraham
10 October 2018

(DRAFT) Background stars with parallax in Deasil

Note: this is a draft of a post that I will probably never finish.

After hearing about ECS and playing a bit with Rust I decided to try the both out and make a simple game. Something simple, realtime (as in not turn based) and fun. That is how Deasil was born.

It is supposed to be a 2D space shooter and as a 2D space game it needs a parallax background with stars. I implemented a first version of it yesterday, I am quite happy with the result and here is how it works.

Planes, visible sky and sectors

TODO: Explain: check what’s visible basing on transform matrix

TODO: Explain: divide into planes to achieve parallax

TODO: Explain: divide each plane into sectors to have stable stars between frames

Pseudo-random number generation

TODO: Explain: to get the same stars on each frame

TODO: Explain: hashing coords to get the seed and using it for new PRNG

Conclusions

It gives nice feeling of the space and makes controlling the ship easier because now you can see your velocity.

Parallax

Deasil is more of a prototype and a learning project. For a real one this parallax would have to be implemented using shaders to offload the computation from CPU. You can find the current simple implementation here.

tags: rust - gamedev - deasil - draft