Browse Source

Added terrainGeneration module (WIP); added Doxyfile for easier doc generation

master
Macoy Madson 6 years ago
parent
commit
d0819bd970
12 changed files with 2531 additions and 219 deletions
  1. +2
    -2
      data/files.ept
  2. +61
    -0
      data/scripts/world/terrainGen/limitedTileConversionSettings.ept
  3. +2303
    -0
      docs/Doxyfile
  4. +5
    -2
      makefile
  5. BIN
      src/experimentation/fastTerrain
  6. +7
    -2
      src/experimentation/fastTerrain.cpp
  7. +2
    -0
      src/utilities/pool.hpp
  8. +0
    -140
      src/world/noiseGeneration.cpp
  9. +0
    -41
      src/world/noiseGeneration.hpp
  10. +102
    -26
      src/world/terrainGeneration.cpp
  11. +48
    -5
      src/world/terrainGeneration.hpp
  12. +1
    -1
      src/world/world.cpp

+ 2
- 2
data/files.ept View File

@ -25,6 +25,6 @@ specialScripts:
worldDefaults:
//tileSet=data/images/castle.png;
//tileSet=limitedTileMap;
tileSet=tileMap;
tileSet=limitedTileMap;
//tileSet=tileMap;
defaultMap=data/maps/default.map;

+ 61
- 0
data/scripts/world/terrainGen/limitedTileConversionSettings.ept View File

@ -0,0 +1,61 @@
<limitedTileConversionSettings.1>
//Deep ocean
20:
x=0;
y=0;
//Ocean
30:
x=1;
y=0;
//Shallow ocean
35:
x=2;
y=0;
//Shore
40:
x=3;
y=0;
//41 -> 45: Wet Beach
45:
x=4;
y=0;
//46 -> 55: Dry sand
55:
x=5;
y=0;
//56 -> 80: Low grass
80:
x=6;
y=0;
//81 -> 100: Mid grass
100:
x=7;
y=0;
//101 -> 145: High grass
145:
x=8;
y=0;
//146 -> 180: Mountain low
180:
x=9;
y=0;
//181 -> 220: Mountain mid
220:
x=10;
y=0;
//221 -> 230: Mountain high
230:
x=11;
y=0;
//231 -> 255: Ice/snow
255:
x=12;
y=0;

+ 2303
- 0
docs/Doxyfile
File diff suppressed because it is too large
View File


+ 5
- 2
makefile View File

