Procedural Generated Texture and Map

Project Type – 4th year college project

Language used – Java

Length of project – 3 months (Feb 2016 – Apr 2016)

This is my 4th year project in where i tried to generate a cave-like map using both Perlin Noise and Cellular Automata. The Perlin Noise Algorithm is used to generate the texture which will be placed on inaccessible areas. Also there is the added functionality of offsetting the image to make it tile better. The Cellular Automata algorithm generates the map. This project was written in Java and done in Eclipse.

Texture map
Figure 1: Map with texture applied
colour perlin noise texture
Figure 2: Generated Noise Texture on its own


This is a section of code where i offset the image.

//——THIS IS FOR OFFSETTING THE IMAGE VERTICALLY—————–
while(count<offset1)
{
//SAVE THE FIRST COLUMN
for(int row = 0; row<baseArray.length;row++)
{
templeft[row][0] = baseArray[row][0];
}
//MOVE ALL THE VERTICAL LINES FORWARD ONE
for(int column = 0; column<baseArray[0].length-1;column++)
{
for(int row = 0; row<baseArray.length;row++)
{
baseArray[row][column] = baseArray[row][column+1];
}
}
//PUT THE STORED COLUMN AT THE END OF THE ARRAY
for(int row = 0; row<baseArray.length;row++)
{
baseArray[row][baseArray.length-1] = templeft[row][0];
}
count++;
}
//——THIS IS FOR OFFSETTING THE IMAGE Horizontally—————
while(count<offset2)
{
//SAVE THE FIRST COLUMN
for(int column = 0; column<baseArray[0].length;column++)
{
tempdown[0][column] = baseArray[0][column];
}
//MOVE ALL THE VERTICAL LINES FORWARD ONE
for(int row = 0; row<baseArray[0].length-1;row++)
{
for(int column = 0; column<baseArray.length;column++)
{
baseArray[row][column] = baseArray[row+1][column];
}
}
//PUT THE STORED COLUMN AT THE END OF THE ARRAY
for(int column = 0; column<baseArray.length;column++)
{
baseArray[baseArray.length-1][column] = tempdown[0][column];
}
count++;
}

Leave a comment

Website Built with WordPress.com.

Up ↑