HubbleCommand.github.io

Personal blog, project documentation, and ramblings

P5

2020-09-15

last modified 22 Jan 2025


tags: gamedev - procedural generation

A few years ago I was playing around with Processing in Java and Javascript, mostly to play around with procedural generation in a visual tool. I had put some of my work in a repo, but in the end the vast majority was lost to time. The sources are included within the page source.

Using P5

The best introduction to p5js is given by The Coding Train.

To use multiple p5 instances, look into global and instance mode.

Practice

Stars

One of the first things I had done was something I called “Stars”. This was practice for game backgrounds. The idea was simple enough; make simple ways to draw “star-like” views.

Voronoi

A very good overview of Voronoi can be found here.

Binary Space Partitioning Generation

Binary Space Partitioning is an old method of spatial partitioning, once regularly used for efficiently rendering 3D models. It’s part of a group of tree data structures for spatial partitioning, so it’s very similar to Quadtree.

While once primarily used for rendering, and QuadTrees still common for handling physics, this idea can also be used in generating worlds.