@ -4,10 +4,10 @@ EXECUTABLE_NAME= LOCAL_horizon
OBJ_DIR= LOCAL_obj
LINK= g++ -std=c++11 -Wall -o "$(EXECUTABLE_NAME)"
LINKLIBS= -lBox2D -lbase2.0 -lsfml-graphics -lsfml-window -lsfml-system
horizon: $(OBJ_DIR)/debugText.o $(OBJ_DIR)/pool.o $(OBJ_DIR)/quadTree.o $(OBJ_DIR)/micropather.o $(OBJ_DIR)/coord.o $(OBJ_DIR)/imageManager.o $(OBJ_DIR)/renderQueue.o $(OBJ_DIR)/inputState.o $(OBJ_DIR)/time.o $(OBJ_DIR)/eventManager.o $(OBJ_DIR)/resourceTree.o $(OBJ_DIR)/item.o $(OBJ_DIR)/itemDatabase.o $(OBJ_DIR)/itemProcessor.o $(OBJ_DIR)/consumableItemProcessor.o $(OBJ_DIR)/itemManager.o $(OBJ_DIR)/object.o $(OBJ_DIR)/component.o $(OBJ_DIR)/objectProcessor.o $(OBJ_DIR)/pickupObjectProcessor.o $(OBJ_DIR)/agentProcessor.o $(OBJ_DIR)/objectProcessorDir.o $(OBJ_DIR)/objectManager.o $(OBJ_DIR)/cell.o $(OBJ_DIR)/world.o $(OBJ_DIR)/path.o $(OBJ_DIR)/pathManager.o $(OBJ_DIR)/needMath.o $(OBJ_DIR)/need.o $(OBJ_DIR)/process.o $(OBJ_DIR)/useItemProcess.o $(OBJ_DIR)/gotoResourceProcess.o $(OBJ_DIR)/processMap.o $(OBJ_DIR)/agent.o $(OBJ_DIR)/needProcessor.o $(OBJ_DIR)/hungerNeedProcessor.o $(OBJ_DIR)/processDirectory.o $(OBJ_DIR)/species.o $(OBJ_DIR)/main.o
horizon: $(OBJ_DIR)/debugText.o $(OBJ_DIR)/pool.o $(OBJ_DIR)/quadTree.o $(OBJ_DIR)/micropather.o $(OBJ_DIR)/coord.o $(OBJ_DIR)/terrainGeneration.o $(OBJ_DIR)/imageManager.o $(OBJ_DIR)/renderQueue.o $(OBJ_DIR)/inputState.o $(OBJ_DIR)/time.o $(OBJ_DIR)/eventManager.o $(OBJ_DIR)/resourceTree.o $(OBJ_DIR)/item.o $(OBJ_DIR)/itemDatabase.o $(OBJ_DIR)/itemProcessor.o $(OBJ_DIR)/consumableItemProcessor.o $(OBJ_DIR)/itemManager.o $(OBJ_DIR)/object.o $(OBJ_DIR)/component.o $(OBJ_DIR)/objectProcessor.o $(OBJ_DIR)/pickupObjectProcessor.o $(OBJ_DIR)/agentProcessor.o $(OBJ_DIR)/objectProcessorDir.o $(OBJ_DIR)/objectManager.o $(OBJ_DIR)/cell.o $(OBJ_DIR)/world.o $(OBJ_DIR)/path.o $(OBJ_DIR)/pathManager.o $(OBJ_DIR)/needMath.o $(OBJ_DIR)/need.o $(OBJ_DIR)/process.o $(OBJ_DIR)/useItemProcess.o $(OBJ_DIR)/gotoResourceProcess.o $(OBJ_DIR)/processMap.o $(OBJ_DIR)/agent.o $(OBJ_DIR)/needProcessor.o $(OBJ_DIR)/hungerNeedProcessor.o $(OBJ_DIR)/processDirectory.o $(OBJ_DIR)/species.o $(OBJ_DIR)/main.o
@echo -----------Linking horizon-------------------------
mv *.o $(OBJ_DIR)
(cd $(OBJ_DIR) && $(LINK) debugText.o pool.o quadTree.o micropather.o coord.o imageManager.o renderQueue.o inputState.o time.o eventManager.o resourceTree.o item.o itemDatabase.o itemProcessor.o consumableItemProcessor.o itemManager.o object.o component.o objectProcessor.o pickupObjectProcessor.o agentProcessor.o objectProcessorDir.o objectManager.o cell.o world.o path.o pathManager.o needMath.o need.o process.o useItemProcess.o gotoResourceProcess.o processMap.o agent.o needProcessor.o hungerNeedProcessor.o processDirectory.o species.o main.o $(LINKLIBS))
(cd $(OBJ_DIR) && $(LINK) debugText.o pool.o quadTree.o micropather.o coord.o terrainGeneration.o imageManager.o renderQueue.o inputState.o time.o eventManager.o resourceTree.o item.o itemDatabase.o itemProcessor.o consumableItemProcessor.o itemManager.o object.o component.o objectProcessor.o pickupObjectProcessor.o agentProcessor.o objectProcessorDir.o objectManager.o cell.o world.o path.o pathManager.o needMath.o need.o process.o useItemProcess.o gotoResourceProcess.o processMap.o agent.o needProcessor.o hungerNeedProcessor.o processDirectory.o species.o main.o $(LINKLIBS))
mv $(OBJ_DIR)/$(EXECUTABLE_NAME) .
#cppcheck --enable=all --std=c++11 --template=gcc -q -v src
@ -35,6 +35,9 @@ $(OBJ_DIR)/micropather.o: src/utilities/micropather.h src/utilities/micropather.
$(OBJ_DIR)/coord.o: src/world/coord.hpp src/world/coord.cpp
$(FLAGS) src/world/coord.hpp
$(FLAGS) src/world/coord.cpp
$(OBJ_DIR)/terrainGeneration.o: src/world/terrainGeneration.hpp src/world/terrainGeneration.cpp
$(FLAGS) src/world/terrainGeneration.hpp
$(FLAGS) src/world/terrainGeneration.cpp
$(OBJ_DIR)/time.o: src/world/time.hpp src/world/time.cpp
$(FLAGS) src/world/time.hpp
$(FLAGS) src/world/time.cpp


BIN
src/experimentation/fastTerrain View File


+ 7
- 2
src/experimentation/fastTerrain.cpp View File

