Skip to content

Commit

Permalink
Gridlines are now consistently 1000x1000
Browse files Browse the repository at this point in the history
  • Loading branch information
dries007 committed Feb 11, 2018
1 parent eaa08b1 commit cd615b6
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 25 deletions.
7 changes: 6 additions & 1 deletion readme.md
Expand Up @@ -9,7 +9,8 @@ There are 2 main reasons I'm making this:
1. I wanted to be able to check one or more existing seeds for resoureces and/or make maps of those resources.
2. I wanted to make a non-spoiling way to select a good seed. (aka be sure it has some decent resources within a reasonable radius of spawn, without knowing where to go look)

**For a color legend, see [below](#legend).**

**For info about the maps, including a color legend, see [below](#legend).**

Download builds [here](https://jenkins.dries007.net/job/TFCSeedMaker/).

Expand Down Expand Up @@ -48,6 +49,10 @@ Done/Todo
Legend
------

The lines on the map are 1000x1000 grid lines.
The resolution is 1 block per pixel.
The "combined" map is a biome map with the outlines of the rock and tree layers.

You can also generate this image by running the `net.dries007.tfc.seedmaker.MainLegend` class.

![A color map](legend.png)
Expand Up @@ -26,7 +26,7 @@ public class CommandLineInterface implements Runnable
@Parameter(names = {"-r", "--radius"}, description = "Radius in blocks")
public int radius = 1024 * 5;

@Parameter(names = {"-c", "--chunksize"}, description = "Size per 'chunk'")
@Parameter(names = {"-c", "--chunksize"}, description = "Size per 'chunk', more is faster but used (a lot) more RAM")
public int chunkSize = 128;

@Parameter(names = {"-s", "--seed", "--seeds"}, description = "The seeds to use, if none provided one random seed is chosen per thread. Comma separated list of strings")
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/dries007/tfc/seedmaker/datatypes/Rock.java
Expand Up @@ -14,6 +14,8 @@ public enum Rock implements IDataType
GRANITE(0, new Color(0xff8080)),
DIORITE(1, new Color(0xae80ff)),
GABBRO(2, new Color(0x80ffdc)),
//3
//4
SHALE(5, new Color(0xf3ff80)),
CLAYSTONE(6, new Color(0xff80c5)),
ROCKSALT(7, new Color(0x8097ff)),
Expand Down
48 changes: 25 additions & 23 deletions src/main/java/net/dries007/tfc/seedmaker/util/WorldGen.java
Expand Up @@ -31,10 +31,6 @@ public class WorldGen implements Runnable
public static final int COLORS[] = new int[256];
// Biomes ids overlap with others, so they have their own maps
public static final int COLORS_BIOME[] = new int[256];
// public static final int COLORSROCK[] = new int[256];
// public static final int COLORSTREE[] = new int[256];
//private static final String[] FILENAMES = {"Combined", "Rock_Top", "Rock_Middle", "Rock_Bottom", "Tree_0", "Tree_1", "Tree_2", "EVT", "Rain", "Stability", "PH", "Drainage", "Biomes"};
//private static final boolean[] COMBINE = {false, true, true, true, true, true, true, false, false, false, false, false, false};

public final String seedString;
public final long seed;
Expand Down Expand Up @@ -330,34 +326,40 @@ public void run()
treeMap2.put(Tree.LIST[trees2[i]], treeMap2.get(Tree.LIST[trees2[i]]) + 1);
}

// If we are drawing the combined layer draw the biome color. (But not if we are on a 1000 x 1000 grid line)
if (maps[0] && x + xx % 1000 != 0 && y + yy % 1000 != 0)
// If we are drawing the combined layer draw the biome color. (but not if we are on a grid line)
if (maps[0] && (x + xx) % 1000 != 0 && (yy + y) % 1000 != 0)
{
// maps[0] and imageLines[0] are from COMBINED (id = 0)
ImageLineHelper.setPixelRGB8(imageLines[0][yy], x + xx - xOffset, COLORS_BIOME[biomeId]);
}
// if xx or yy isn't on a chunk's edge (because then we can't check the bordering column)
if (xx != 0 && yy != 0 && xx + 1 != chunkSize && yy + 1 != chunkSize)

// Per image
for (Layers layer : Layers.values())
{
// Per image
for (Layers layer : Layers.values())
// Skip the combined layer, its special
if (layer == COMBINED) continue;
// If we aren't drawing it, skip
if (!maps[layer.ordinal()]) continue;
// Get the int values
final int[] ints = layers[layer.ordinal()];
// The value at this column
final int us = ints[i];
// Draw the pixel on row yy, at the adjusted x coordinates.
int color = COLORS[us];
// Biome colors overlap, those get a seperate color
if (layer == BIOMES) color = COLORS_BIOME[us];

// Don't draw on grid lines
if ((x + xx) % 1000 != 0 && (yy + y) % 1000 != 0)
{
// Skip the combined layer, its special
if (layer == COMBINED) continue;
// If we aren't drawing it, skip
if (!maps[layer.ordinal()]) continue;
// Get the int values
final int[] ints = layers[layer.ordinal()];
// The value at this column
final int us = ints[i];
// Draw the pixel on row yy, at the adjusted x coordinates. Separated colour spaces so I don't go insane.
int color = COLORS[us];
if (layer == BIOMES) color = COLORS_BIOME[us];

ImageLineHelper.setPixelRGB8(imageLines[layer.ordinal()][yy], x + xx - xOffset, color);
}

// if xx or yy isn't on a chunk's edge (because then we can't check the bordering column)
if (xx != 0 && yy != 0 && (xx + 1) != chunkSize && (yy + 1) != chunkSize)
{
// if a tree or rock layer and we are drawing the combined layer
if (layer.addToCombined && maps[COMBINED.ordinal()])
if (layer.addToCombined && maps[0])
{
// get the 4 neighbouring columns
final int up = ints[xx + (yy + 1) * chunkSize];
Expand Down

0 comments on commit cd615b6

Please sign in to comment.