MCPcopy Index your code
hub / github.com/SudoPlayGames/Joise

github.com/SudoPlayGames/Joise @1.1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.1.0 ↗ · + Follow
922 symbols 3,213 edges 181 files 101 documented · 11% updated 7y ago1.1.0 · 2018-05-29★ 744 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Image

Joise

Joise is a 2D, 3D, 4D and 6D modular noise library written in Java.

Joise is derived from Joshua Tippetts' Accidental Noise Library written in C++.

Maven:

groupId=com.sudoplay.joise
artifactId=joise
version=1.1.0-RC3

Why Joise?

Joise was created to facilitate the creation of complex noise functions from chained modules, and represent the chained modules in a flat format convenient for text serialization.

Joise was originally created to power the procedural world-building algorithms behind the PC game, Lodestar: Stygian Skies.

What is in this repository?

Documentation: * README.md this file * LICENSE the license (link)

The repo contains the following packages: * com.sudoplay.joise - classes to work with module maps * com.sudoplay.joise.generator - classes to generate pseudo-random numbers * com.sudoplay.joise.mapping - classes to assist in mapping noise to arrays * com.sudoplay.joise.module - all the noise function modules * com.sudoplay.joise.noise - the core noise functions * com.sudoplay.joise.util - common utility classes

The following packages are provided separately to reduce dependencies: * JoisePlugin-TMLConverter converts module chains to and from TML using Juple. * JoisePlugin-JSONConverter converts module chains to and from JSON using Gson.

Change Log

