Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
8d7b7e7
moving code over from Interesting LevelGenerator
space419 Apr 18, 2017
342e82c
readme
space419 Apr 18, 2017
70e3129
deploying
AmanSachan1 Apr 18, 2017
b1440d7
design doc
AmanSachan1 Apr 19, 2017
31acdd5
trying to deploy
space419 Apr 19, 2017
9638e39
fixed weird culling issue
space419 Apr 19, 2017
c692682
multiple layers, gui
AgentLee Apr 26, 2017
544f53e
readme
AgentLee Apr 26, 2017
7defc36
readme again
AmanSachan1 Apr 26, 2017
0beffaa
working on interconnection of layers
AmanSachan1 Apr 26, 2017
212e2a1
interconnecting walkways exist but not being offset :(
AmanSachan1 Apr 26, 2017
da8311b
asbfdl
AmanSachan1 Apr 26, 2017
80a7f6c
deploying attempt
AmanSachan1 Apr 26, 2017
a672a74
deploying attempt again
AmanSachan1 Apr 26, 2017
207d0b8
removed debugger line
AmanSachan1 Apr 26, 2017
48a007f
connectivity is better
AmanSachan1 Apr 26, 2017
f643ba4
added noise code, need to make it work
AmanSachan1 Apr 27, 2017
f8e486d
started noise
AmanSachan1 Apr 28, 2017
9641a50
noise function added, code put down
AmanSachan1 Apr 30, 2017
e1bd9d4
have banded mountains
carolinazheng May 1, 2017
d9052db
have mountains and the sea
AmanSachan1 May 1, 2017
eebd2e4
fog died for mountains
AmanSachan1 May 2, 2017
91e3668
have fog :D
AmanSachan1 May 2, 2017
4dc21ae
added check for intersecting paths, 3D case
AmanSachan1 May 2, 2017
f3ebd30
have the 8bitint grid set up and filled
AmanSachan1 May 2, 2017
bb6f6a6
have fall off in mountain elevation
AmanSachan1 May 3, 2017
d898ebc
shader side stuff is done
AmanSachan1 May 3, 2017
95d732b
grid acceleration structure takes too much memory
AmanSachan1 May 3, 2017
b0fdff8
tweaked parameters
AmanSachan1 May 3, 2017
38dac80
tweaks
AmanSachan1 May 3, 2017
7104455
readme
AmanSachan1 May 3, 2017
534659e
readme
AmanSachan1 May 3, 2017
94a193e
readme change
AmanSachan1 May 3, 2017
53a83d4
removed collision checkbox
AmanSachan1 May 3, 2017
7de32f3
fog tweaking
AmanSachan1 May 4, 2017
0460dc2
readme
AmanSachan1 May 4, 2017
317e68a
final report
AmanSachan1 May 5, 2017
8e24370
original OBS video, unedited
AmanSachan1 May 5, 2017
371635a
video
AmanSachan1 May 5, 2017
f5129e0
readme
AmanSachan1 May 5, 2017
d6d4a6a
cinematic ish camera
AmanSachan1 Aug 16, 2017
4661d03
removed ridiculous shadows
AmanSachan1 Aug 17, 2017
6fb247d
deploting
AmanSachan1 Aug 17, 2017
d2007dd
better fog and uncollapsed gui
AmanSachan1 Aug 18, 2017
6528d87
deploying
AmanSachan1 Aug 18, 2017
20bed54
readme update
AmanSachan1 Oct 5, 2017
3ad35e8
readme
AmanSachan1 Oct 5, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
npm-debug.log
Binary file added Final Report.pdf
Binary file not shown.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 Aman Sachan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
102 changes: 101 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,101 @@
# FinalProject
# Interesting Level Generator

[![](images/readme/InterestingLevelGenerator_vimeoLink.png)](https://vimeo.com/227360081)

## Overview

The 'Interesting Level Generator' is a procedural multi-layer dungeon generator that generates levels based on a dynamically generated voronoi like graph after it has been heavily modified by various filters. Realistic fog, crumbling pathways, and terrain are added over the basic level layout to give it a unique mysterious foreign world aesthetic.

![](images/readme/Crossroads_emergent_behaviour.png)

### Original Design Goals

- Procedural 3D game level ( multiple stacks of 2D maps ).
- Implicit surfaces to create terrain on the resulting map floors
- Custom fog shader

The specifications below will be implemented if I have enough time in the final week:
- Controllable Player character
- Collision handling so player can’t walk through geometry.

## Techniques Used
### 2D Maps Level Generation:
#### Room Generation:

![](images/readme/voronoi1.png)
![](images/readme/voronoi2.png)

- Using sampling and rejection to layout the slabs in a given space.
- Then use a fake voronoi generation technique to create a graph. The fake voronoi technique consists of first starting with 3 connected nodes, and then for every new node you want to add to the graph you find the 2 closest neighbours from the existing graph and form edges between them.
- We can improve the above technique a bit more by sorting the positions of the slabs along one axis. This makes the connections look more like a voronoi pattern.
- This graph is highly connected so we randomly remove connections.
- The graph can end up with intersecting edges in a few edge cases, so we carry out 2D line intersection tests and remove any intersections if they exist.

#### Walkways between slabs:

![](images/readme/ThickWalkway.png)

- Because of the graph we created above we have edge and node data, in other words we know which points to connect. So between any 2 points we could lay out corridors(planes) to connect them, but this is boring.
- Instead we can use instancing to place many many tiny cubes along the line segment and then randomly remove cubes to make it look like a crumbling walkway.
- We also need to give the walkway some width so we take the cross product of the direction of the line segment and the y axis (up) to get a horizontal ortho-normal direction for width. Add instanced cubes not just on the line segment but for a certain width for each line segment.

### 3D Level Generation:
We can create multiple 2D maps at different heights.

#### Interlevel Connecting Paths:

![](images/readme/LayerConnectivity.png)

- This is a similar problem to the one we solved in “Walkway between slabs” section; But now it’s in 3D.
- For every layer we pick a random node/slab as the starting point of our path between layers.
- For the end point of that line segment we search through the nodes in the layer above for rooms that are beyond a certain distance from the randomly picked starting node (so paths don’t go straight up and there is more complexity in connections), and form a list of these “toNodes”.
- Pick a random “toNode”, and using the random starting node we have a 3D line segment.
- Create a similar instancing cubes setup for these paths as we did with the walkways.
- Remove random lines, and also carry out 3D intersection tests and remove any intersecting paths, if they exist.

#### Path shifting for Paths:

![](images/readme/NoCrumble.png)

- To make the paths connecting walkways seem more organic and prevent janky looking paths that start at the center of each cell and end at the center of the other one ( this is a problem as a player can never go to a higher layer, they will be stuck underneath the “toNode” ).
- We need to shift paths to the edges of the cells they are connecting. Simply offset by the width and length in the correct direction.
- To add organic paths we should shift by both the width and length.

#### Fog:

![](images/readme/Fog_max.png)
![](images/readme/Fog_min.png)

- Created in the shader, with global control of density, color, and a on/off switch.
- A good approximation of fog fall-off is: e-(fogDensity2 x distance2)
- Fog also appears to have different densities at the periphery of our vision, so we need to account for rimColor.
- Resource: http://in2gpu.com/2014/07/22/create-fog-shader/

#### Terrain:

![](images/readme/Terrain.png)

- Terrain was created in the shader.
- Create an elevation map and a moisture map using smoothed 2D noise with different seed values (or different noise functions).
- Use the elevation map to deform vertices in the shader.
- Create a moisture map ( similar to the elevation map ).
- Use the float values from the elevation and moisture as uv values to determine colors from gradients.

#### Grid based Acceleration:
- Takes too much memory, and so was never used for anything.

## Future Work
- kD tree acceleration Structure for Collision Handling
- Character with basic character controls
- Collision handling for the character
- Trampolines to fill up empty and negative space

## Resources
- Terrain: http://www.redblobgames.com/maps/terrain-from-noise/
- Fog: http://in2gpu.com/2014/07/22/create-fog-shader/

## Moar Images!!

![](images/readme/SomeCrumble.png)
![](images/readme/ThinWalkway.png)
![](images/readme/variableRoomSize.png)
Binary file added Results/Final Report.pdf
Binary file not shown.
Binary file added Results/FinalProjectDesignDoc.pdf
Binary file not shown.
Binary file added Results/Images/CrossRoadsEmergentBehaviour.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Results/Images/CrumbleStatusMax.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Results/Images/CrumbleStatusMid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Results/Images/CrumbleStatusMin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Results/Images/FatWalkway.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Results/Images/Fog1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Results/Images/Fog2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Results/Images/LayerConnectivity.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Results/Images/LayerConnectivityMore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Results/Images/LimitedConnection2DMap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Results/Images/LimitedConnection2DMapHalf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Results/Images/MultipleLayers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Results/Images/Terrain1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Results/Images/VariableRoomSize.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Results/Images/Voronoi1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Results/Images/Voronoi2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Results/Images/thinWalkway.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Results/InterestingLevelGeneratorEdited.mp4
Binary file not shown.
Binary file added Results/Videos/InterestingLevelGenerator.mp4
Binary file not shown.
Loading