@ -214,14 +214,14 @@ int main()
const float LEAF_VALUE = 50;
biomeValue = 3 * 32; //Forest
//Generate trees
float treeValue = scaled_octave_noise_3d(1, 0.55, treeScale, 0, 50, x, y, seed + 9594);
/*float treeValue = scaled_octave_noise_3d(1, 0.55, treeScale, 0, 50, x, y, seed + 9594);
///use another layer of noise to get less connected trees
treeValue += scaled_octave_noise_3d(1, 0.55, treeScale, 0, 30, x, y, seed + 4883);
biomeValue = (3 * 32) + ((int)value % 32);
if (treeValue > LEAF_VALUE) biomeValue = 128;
if (treeValue > TRUNK_VALUE) biomeValue = 35;
if (treeValue > TRUNK_VALUE) biomeValue = 35;*/
}
if (precipitation > JUNGLE_PRECIPITATION)
{
@ -234,6 +234,11 @@ int main()
}
}
//GRID
const int GRID_SIZE = 16;
if (i % GRID_SIZE == 0 && n % GRID_SIZE == 0)
value = 255;
sf::Color colVal = lookup.getPixel(value, lookupY);
pixels[(i * width * 4) + (n * 4)] = colVal.r;
pixels[(i * width * 4) + (n * 4) + 1] = colVal.g;


+ 2
- 0
src/utilities/pool.hpp View File

@ -20,6 +20,8 @@
*
* Note: You must compile with -std=c++11 if you want your data type's
* constructors to be called.
*
* TODO: Need to construct inUse list to be in order (better locality)!
* */
//Generic data container. Holds the requested data as well as pointers to the next


+ 0
- 140
src/world/noiseGeneration.cpp View File

@ -1,140 +0,0 @@
#ifndef NOISEGENERATION_CPP
#define NOISEGENERATION_CPP
#include "noiseGeneration.hpp"
//Creates a TerrainGenSettings from a .ept spec
TerrainGenSettings createTerrainGenSettingsFromSpec(eptFile* spec)
{
}
void getElevationAt(CellIndex cell, int x, int y, TerrainGenSettings* terrainGenSettings)
{
float noiseX = x + (CELL_WIDTH * cellID.x);
float noiseY = y + (CELL_HEIGHT * cellID.y);
noiseX /= 2; //TODO: Raise this value for more accurate floats far away?
noiseY /= 2;
const float SCALE = 0.001;
//TODO: Put all these values in a text file
float value = scaled_octave_noise_3d(10, 0.55, SCALE, 0, 255, noiseX, noiseY, seed);
return value;
}
void generateCellTerrain(int worldID, int seed, int algorithm, CellIndex cell, std::vector<std::vector<tile> >* cellTiles)
{
//I doubt there will be very many, so I'll just put it in switch
switch (algorithm)
{
//Simplex noise world; expects 0-255 colors (terrain.png); no biomes
case 2:
for (int y = 0; y < CELL_HEIGHT; ++y)
{
for (int x = 0; x < CELL_WIDTH; ++x)
{
float value = getElevationAt(cell, x, y);
//Winter bands
if (value > 142)
{
//value += 100 / (((int)(y+1) % 100) + 1);
//int yInt = (int) y;
float factor = fabs(sin(noiseY * SCALE));
const float SNOW_AMOUNT = 1.9;
factor -= SNOW_AMOUNT - factor; //1.3
if (factor < 0) factor = 0;
const float SNOW_FALLOFF = 1000;
value += SNOW_FALLOFF * factor; //Winter climates
if (value > 254) value = 254;
if (value < 142) value = 142;
}
//TEMP DELETE ME!
//value = 150;
if (value > 185) //Mountains are on multiple layers
{
//Ground and onground are solid black
tiles[0][x + (y * CELL_WIDTH)].x = 185;
tiles[0][x + (y * CELL_WIDTH)].y = 0;
tiles[1][x + (y * CELL_WIDTH)].x = 185;
tiles[1][x + (y * CELL_WIDTH)].y = 0;
//Above ground is elevation
tiles[2][x + (y * CELL_WIDTH)].x = value;
tiles[2][x + (y * CELL_WIDTH)].y = 0;
}
else
{
tiles[0][x + (y * CELL_WIDTH)].x = value;
tiles[0][x + (y * CELL_WIDTH)].y = 0;
tiles[1][x + (y * CELL_WIDTH)].x = 255;
tiles[1][x + (y * CELL_WIDTH)].y = 255;
tiles[2][x + (y * CELL_WIDTH)].x = 255;
tiles[2][x + (y * CELL_WIDTH)].y = 255;
}
}
}
std::cout << "Done generating " << tiles.size() << " of " << NUM_LAYERS << " layers addr " << &tiles[0] << " \n";
break;
//Simplex noise (no biome); limited colors (3 for each range)
case 3:
for (int y = 0; y < CELL_HEIGHT; ++y)
{
for (int x = 0; x < CELL_WIDTH; ++x)
{
float value = getElevationAt(cell, x, y);
//Winter bands
if (value > 142)
{
//value += 100 / (((int)(y+1) % 100) + 1);
//int yInt = (int) y;
float factor = fabs(sin(noiseY * SCALE));
const float SNOW_AMOUNT = 1.9;
factor -= SNOW_AMOUNT - factor; //1.3
if (factor < 0) factor = 0;
const float SNOW_FALLOFF = 1000;
value += SNOW_FALLOFF * factor; //Winter climates
if (value > 254) value = 254;
if (value < 142) value = 142;
}
//TEMP DELETE ME!
//value = 150;
if (value > 185) //Mountains are on multiple layers
{
//Ground and onground are solid black
tiles[0][x + (y * CELL_WIDTH)].x = 9;
tiles[0][x + (y * CELL_WIDTH)].y = 0;
tiles[1][x + (y * CELL_WIDTH)].x = 9;
tiles[1][x + (y * CELL_WIDTH)].y = 0;
//Above ground is elevation (the 0.04... maps 0 - 70 to 0 - 3)
float limitedValue = (value - 185) * 0.042857143;
limitedValue += 9;
tiles[2][x + (y * CELL_WIDTH)].x = (unsigned char)limitedValue;
tiles[2][x + (y * CELL_WIDTH)].y = 0;
}
else
{
//The 0.04.... maps 0 - 185 to 0-8
float limitedValue = value * 0.043243243;
tiles[0][x + (y * CELL_WIDTH)].x = (unsigned char)limitedValue;
tiles[0][x + (y * CELL_WIDTH)].y = 0;
//Empty air for all other biomes
tiles[1][x + (y * CELL_WIDTH)].x = 255;
tiles[1][x + (y * CELL_WIDTH)].y = 255;
tiles[2][x + (y * CELL_WIDTH)].x = 255;
tiles[2][x + (y * CELL_WIDTH)].y = 255;
}
}
}
std::cout << "Done generating " << tiles.size() << " of " << NUM_LAYERS << " layers addr " << &tiles[0] << " \n";
break;
default:
std::cout << algorithm << " is not a valid algorithm (Cell.generate())\n";
break;
}
calculateDifficulty();
generated = true;
}
//Wrapper function to simplex noise lib
float scaledOctaveNoise3d(float octaves, float persistence, float scale, float x, float y, float z)
{
return scaled_octave_noise_3d(octaves, persistence, scale, x, y, z);
}
#endif

