Experiment 3 - ProcGen/Alternate Worlds

seed

Description

What are you trying to acomplish with this experiment?
This here is a overworld river scene generator. It features varying grass and dark charcoal sands with smooth transitions between the. There is also a little village of a varying number of houses frequently. I applied a smooth transition for the winter to spring.
Codes:
The variation in dirt grass and houses can be seen randomly selected grass
placeTile(i, j, (4 * pow(random(), g)) | 0, 6);
randomly selected dirt
placeTile(i, j, (4 * pow(random(), g)) | 0, 9);
randomly selected house of 2
if (random() < 0.5) { placeTile(i, j, 26, 3); } else { placeTile(i, j, 26, 2);
with a noisey river that spawns one of the couple river tiles placeTile(i, j, (4 * pow(noise(noiseT / 10, i, j / 4 + noiseT), 2)) | 0, 14);
all of which (except the river) alternate with other tiles for the season change using millis() let tileTime = millis() - delay;
Life: I applied a smooth transition for the winter to spring (and back) using millis() to give each tile a lifetime before the change. This shows time passing.


Technical

Describe in detail what you did technically and how it works?
using p5.js I was able to tile a canvas using noise and math to generate landscapes. I added cool variation with time using the millis function. The generateGrid function creates a grid for a overworld landscape, applying Perlin noise to make a flowing river across the grid. This function uses a constrain function to make the river remains within the grid boundaries and vertical shape.


Reflection

I think I did a good job and I am proud of the work I did. I spent like 27 hours on the whole thing and tried very hard because my last assignment was supposedly not satisfactory. Getting the rooms to not spawn next to or on top of each other sucked but I figured it out after a long time.
My most proud accomplishments are definitely the Winter to Spring, non overlapping or adjacent rooms, the millis transitions, and the general aesthetic appeal. I was pretty satisfied with the final product and definitely deserve a full credit.

(using tiles from Micro Tileset - Overworld & Dungeon by thkaspar)

seed

Description

What are you trying to acomplish with this experiment?
This here is a dungeon scene generator. It generates 3 rooms of random sizes in random places, and 2 randomly placed chests in 2 rooms. The rooms are connected by paths with 90 degree turns and no adjacent tiling. The rooms never overlap or spawn directly next to each other either. The chests open and close in the dungeon before the scene is shifted to a desert variation of the same dungeon shape. The generator can be reseeded for new dungeons.

CODES:
Dirt variation -
if (useAlternate) {
placeTile(i, j, Math.floor(random(1, 4)), 15);
} else {
placeTile(i, j, Math.floor(random(21, 23)), 21);
}
Floor variation -
if (useAlternate) {
placeTile(i, j, Math.floor(random(1, 4)), 19);
} else {
placeTile(i, j, Math.floor(random(4)), 10);
}
If I had wall variation it would be like this but it looks dumb so I didnt include it -
if (useAlternate) {
placeTile(i, j, Math.floor(random(2, 4)), 21);
} else {
placeTile(i, j, Math.floor(random(30, 32)), 3);
}
I just did this instead
if (useAlternate) {
placeTile(i, j, 4, 21);
} else {
placeTile(i, j, 30, 3); // Outline tile
}
Same for chests -
if (useAlternate2) {
placeTile(i, j, Math.floor(random(0, 3)), 29);
} else {
placeTile(i, j, Math.floor(random(3, 5)), 29);
}
but only included this in final product (this is the chest opening and closing)
if (useAlternate2) {
placeTile(i, j, 2, 29);
} else {
placeTile(i, j, 5, 29); // Chest tile
}

LIFE:
Life can be seen in opening and closing chests to show time passing. The dungeon also changes to a desert but that doesnt really show time passing. I used millis() for both changes.


Technical

Describe in detail what you did technically and how it works? The function generateGrid creates rooms and hallways without overlap using the helper function isOccupied. This function checks if a room overlaps or is adjacent to any existing rooms before it is placed. It also includes corridors with only 90 degree turns and outlines everything. The drawGrid function uses the millis() function switch between a different dungeon style and open/closed chests.


Reflection

I think I did a good job and I am proud of the work I did. I spent like 27 hours on the whole thing and tried very hard because my last assignment was supposedly not satisfactory. Getting the rooms to not spawn next to or on top of each other sucked but I figured it out after a long time.
My most proud accomplishments are definitely the Winter to Spring, non overlapping or adjacent rooms, the millis transitions, and the general aesthetic appeal. I was pretty satisfied with the final product and definitely deserve a full credit.



(using tiles from Micro Tileset - Overworld & Dungeon by thkaspar)