This is a super simple project for generating galaxy maps suitable for a 2D game. No efforts have been made to make the generation process efficient, and tweaking generation settings must be done by manually editing constants in the js file.
width
: width of the canvas. Needs to be kept in sync with element width declared in the htmlheight
: height of the canvas. Needs to be kept in sync with element height declared in the html
RENDER_AXIS
: enable/disable rendering of the x and y axisRENDER_ARMS
: enable/disable rendering of the galaxy arm guidelinesRENDER_CLUSTERS
: enable/disable rendering star cluster bordersRENDER_STARS
: enable/disable rendering of all starsRENDER_STARS_ARM
: enable/disable rendering of filler stars in the arms (does not effect cluster stars)RENDER_STARS_GENERAL
: enable/disable rendering of the stars between the galaxy arms
Density values here represent N/1000 stars/pixel for a given region. Finding a comfortable balance here is very much a manual effort.
MIN_STAR_DISTANCE
: Minimum number of pixels between any two starsSTAR_DENSITY_GENERAL
: Star density for stars between arms of the galaxySTAR_DENSITY_ARM
: Star dentity for stars in the galaxy arms, but not in the star clustersSTAR_DENSITY_CLUSTER_MIN
: Minimum boundry for star cluster densitySTAR_DENSITY_CLUSTER_MAX
: Maximum boundry for star cluster density
The following are a couple examples of the resulting maps.
This first image is with the default settings
This second image is with cluster density significantly increased