+ 0
- 41
src/world/noiseGeneration.hpp View File

@ -1,41 +0,0 @@
#ifndef NOISEGENERATION_HPP
#define NOISEGENERATION_HPP
#include <base2.0/ept/eptParser.hpp>
#include "../utilities/simplexnoise.h"
#include "coord.hpp"
//Settings to tell the terrain generation algorithm how to convert from
//noise values to Tiles
struct TileConversionSettings
{
};
//Settings for the terrain generation algorithm
struct TerrainGenSettings
{
int algorithm; //Which algorithm to use (TODO: Make enum)
float seed; //Since seed is just put in Z, it can be float
float positionScale; //Points are multiplied by this value before
//passed to the noise function
float octaves; //Number of octaves of noise to use
float persistence; //How much persistence between octaves of noise
//Settings for how to convert from simplex value to tile
TileConversionSettings tileConversionSettings;
eptFile* spec; //The spec where this information came from
};
//Creates a TerrainGenSettings from a .ept spec.
TerrainGenSettings createTerrainGenSettingsFromSpec(eptFile* spec, float seed);
//Wrapper funcs for simplex noise (TODO: MOVE TO BASE, DAMMIT!)
float scaledOctaveNoise3d(float octaves, float persistence, float scale, float x, float y, float z);
//Generate a single Cell's tiles
void generateCellTerrain(CellIndex cellIndex, std::vector<std::vector<tile> >* tiles, TerrainGenSettings* terrainGenSettings);
#endif

+ 102
- 26
src/world/terrainGeneration.cpp View File

@ -1,11 +1,104 @@
#ifndef NOISEGENERATION_CPP
#define NOISEGENERATION_CPP
#include "noiseGeneration.hpp"
#ifndef TERRAINGENERATION_CPP
#define TERRAINGENERATION_CPP
#include "terrainGeneration.hpp"
#include <iostream>
void getValueAt(
void generateCellTerrain(int worldID, int seed, int algorithm, std::vector<std::vector<tile> >* cellTiles)
//Creates TileConversionSettings from a .ept spec
//Returns false if something failed
bool createTileConversionSettingsFromSpec(eptFile* spec, TerrainGenSettings& terrainGenSettings, int valueRange)
{
//I doubt there will be very many, so I'll just put it in switch
TileConversionSettings newConvSettings;
newConvSettings.lookupTable.resize(valueRange);
if (!spec)
return false;
//Load the TileConversionSettings spec
std::string tileConversionSettingsSpecName = spec->getAttribute("_files.tileConversionSettings");
//This is bad
eptParser parser;
if (!parser.load(tileConversionSettingsSpecName.c_str()))
std::cout << "ERROR: createTileConversionSettingsFromSpec(): Couldn't load tileConversionSettings spec '"
<< tileConversionSettingsSpecName << "'!\n";
return false;
eptFile* tileConversionSettingsSpec = parser.getFile(tileConversionSettingsSpecName);
if (!tileConversionSettingsSpec)
return false;
//For each group in the spec, add a new ValueRangeTile
//Group name is the startValue (forcing proper ordering)
std::string groupName;
eptGroup* currentGroup = tileConversionSettingsSpec->getGroupFromIndex(0, groupName);
for (int i = 1; currentGroup != NULL; i++)
{
//Prepare the ValueRangeTile
ValueRangeTile currentValueRangeTile;
currentValueRangeTile.tileToUse.x = attrToInt(currentGroup->getAttribute("x"));
currentValueRangeTile.tileToUse.y = attrToInt(currentGroup->getAttribute("y"));
currentValueRangeTile.endValue = attrToInt(groupName);
newConvSettings.valueRangeTiles.push_back(currentValueRangeTile);
currentGroup = tileConversionSettingsSpec->getGroupFromIndex(i, groupName);
}
//Take the value range tiles and put them in the lookup table
int currentValue = 0;
for (std::vector<ValueRangeTile>::iterator it = newConvSettings.valueRangeTiles.begin();
it != newConvSettings.valueRangeTiles.end(); ++it)
{
tile currentTile = (*it).tileToUse;
int endValue = (*it).endValue;
for (; currentValue <= endValue; currentValue++)
{
newConvSettings.lookupTable.push_back(currentTile);
}
}
if (valueRange != currentValue)
std::cout << "WARNING: createTileConversionSettingsFromSpec(): Expected " << valueRange << " tile values; got " << currentValue << "\n";
return true;
//TODO: Throw this all away due to biomes...? (need to rethink terrain gen a bit)
}
//Creates a TerrainGenSettings from a .ept spec
TerrainGenSettings createTerrainGenSettingsFromSpec(eptFile* spec, float seed)
{
TerrainGenSettings newTerrainGenSettings;
int valueRange = attrToInt(spec->getAttribute("terrainGenSettings.valueRange"));
newTerrainGenSettings.valueRange = valueRange;
createTileConversionSettingsFromSpec(spec, newTerrainGenSettings, valueRange);
newTerrainGenSettings.algorithm = attrToInt(spec->getAttribute("terrainGenSettings.algorithm"));
newTerrainGenSettings.positionScale = attrToInt(spec->getAttribute("terrainGenSettings.positionScale"));
newTerrainGenSettings.octaves = attrToInt(spec->getAttribute("terrainGenSettings.octaves"));
newTerrainGenSettings.seed = seed;
return newTerrainGenSettings;
}
float getElevationAt(CellIndex cell, int x, int y, TerrainGenSettings* terrainGenSettings)
{
float noiseX = x + (CELL_WIDTH * cell.x);
float noiseY = y + (CELL_HEIGHT * cell.y);
noiseX /= 2; //TODO: Raise this value for more accurate floats far away?
noiseY /= 2;
const float SCALE = 0.001;
//TODO: Put all these values in a text file
//float value = scaled_octave_noise_3d(10, 0.55, SCALE, 0, 255, noiseX, noiseY, seed);
float value = 0;
return value;
}
void generateCellTerrain(int worldID, int seed, int algorithm, CellIndex cell, std::vector<std::vector<tile> >* cellTiles)
{
/* //I doubt there will be very many, so I'll just put it in switch
switch (algorithm)
{
//Simplex noise world; expects 0-255 colors (terrain.png); no biomes
@ -14,13 +107,7 @@ void generateCellTerrain(int worldID, int seed, int algorithm, std::vector<std::
{
for (int x = 0; x < CELL_WIDTH; ++x)
{
float noiseX = x + (CELL_WIDTH * cellID.x);
float noiseY = y + (CELL_HEIGHT * cellID.y);
noiseX /= 2; //TODO: Raise this value for more accurate floats far away?
noiseY /= 2;
const float SCALE = 0.001;
//TODO: Put all these values in a text file
float value = scaled_octave_noise_3d(10, 0.55, SCALE, 0, 255, noiseX, noiseY, seed);
float value = getElevationAt(cell, x, y);
//Winter bands
if (value > 142)
{
@ -68,13 +155,7 @@ void generateCellTerrain(int worldID, int seed, int algorithm, std::vector<std::
{
for (int x = 0; x < CELL_WIDTH; ++x)
{
float noiseX = x + (CELL_WIDTH * cellID.x);
float noiseY = y + (CELL_HEIGHT * cellID.y);
noiseX /= 2; //TODO: Raise this value for more accurate floats far away?
noiseY /= 2;
const float SCALE = 0.001;
//TODO: Put all these values in a text file
float value = scaled_octave_noise_3d(10, 0.55, SCALE, 0, 255, noiseX, noiseY, seed);
float value = getElevationAt(cell, x, y);
//Winter bands
if (value > 142)
{
@ -125,11 +206,6 @@ void generateCellTerrain(int worldID, int seed, int algorithm, std::vector<std::
break;
}
calculateDifficulty();
generated = true;
}
//Wrapper function to simplex noise lib
float scaledOctaveNoise3d(float octaves, float persistence, float scale, float x, float y, float z)
{
return scaled_octave_noise_3d(octaves, persistence, scale, x, y, z);
generated = true;*/
}
#endif

+ 48
- 5
src/world/terrainGeneration.hpp View File

@ -1,8 +1,51 @@
#ifndef NOISEGENERATION_HPP
#define NOISEGENERATION_HPP
#include "../utilities/simplexnoise.h"
#ifndef TERRAINGENERATION_HPP
#define TERRAINGENERATION_HPP
#include <vector>
#include <base2.0/ept/eptParser.hpp>
#include <base2.0/tileMap/tileMap.hpp>
#include "coord.hpp"
//Wrapper funcs for simplex noise
float scaledOctaveNoise3d(float octaves, float persistence, float scale, float x, float y, float z);
struct ValueRangeTile
{
int endValue; //The final value associated with a tile
tile tileToUse;
};
//Settings to tell the terrain generation algorithm how to convert from
//noise values to Tiles
struct TileConversionSettings
{
std::vector<tile> lookupTable; //An array of tiles; one tile for each value
//This is generated at runtime from the ranges
std::vector<ValueRangeTile>
valueRangeTiles; //The tile to use for every value startValue
//(until overridden by a higher start value)
};
//Settings for the terrain generation algorithm
struct TerrainGenSettings
{
int algorithm; //Which algorithm to use (TODO: Make enum)
float seed; //Since seed is just put in Z, it can be float
float positionScale; //Points are multiplied by this value before
//passed to the noise function
float octaves; //Number of octaves of noise to use
float persistence; //How much persistence between octaves of noise
int valueRange; //The total number of different values
//Settings for how to convert from simplex value to tile
TileConversionSettings tileConversionSettings;
eptFile* spec; //The spec where this information came from
};
//Creates a TerrainGenSettings from a .ept spec.
TerrainGenSettings createTerrainGenSettingsFromSpec(eptFile* spec, float seed);
//Generate a single Cell's tiles
void generateCellTerrain(CellIndex cellIndex, std::vector<std::vector<tile> >* tiles, TerrainGenSettings* terrainGenSettings);
#endif

+ 1
- 1
src/world/world.cpp View File

@ -10,7 +10,7 @@
//Where world should search for itself and its files
const std::string WORLDS_PATH = "worlds/";
//Tells cell which world generation algorithm to use to make its tiles
const int WORLD_GEN_ALGORITHM = 2;
const int WORLD_GEN_ALGORITHM = 3;
const unsigned int MAX_INTERSECTING_CELLS = 10;
const int UPDATE_CLOSE_DISTANCE_X = 2048;
const int UPDATE_CLOSE_DISTANCE_Y = 2048;


Loading…
Cancel
Save