1.1.0

  • changed project structure to adhere to gradle conventions (#12)
  • deprecated method calculate() in ModuleAutoCorrect class (replace with calculateAll() method) (#16)
  • added dimension respective calculate methods in ModuleAutoCorrect class: calculate2D(), calculate3D(), calculate4D(), calculate6D() (#16)
  • added calculateAll() method in ModuleAutoCorrect class to replace deprecated calculate() method (#16)
  • fixed unused constant defaults in ModuleFractal class (#17)
  • moved derivative spacing field and related methods from Module base class into ModuleFractal class since the field and related methods are only ever used for deCarpentierSwiss type fractal noise (#18)
  • added methods in Module base class that read a property from a ModulePropertyMap and return a default value if the property map doesn't contain the provided key; useful for reading new properties from older maps that may not contain the new properties (#18)
  • moved all module property map accessor methods from the Module base class into the ModulePropertyMap class; refactored modules accordingly (#18)
  • changed name of SeedableModule to SeededModule (#18)
  • added method Module#setSeed(String seedName, long seed) to replace similar method in Joise class
  • added ModuleChainBuilder class to build module chains from ModuleMap; replaces similar functionality in Joise class
  • removed Joise class
  • removed Assert utility class
  • moved package com.sudoplay.util to com.sudoplay.joise.util
  • moved MAX_SOURCES constant out of Module class; separated into two constants, one in ModuleCombiner and ModuleFractal
  • fixed ModuleFractal#calcWeights(FractalType) is only called when the FractalType is set (#23)
  • fixed ModuleBasisFunction rotation axis and angle are not written to or read from the ModuleMap (#22)
  • removed unused scale and offset fields and associated method from ModuleBasisFunction class; fixes #20
  • removed old util package from gwt xml
  • fixed can't set seed name with ModuleFractal (#25)
  • added more examples
  • changed interface naming convention: all interfaces are now prefixed with I to indicate interface

View changelog for all versions

Examples

Chaining Modules

Most modules accept one or more sources. Sources can either be a module or a double value.

ModuleBasisFunction basis = new ModuleBasisFunction();
basis.setType(BasisType.SIMPLEX);
basis.setSeed(42);

ModuleAutoCorrect correct = new ModuleAutoCorrect();
correct.setSource(basis);
correct.calculate();

ModuleScaleDomain scaleDomain = new ModuleScaleDomain();
scaleDomain.setSource(correct);
scaleDomain.setScaleX(4.0);
scaleDomain.setScaleY(4.0);

Sampling Chained Modules

A module chain can be sampled in either two, three, four or six dimensions. Four and six dimensional noise is used for creating seamless two and three dimensional noise, respectively.

lastModuleInChain.get(x, y);
lastModuleInChain.get(x, y, z);
lastModuleInChain.get(x, y, z, w);
lastModuleInChain.get(x, y, z, w, u, v);

Exporting a Module Chain

Module chains can be converted to and from a ModuleMap. This is convenient for serializing module chains because converting a chain to a ModuleMap will flatten the module chain tree.

// convert to a ModuleMap
ModuleMap moduleMap = lastModuleInChain.getModuleMap();
// convert from a ModuleMap
Module module = new ModuleChainBuilder().build(moduleMap);
// sample the resulting chain
module.get(x, y, z);

Naming Seeds

Seeds can be named. This is convenient if you want to load a module chain from an external format, and set seeds programatically.

ModuleBasisFunction basis = new ModuleBasisFunction();
basis.setSeedName("worldseed");
ModuleMap moduleMap = basis.getModuleMap();

// ... save the module map to some external format ...

// ... load the module map back in later ...

Module module = new ModuleChainBuilder().build(loadedModuleMap);
module.setSeed("worldseed", 42);

License

Copyright (C) 2016 Jason Taylor. Released as open-source under Apache License, Version 2.0.

Extension points exported contracts — how you extend this code

IFunction2D (Interface)
(no doc) [73 implementers]
src/main/java/com/sudoplay/joise/noise/function/spi/IFunction2D.java
IFunction6D (Interface)
(no doc) [73 implementers]
src/main/java/com/sudoplay/joise/noise/function/spi/IFunction6D.java
IFunction4D (Interface)
(no doc) [73 implementers]
src/main/java/com/sudoplay/joise/noise/function/spi/IFunction4D.java
IFunction3D (Interface)
(no doc) [73 implementers]
src/main/java/com/sudoplay/joise/noise/function/spi/IFunction3D.java
IWorkerNoise2 (Interface)
(no doc) [11 implementers]
src/main/java/com/sudoplay/joise/noise/worker/spi/IWorkerNoise2.java

Core symbols most depended-on inside this repo

get
called by 447
src/main/java/com/sudoplay/joise/noise/function/spi/IFunction2D.java
set
called by 160
src/main/java/com/sudoplay/joise/module/ScalarParameter.java
fastFloor
called by 81
src/main/java/com/sudoplay/joise/noise/Noise.java
setNumOctaves
called by 77
src/main/java/com/sudoplay/joise/module/ModuleFractal.java
setFrequency
called by 77
src/main/java/com/sudoplay/joise/module/ModuleFractal.java
setSource
called by 77
src/main/java/com/sudoplay/joise/module/ModuleAutoCorrect.java
setSource
called by 77
src/main/java/com/sudoplay/joise/module/SourcedModule.java
setType
called by 76
src/main/java/com/sudoplay/joise/module/ModuleFractal.java

Shape

Method 731
Class 172
Interface 13
Enum 6

Languages

Java100%

Modules by API surface

src/main/java/com/sudoplay/joise/module/ModuleFractal.java38 symbols
src/test/java/com/sudoplay/joise/ModuleMapTest.java36 symbols
src/main/java/com/sudoplay/joise/noise/Noise.java28 symbols
src/main/java/com/sudoplay/joise/module/ModuleAutoCorrect.java26 symbols
src/main/java/com/sudoplay/joise/ModulePropertyMap.java23 symbols
src/main/java/com/sudoplay/joise/module/ModuleCombiner.java15 symbols
src/main/java/com/sudoplay/joise/module/ModuleCellGen.java13 symbols
src/main/java/com/sudoplay/joise/module/ModuleBasisFunction.java13 symbols
src/main/java/com/sudoplay/joise/module/ModuleSphere.java12 symbols
src/main/java/com/sudoplay/joise/module/ModuleRotateDomain.java12 symbols
src/main/java/com/sudoplay/joise/module/ModuleTranslateDomain.java11 symbols
src/main/java/com/sudoplay/joise/module/ModuleScaleDomain.java11 symbols

For agents

$ claude mcp add Joise \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact