# In a galaxy far, far away - A procedural generation tale

- Speaker: [Shay Davidson](/wiki/speakers/shay-davidson.md)
- Event: [Reversim Summit 2019](/wiki/years/2019.md)
- Video: https://www.youtube.com/watch?v=yuKDBN490oQ
- Transcript: [/transcripts/2019/54-yuKDBN490oQ.md](/transcripts/2019/54-yuKDBN490oQ.md)
- Language: Hebrew · Type: talk · Level: intermediate
- Topics: [Algorithms](/wiki/topics/algorithms.md), [Game Development](/wiki/topics/game-development.md), [Frontend](/wiki/topics/frontend.md), [JavaScript](/wiki/topics/javascript.md)

> Written by an LLM from machine transcripts. It can contain errors. Check the transcript before you quote it.

## Summary

The speaker shares a personal hobby project of creating a procedurally generated galaxy using basic mathematics, trigonometry, and JavaScript. The talk walks through the evolution of generating random points, constraining them into circles, applying easing functions, and utilizing logarithmic spirals to mimic real galaxies. The audience learns how to combine randomization with determinism using seeds and visual effects to create realistic game environments.

## Key points

- [1:23](https://www.youtube.com/watch?v=yuKDBN490oQ&t=83s) Procedural generation is defined as a collection of processes used to create large amounts of data or graphics using algorithms, heuristics, and mathematics.
- [9:43](https://www.youtube.com/watch?v=yuKDBN490oQ&t=583s) Pseudorandom number generators (RNG) allow developers to introduce determinism into random generation by using a seed.
- [11:52](https://www.youtube.com/watch?v=yuKDBN490oQ&t=712s) Polar coordinate systems with radius and angle are often much easier to work with than Cartesian coordinates when dealing with circular structures.
- [14:25](https://www.youtube.com/watch?v=yuKDBN490oQ&t=865s) The area of a circle scales quadratically with its radius, meaning raw random distribution will cause bunching in the center unless corrected with square roots.
- [15:43](https://www.youtube.com/watch?v=yuKDBN490oQ&t=943s) Easing functions, commonly used in web animations, can be repurposed to redistribute random values and alter density curves.
- [20:12](https://www.youtube.com/watch?v=yuKDBN490oQ&t=1212s) Logarithmic spirals combined with multiple arms and scattering offsets create realistic spiral galaxy structures.
- [24:30](https://www.youtube.com/watch?v=yuKDBN490oQ&t=1470s) CSS filters like blur and blending modes can be stacked to add realistic glows and aesthetic depth to generated graphics.

## Takeaways

- Use seeded random number generators to ensure your procedural generation is reproducible for debugging and sharing.
- Apply mathematical transformations like square roots and easing functions to fix natural density biases in random distributions.
- Combine basic geometric shapes and mathematical formulas with visual post-processing effects to achieve high-quality rendering results.

## Questions this talk answers

- How can I make procedurally generated content deterministic for debugging purposes?
- How do I achieve an even distribution of points when generating elements inside a circle?
- What mathematical approach can be used to generate spiral patterns like galaxies?

## Technologies

JavaScript, React, CSS

## Tags

algorithms, game development, graphics, javascript, mathematics, procedural generation
