├── .gitattributes ├── .gitignore ├── Assets ├── Images.meta ├── Images │ ├── IMAGE_CREDITS │ ├── IMAGE_CREDITS.meta │ ├── building_map.psd │ ├── building_map.psd.meta │ ├── moon_cliff - RED.jpg │ ├── moon_cliff - RED.jpg.meta │ ├── moon_cliff.jpg │ ├── moon_cliff.jpg.meta │ ├── moon_ground2.jpg │ ├── moon_ground2.jpg.meta │ ├── moon_topo_mapaplanet_dot_org.jpg │ ├── moon_topo_mapaplanet_dot_org.jpg.meta │ ├── test_topo 1.psd │ ├── test_topo 1.psd.meta │ ├── test_topo.psd │ └── test_topo.psd.meta ├── Material.meta ├── Material │ ├── SphereMat.mat │ └── SphereMat.mat.meta ├── Scripts.meta ├── Scripts │ ├── CoordHelper.cs │ ├── CoordHelper.cs.meta │ ├── CoordinateManager.cs │ ├── CoordinateManager.cs.meta │ ├── DynamicTerrainChunk.cs │ ├── DynamicTerrainChunk.cs.meta │ ├── DynamicTerrainMaster.cs │ ├── DynamicTerrainMaster.cs.meta │ ├── SphericalCoord.cs │ ├── SphericalCoord.cs.meta │ ├── UICoordinateDisplay.cs │ └── UICoordinateDisplay.cs.meta ├── Structures.meta ├── Structures │ ├── Cool Base.prefab │ ├── Cool Base.prefab.meta │ ├── Materials.meta │ └── Materials │ │ ├── Asphalt.mat │ │ ├── Asphalt.mat.meta │ │ ├── Brick.mat │ │ ├── Brick.mat.meta │ │ ├── Concrete.mat │ │ ├── Concrete.mat.meta │ │ ├── LightBulb.mat │ │ └── LightBulb.mat.meta ├── _COMBINED_SCENE_.unity ├── _COMBINED_SCENE_.unity.meta ├── _COORDINATE_TEST_SCENE_.unity ├── _COORDINATE_TEST_SCENE_.unity.meta ├── _TERRAIN_GEN_TEST_SCENE_.unity └── _TERRAIN_GEN_TEST_SCENE_.unity.meta ├── LICENSE ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NetworkManager.asset ├── Physics2DSettings.asset ├── ProjectSettings.asset ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset └── UnityConnectSettings.asset └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # https://help.github.com/articles/dealing-with-line-endings/ 2 | 3 | # Text files should have their native EOL set on checkout (e.g. LF on Mac/Linux, CRLF on Windows) 4 | * text=auto 5 | 6 | # Make sure Git knows that these are text files 7 | *.cs text 8 | *.xml text 9 | *.lua text 10 | *.txt text 11 | *.lang text 12 | *.md text 13 | *.ver text 14 | 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /[Ll]ibrary/ 2 | /[Tt]emp/ 3 | /[Oo]bj/ 4 | /[Bb]uild/ 5 | /[Bb]uilds/ 6 | /Assets/AssetStoreTools* 7 | /Assets/StreamingAssets/Data/Mods/* 8 | !/Assets/StreamingAssets/Data/Mods/README.md 9 | !/Assets/StreamingAssets/Data/Mods/README.md.meta 10 | /[Pp]roject[Ss]ettings/ProjectVersion.txt 11 | /[Pp]roject[Ss]ettings/GraphicsSettings.asset 12 | /Assets/Resources/ChannelSettings.asset 13 | /Assets/Resources/ChannelSettings.asset.meta 14 | 15 | # Autogenerated VS/MD solution and project files 16 | ExportedObj/ 17 | *.csproj 18 | *.unityproj 19 | *.sln 20 | *.suo 21 | *.tmp 22 | *.user 23 | *.userprefs 24 | *.pidb 25 | *.booproj 26 | *.svd 27 | 28 | 29 | # Unity3D generated meta files 30 | *.pidb.meta 31 | 32 | # Unity3D Generated File On Crash Reports 33 | sysinfo.txt 34 | 35 | # Builds 36 | *.apk 37 | *.unitypackage 38 | 39 | # StyleCop 40 | **StyleCop.Cache* 41 | 42 | # Localization files 43 | /Assets/StreamingAssets/Localization/* 44 | !/Assets/StreamingAssets/Localization/en_US.lang 45 | !/Assets/StreamingAssets/Localization/en_US.lang.meta 46 | 47 | # SpriteToXML Image folders 48 | /Assets/Resources/Editor/SpriteToXML/* 49 | /Assets/Resources/Editor/SpriteToXML.meta 50 | /Assets/Resources/Editor.meta 51 | -------------------------------------------------------------------------------- /Assets/Images.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3ce248ba80a4f7e4daed67eddfbc4b47 3 | folderAsset: yes 4 | timeCreated: 1485885679 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Images/IMAGE_CREDITS: -------------------------------------------------------------------------------- 1 | Terrain splat textures are from: textures.com 2 | 3 | Moon topographic map is from the U.S. Geological Survey's mapaplanet.org website 4 | -------------------------------------------------------------------------------- /Assets/Images/IMAGE_CREDITS.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6286bd68417c6e4418ba97ff6536b3ce 3 | timeCreated: 1485883356 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Images/building_map.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/Assets/Images/building_map.psd -------------------------------------------------------------------------------- /Assets/Images/building_map.psd.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2b043d7704b8ef24ba5210f4475d4dbf 3 | timeCreated: 1489084940 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 0 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 1 23 | grayScaleToAlpha: 0 24 | generateCubemap: 6 25 | cubemapConvolution: 0 26 | seamlessCubemap: 0 27 | textureFormat: 1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: 0 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 0 35 | lightmap: 0 36 | compressionQuality: 50 37 | spriteMode: 0 38 | spriteExtrude: 1 39 | spriteMeshType: 1 40 | alignment: 0 41 | spritePivot: {x: 0.5, y: 0.5} 42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 43 | spritePixelsToUnits: 100 44 | alphaUsage: 1 45 | alphaIsTransparency: 1 46 | spriteTessellationDetail: -1 47 | textureType: 0 48 | textureShape: 1 49 | maxTextureSizeSet: 0 50 | compressionQualitySet: 0 51 | textureFormatSet: 0 52 | platformSettings: 53 | - buildTarget: DefaultTexturePlatform 54 | maxTextureSize: 8192 55 | textureFormat: -1 56 | textureCompression: 0 57 | compressionQuality: 50 58 | crunchedCompression: 0 59 | allowsAlphaSplitting: 0 60 | overridden: 0 61 | - buildTarget: Standalone 62 | maxTextureSize: 8192 63 | textureFormat: -1 64 | textureCompression: 0 65 | compressionQuality: 50 66 | crunchedCompression: 0 67 | allowsAlphaSplitting: 0 68 | overridden: 0 69 | - buildTarget: WebGL 70 | maxTextureSize: 8192 71 | textureFormat: -1 72 | textureCompression: 0 73 | compressionQuality: 50 74 | crunchedCompression: 0 75 | allowsAlphaSplitting: 0 76 | overridden: 0 77 | spriteSheet: 78 | serializedVersion: 2 79 | sprites: [] 80 | outline: [] 81 | spritePackingTag: 82 | userData: 83 | assetBundleName: 84 | assetBundleVariant: 85 | -------------------------------------------------------------------------------- /Assets/Images/moon_cliff - RED.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/Assets/Images/moon_cliff - RED.jpg -------------------------------------------------------------------------------- /Assets/Images/moon_cliff - RED.jpg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a5042332c77042b468176dad0a62009d 3 | timeCreated: 1485012708 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 6 25 | cubemapConvolution: 0 26 | seamlessCubemap: 0 27 | textureFormat: 1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: -1 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | compressionQuality: 50 37 | spriteMode: 0 38 | spriteExtrude: 1 39 | spriteMeshType: 1 40 | alignment: 0 41 | spritePivot: {x: 0.5, y: 0.5} 42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 43 | spritePixelsToUnits: 100 44 | alphaUsage: 1 45 | alphaIsTransparency: 0 46 | spriteTessellationDetail: -1 47 | textureType: 0 48 | textureShape: 1 49 | maxTextureSizeSet: 0 50 | compressionQualitySet: 0 51 | textureFormatSet: 0 52 | platformSettings: 53 | - buildTarget: DefaultTexturePlatform 54 | maxTextureSize: 2048 55 | textureFormat: -1 56 | textureCompression: 1 57 | compressionQuality: 50 58 | crunchedCompression: 0 59 | allowsAlphaSplitting: 0 60 | overridden: 0 61 | spriteSheet: 62 | serializedVersion: 2 63 | sprites: [] 64 | outline: [] 65 | spritePackingTag: 66 | userData: 67 | assetBundleName: 68 | assetBundleVariant: 69 | -------------------------------------------------------------------------------- /Assets/Images/moon_cliff.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/Assets/Images/moon_cliff.jpg -------------------------------------------------------------------------------- /Assets/Images/moon_cliff.jpg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 90c08f77151f88948928e7284dcf9501 3 | timeCreated: 1485012652 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 6 25 | cubemapConvolution: 0 26 | seamlessCubemap: 0 27 | textureFormat: 1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: -1 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | compressionQuality: 50 37 | spriteMode: 0 38 | spriteExtrude: 1 39 | spriteMeshType: 1 40 | alignment: 0 41 | spritePivot: {x: 0.5, y: 0.5} 42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 43 | spritePixelsToUnits: 100 44 | alphaUsage: 1 45 | alphaIsTransparency: 0 46 | spriteTessellationDetail: -1 47 | textureType: 0 48 | textureShape: 1 49 | maxTextureSizeSet: 0 50 | compressionQualitySet: 0 51 | textureFormatSet: 0 52 | platformSettings: 53 | - buildTarget: DefaultTexturePlatform 54 | maxTextureSize: 2048 55 | textureFormat: -1 56 | textureCompression: 1 57 | compressionQuality: 50 58 | crunchedCompression: 0 59 | allowsAlphaSplitting: 0 60 | overridden: 0 61 | spriteSheet: 62 | serializedVersion: 2 63 | sprites: [] 64 | outline: [] 65 | spritePackingTag: 66 | userData: 67 | assetBundleName: 68 | assetBundleVariant: 69 | -------------------------------------------------------------------------------- /Assets/Images/moon_ground2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/Assets/Images/moon_ground2.jpg -------------------------------------------------------------------------------- /Assets/Images/moon_ground2.jpg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 77413f1eebd57da4cbbd84458b660cbc 3 | timeCreated: 1485012651 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 6 25 | cubemapConvolution: 0 26 | seamlessCubemap: 0 27 | textureFormat: 1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: -1 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | compressionQuality: 50 37 | spriteMode: 0 38 | spriteExtrude: 1 39 | spriteMeshType: 1 40 | alignment: 0 41 | spritePivot: {x: 0.5, y: 0.5} 42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 43 | spritePixelsToUnits: 100 44 | alphaUsage: 1 45 | alphaIsTransparency: 0 46 | spriteTessellationDetail: -1 47 | textureType: 0 48 | textureShape: 1 49 | maxTextureSizeSet: 0 50 | compressionQualitySet: 0 51 | textureFormatSet: 0 52 | platformSettings: 53 | - buildTarget: DefaultTexturePlatform 54 | maxTextureSize: 2048 55 | textureFormat: -1 56 | textureCompression: 1 57 | compressionQuality: 50 58 | crunchedCompression: 0 59 | allowsAlphaSplitting: 0 60 | overridden: 0 61 | spriteSheet: 62 | serializedVersion: 2 63 | sprites: [] 64 | outline: [] 65 | spritePackingTag: 66 | userData: 67 | assetBundleName: 68 | assetBundleVariant: 69 | -------------------------------------------------------------------------------- /Assets/Images/moon_topo_mapaplanet_dot_org.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/Assets/Images/moon_topo_mapaplanet_dot_org.jpg -------------------------------------------------------------------------------- /Assets/Images/moon_topo_mapaplanet_dot_org.jpg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5b246a31bd8651c408e94f7f5a88e6cb 3 | timeCreated: 1485012650 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 1 23 | grayScaleToAlpha: 0 24 | generateCubemap: 6 25 | cubemapConvolution: 0 26 | seamlessCubemap: 0 27 | textureFormat: 1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: -1 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | compressionQuality: 50 37 | spriteMode: 0 38 | spriteExtrude: 1 39 | spriteMeshType: 1 40 | alignment: 0 41 | spritePivot: {x: 0.5, y: 0.5} 42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 43 | spritePixelsToUnits: 100 44 | alphaUsage: 1 45 | alphaIsTransparency: 0 46 | spriteTessellationDetail: -1 47 | textureType: 0 48 | textureShape: 1 49 | maxTextureSizeSet: 0 50 | compressionQualitySet: 0 51 | textureFormatSet: 0 52 | platformSettings: 53 | - buildTarget: DefaultTexturePlatform 54 | maxTextureSize: 2048 55 | textureFormat: -1 56 | textureCompression: 1 57 | compressionQuality: 50 58 | crunchedCompression: 0 59 | allowsAlphaSplitting: 0 60 | overridden: 0 61 | - buildTarget: Standalone 62 | maxTextureSize: 2048 63 | textureFormat: -1 64 | textureCompression: 1 65 | compressionQuality: 50 66 | crunchedCompression: 0 67 | allowsAlphaSplitting: 0 68 | overridden: 0 69 | - buildTarget: WebGL 70 | maxTextureSize: 2048 71 | textureFormat: -1 72 | textureCompression: 1 73 | compressionQuality: 50 74 | crunchedCompression: 0 75 | allowsAlphaSplitting: 0 76 | overridden: 0 77 | spriteSheet: 78 | serializedVersion: 2 79 | sprites: [] 80 | outline: [] 81 | spritePackingTag: 82 | userData: 83 | assetBundleName: 84 | assetBundleVariant: 85 | -------------------------------------------------------------------------------- /Assets/Images/test_topo 1.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/Assets/Images/test_topo 1.psd -------------------------------------------------------------------------------- /Assets/Images/test_topo 1.psd.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 61ca4fb5fd2cf7f4db4cbece38a5e71a 3 | timeCreated: 1487265730 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 0 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 1 23 | grayScaleToAlpha: 0 24 | generateCubemap: 6 25 | cubemapConvolution: 0 26 | seamlessCubemap: 0 27 | textureFormat: 1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: 0 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | compressionQuality: 50 37 | spriteMode: 0 38 | spriteExtrude: 1 39 | spriteMeshType: 1 40 | alignment: 0 41 | spritePivot: {x: 0.5, y: 0.5} 42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 43 | spritePixelsToUnits: 100 44 | alphaUsage: 1 45 | alphaIsTransparency: 0 46 | spriteTessellationDetail: -1 47 | textureType: 1 48 | textureShape: 1 49 | maxTextureSizeSet: 0 50 | compressionQualitySet: 0 51 | textureFormatSet: 0 52 | platformSettings: 53 | - buildTarget: DefaultTexturePlatform 54 | maxTextureSize: 8192 55 | textureFormat: -1 56 | textureCompression: 2 57 | compressionQuality: 50 58 | crunchedCompression: 0 59 | allowsAlphaSplitting: 0 60 | overridden: 0 61 | - buildTarget: Standalone 62 | maxTextureSize: 8192 63 | textureFormat: -1 64 | textureCompression: 2 65 | compressionQuality: 50 66 | crunchedCompression: 0 67 | allowsAlphaSplitting: 0 68 | overridden: 0 69 | - buildTarget: WebGL 70 | maxTextureSize: 8192 71 | textureFormat: -1 72 | textureCompression: 2 73 | compressionQuality: 50 74 | crunchedCompression: 0 75 | allowsAlphaSplitting: 0 76 | overridden: 0 77 | - buildTarget: Android 78 | maxTextureSize: 8192 79 | textureFormat: -1 80 | textureCompression: 2 81 | compressionQuality: 50 82 | crunchedCompression: 0 83 | allowsAlphaSplitting: 0 84 | overridden: 0 85 | spriteSheet: 86 | serializedVersion: 2 87 | sprites: [] 88 | outline: [] 89 | spritePackingTag: 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /Assets/Images/test_topo.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/Assets/Images/test_topo.psd -------------------------------------------------------------------------------- /Assets/Images/test_topo.psd.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4beb6c9503520254c89079c49adc1ddb 3 | timeCreated: 1487265730 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 1 23 | grayScaleToAlpha: 0 24 | generateCubemap: 6 25 | cubemapConvolution: 0 26 | seamlessCubemap: 0 27 | textureFormat: 1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: 0 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | compressionQuality: 50 37 | spriteMode: 0 38 | spriteExtrude: 1 39 | spriteMeshType: 1 40 | alignment: 0 41 | spritePivot: {x: 0.5, y: 0.5} 42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 43 | spritePixelsToUnits: 100 44 | alphaUsage: 1 45 | alphaIsTransparency: 0 46 | spriteTessellationDetail: -1 47 | textureType: 0 48 | textureShape: 1 49 | maxTextureSizeSet: 0 50 | compressionQualitySet: 0 51 | textureFormatSet: 0 52 | platformSettings: 53 | - buildTarget: DefaultTexturePlatform 54 | maxTextureSize: 8192 55 | textureFormat: -1 56 | textureCompression: 2 57 | compressionQuality: 50 58 | crunchedCompression: 0 59 | allowsAlphaSplitting: 0 60 | overridden: 0 61 | - buildTarget: Standalone 62 | maxTextureSize: 8192 63 | textureFormat: -1 64 | textureCompression: 2 65 | compressionQuality: 50 66 | crunchedCompression: 0 67 | allowsAlphaSplitting: 0 68 | overridden: 0 69 | - buildTarget: WebGL 70 | maxTextureSize: 8192 71 | textureFormat: -1 72 | textureCompression: 2 73 | compressionQuality: 50 74 | crunchedCompression: 0 75 | allowsAlphaSplitting: 0 76 | overridden: 0 77 | spriteSheet: 78 | serializedVersion: 2 79 | sprites: [] 80 | outline: [] 81 | spritePackingTag: 82 | userData: 83 | assetBundleName: 84 | assetBundleVariant: 85 | -------------------------------------------------------------------------------- /Assets/Material.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1ec4ad97d468a074ba8a562aaf1f74b1 3 | folderAsset: yes 4 | timeCreated: 1485885722 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Material/SphereMat.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/Assets/Material/SphereMat.mat -------------------------------------------------------------------------------- /Assets/Material/SphereMat.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 115516e7a737b2347b95fb3b28d36496 3 | timeCreated: 1485021259 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 25324f886041d2642bafb71ca8b9a0d6 3 | folderAsset: yes 4 | timeCreated: 1485885683 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Scripts/CoordHelper.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Quill18 Productions. All rights reserved. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | using System.Collections; 8 | using System.Collections.Generic; 9 | using UnityEngine; 10 | 11 | public static class CoordHelper 12 | { 13 | 14 | public static SphericalCoord TransformToSphericalCoord( Vector3 targetPos, Vector3 parentPos ) 15 | { 16 | Vector3 dirToTarget = targetPos - parentPos; 17 | 18 | if( dirToTarget.sqrMagnitude == 0) 19 | { 20 | // Parent and target is the same, so force a 0/0 coord 21 | return new SphericalCoord(0, 0); 22 | } 23 | 24 | Quaternion quatToTarget = Quaternion.LookRotation( dirToTarget ); 25 | 26 | SphericalCoord coord = new SphericalCoord(); 27 | 28 | float lat = quatToTarget.eulerAngles.x; 29 | 30 | float lon = 360-quatToTarget.eulerAngles.y; 31 | 32 | coord.Latitude = lat; 33 | coord.Longitude = lon; 34 | 35 | return coord; 36 | } 37 | 38 | public static Quaternion SphericalToRotation( SphericalCoord sphereCoord ) 39 | { 40 | return Quaternion.Euler( -sphereCoord.Latitude, sphereCoord.Longitude, 0 ); 41 | } 42 | 43 | public static SphericalCoord RotationToSpherical( Quaternion rotation ) 44 | { 45 | return new SphericalCoord( rotation.eulerAngles.x, rotation.eulerAngles.y ); 46 | } 47 | 48 | public static Vector2 RotationToUV( Quaternion rotation ) 49 | { 50 | return SphericalToUV( RotationToSpherical(rotation) ); 51 | } 52 | 53 | public static Vector2 SphericalToUV( SphericalCoord sphereCoord ) 54 | { 55 | Vector2 uv = new Vector2( 56 | (sphereCoord.Longitude / 360f), 57 | (sphereCoord.Latitude + 90) / 180f 58 | ); 59 | 60 | return uv; 61 | } 62 | 63 | public static SphericalCoord UVToSpherical( Vector2 uv ) 64 | { 65 | return new SphericalCoord( -(uv.y - 0.5f) * 180f, 360f * uv.x ); 66 | } 67 | 68 | public static Quaternion UVToRotation( Vector2 uv ) 69 | { 70 | return Quaternion.Euler( -(uv.y - 0.5f) * 180f, 360f * uv.x , 0 ); 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /Assets/Scripts/CoordHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4f11f1721d6f0694698086812f77a811 3 | timeCreated: 1485543960 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Scripts/CoordinateManager.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class CoordinateManager : MonoBehaviour { 6 | 7 | // Use this for initialization 8 | void Start () { 9 | 10 | } 11 | 12 | // Update is called once per frame 13 | void Update () { 14 | 15 | } 16 | 17 | // TODO: Implement a system whereby "ThePlanetoid" gets set to 18 | // whatever planet/moon/etc... you are actually closest to. 19 | public GameObject ThePlanetoid; 20 | public GameObject TheTerrain; 21 | public Transform TheShip; 22 | 23 | bool isTerrain = false; 24 | 25 | public void SwitchToTerrain() 26 | { 27 | if(isTerrain) 28 | { 29 | Debug.LogError("Already in terrain mode."); 30 | return; 31 | } 32 | 33 | // We are in space mode, but have to switch to terrain mode. 34 | isTerrain = true; 35 | 36 | // What are the coordinates of the ship relative to the planetoid 37 | SphericalCoord sphereCoord = CoordHelper.TransformToSphericalCoord( TheShip.position, ThePlanetoid.transform.position ); 38 | string s = string.Format("Landing ship at coordinates: {0}\n", sphereCoord.ToString()); 39 | Debug.Log(s); 40 | 41 | ThePlanetoid.SetActive(false); 42 | TheTerrain.SetActive(true); 43 | 44 | // NOTE: This will freeze the game for a few seconds depending on processor speed. 45 | // Consider solutions like CoRoutines or Threading. 46 | TheTerrain.GetComponent().BuildFromLandingSpot( sphereCoord ); 47 | 48 | // Now that the terrain exists, move the ship to be in the same reference system. 49 | // Rotate the ship -90 around the X axis 50 | TheShip.transform.RotateAround( Vector3.zero, Vector3.right, -90 ); 51 | 52 | Vector3 pos = TheShip.transform.position; 53 | float planetRadius = ThePlanetoid.transform.localScale.x / 2f; // Pick any one axis of the scale 54 | 55 | // Subtract the radius of the planetoid 56 | pos = pos.normalized * (pos.magnitude - planetRadius); 57 | 58 | // In space, 1 unit = 1km. On ground, 1 unit = 1m. So mult scales/distance by 1000. 59 | TheShip.transform.position = pos * 1000f; 60 | Vector3 scale = TheShip.transform.localScale * 1000f; 61 | TheShip.transform.localScale = scale; 62 | 63 | } 64 | 65 | public void SwitchToSpace() 66 | { 67 | if(isTerrain == false) 68 | { 69 | Debug.LogError("Already in space mode."); 70 | return; 71 | } 72 | 73 | // We are in terrain mode, but have to switch to space mode. 74 | isTerrain = false; 75 | 76 | 77 | // What are the coordinates of the ship relative to the planetoid 78 | SphericalCoord sphereCoord = TheTerrain.GetComponent().WorldToSpherical( TheShip.transform.position ); 79 | string s = string.Format("Taking off from coordinates: {0}\n", sphereCoord.ToString()); 80 | Debug.Log(s); 81 | 82 | TheTerrain.GetComponent().DestroyChunks(); 83 | 84 | ThePlanetoid.SetActive(true); 85 | TheTerrain.SetActive(false); 86 | 87 | 88 | // Now that the terrain exists, move the ship to be in the same reference system. 89 | // Rotate the ship -90 around the X axis 90 | TheShip.transform.RotateAround( Vector3.zero, Vector3.right, 90 ); 91 | 92 | Vector3 pos = TheShip.transform.position; 93 | float planetRadius = ThePlanetoid.transform.localScale.x / 2f; // Pick any one axis of the scale 94 | 95 | // In space, 1 unit = 1km. On ground, 1 unit = 1m. So DIVIDE scales/distance by 1000. 96 | pos /= 1000f; 97 | // Re-add the radius of the planetoid 98 | pos = pos.normalized * (pos.magnitude + planetRadius); 99 | TheShip.transform.position = pos; 100 | 101 | Vector3 scale = TheShip.transform.localScale / 1000f; 102 | TheShip.transform.localScale = scale; 103 | 104 | 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /Assets/Scripts/CoordinateManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2d14d9f42d2c2674e87fcc268db1baaf 3 | timeCreated: 1492098904 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Scripts/DynamicTerrainChunk.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Quill18 Productions. All rights reserved. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | using System.Collections; 8 | using System.Collections.Generic; 9 | using UnityEngine; 10 | 11 | public class DynamicTerrainChunk : MonoBehaviour 12 | { 13 | /// 14 | /// The image texture used to populate the height map. 15 | /// Colour data is discarded: Only greyscale matters. 16 | /// 17 | public Texture2D HeightMapTexture; 18 | 19 | /// 20 | /// Unused at this time. 21 | /// 22 | public Texture2D StructureMapTexture; 23 | 24 | /// 25 | /// The array of splat data used to paint the terrain 26 | /// 27 | public SplatData[] Splats; 28 | 29 | public StructureColor[] StructureColors; 30 | 31 | /// 32 | /// We're going to dampen the heightmap by this amount. Larger values means a flatter/smoother map. 33 | /// 34 | float heightMapTextureScaling = 2f; 35 | 36 | // The rotation that represents the point in the center of this terrain chunk 37 | // Reminder: You can easily convert this to a SphericalCoord (i.e. Lat/Long) 38 | public Quaternion ChunkRotation; 39 | 40 | // Degrees per chunk is used to determine the Rotation (or SphericalCoord) 41 | // of any point on our terrain. This can be used to tell the player what 42 | // his/her lat/long is, but ALSO we can be UV information from this 43 | public float DegreesPerChunk; 44 | 45 | public float WorldUnitsPerChunk; 46 | 47 | Terrain terrain; 48 | TerrainData terrainData; 49 | 50 | /// 51 | /// The height of the tallest possible peak in our terrain 52 | /// 53 | public float TerrainHeight = 512; 54 | 55 | public void BuildTerrain( ) 56 | { 57 | // Create Terrain and TerrainCollider components and add them to the GameObject 58 | terrain = gameObject.AddComponent(); 59 | TerrainCollider terrainCollider = gameObject.AddComponent(); 60 | 61 | // Everything about the terrain is actually stored in a TerrainData 62 | terrainData = new TerrainData(); 63 | 64 | // Create the landscape 65 | BuildTerrainData(terrainData); 66 | 67 | // Define the "Splats" (terrain textures) 68 | BuildSplats(terrainData); 69 | 70 | // Apply the data to the terrain and collider 71 | terrain.terrainData = terrainData; 72 | terrainCollider.terrainData = terrainData; 73 | 74 | 75 | // NOTE: If you make any changes to the terrain data after 76 | // this, you should call terrain.Flush() 77 | 78 | 79 | // Now make the structures 80 | 81 | BuildStructures(); 82 | 83 | // Apply the splats based on cliffiness 84 | PaintCliffs(terrainData); 85 | 86 | 87 | } 88 | 89 | // Example helper function to help manage co-routine yields 90 | // to balance between terrain generation speed and program responsiveness. 91 | System.Diagnostics.Stopwatch coroutineSW; 92 | float coroutineLimit = 0.033f; // Never slower than 30fps while genning terrain. 93 | bool CoRoutineShouldPause() 94 | { 95 | if(coroutineSW == null) 96 | { 97 | coroutineSW = new System.Diagnostics.Stopwatch(); 98 | coroutineSW.Start(); 99 | return false; 100 | } 101 | 102 | if(coroutineSW.ElapsedMilliseconds > coroutineLimit) 103 | { 104 | coroutineSW.Reset(); 105 | coroutineSW.Start(); 106 | return true; 107 | } 108 | 109 | return false; 110 | } 111 | 112 | void BuildTerrainData(TerrainData terrainData) 113 | { 114 | // Define the size of the arrays that Unity's terrain will 115 | // use internally to represent the terrain. Bigger numbers 116 | // mean more fine details. 117 | 118 | //if(CoRoutineShouldPause()) 119 | // yield return null; 120 | 121 | // "Heightmap Resolution": "Pixel resolution of the terrain’s heightmap (should be a power of two plus one, eg, 513 = 512 + 1)." 122 | // AFAIK, this defines the size of the 2-dimensional array that holds the information about the terrain (i.e. terrainData.GetHeights()) 123 | // Larger numbers lead to finer terrain details (if populated by a suitable source image heightmap). 124 | // As for actual physical size of the terrain (in Unity world space), this is defined as: 125 | // terrainData.Size = terrainData.heightmapScale * terrainData.heightmapResolution 126 | terrainData.heightmapResolution = 128 + 1; 127 | 128 | // "Base Texture Resolution": "Resolution of the composite texture used on the terrain when viewed from a distance greater than the Basemap Distance" 129 | // AFAIK, this doesn't affect the terrain mesh -- only how the terrain texture (i.e. Splats) are rendered 130 | terrainData.baseMapResolution = 512 + 1; 131 | 132 | // "Detail Resolution" and "Detail Resolution Per Patch" 133 | // (used for Details -- i.e. grass/flowers/etc...) 134 | terrainData.SetDetailResolution( 1024, 32 ); 135 | 136 | // Set the Unity worldspace size of the terrain AFTER you set the resolution. 137 | // This effectively just sets terrainData.heightmapScale for you, depending on the value of terrainData.heightmapResolution 138 | terrainData.size = new Vector3( WorldUnitsPerChunk, TerrainHeight , WorldUnitsPerChunk ); 139 | 140 | // Get the 2-dimensional array of floats that defines the actual height data for the terrain. 141 | // Each float has a value from 0..1, where a value of 1 means the maximum height of the terrain as defined by terrainData.size.y 142 | // 143 | // AFAIK, terrainData.heightmapWidth and terrainData.heightmapHeight will always be equal to terrainData.heightmapResolution 144 | // 145 | float[,] heights = terrainData.GetHeights(0, 0, terrainData.heightmapWidth, terrainData.heightmapHeight); 146 | 147 | float halfDegreesPerChunk = DegreesPerChunk / 2f; 148 | 149 | // Caching these dimensions and... 150 | int w = terrainData.heightmapWidth; 151 | int h = terrainData.heightmapHeight; 152 | 153 | // Replacing loop divisions with mults cuts this function by about 10% 154 | // -- Shout out to Karl Goodloe 155 | float widthAdjust = 1f / (w-1f); 156 | float heightAdjust = 1f / (h-1f); 157 | 158 | // Loop through each point in the terrainData heightmap. 159 | for (int x = 0; x < w; x++) 160 | { 161 | for (int y = 0; y < h; y++) 162 | { 163 | // Normalize x and y to a value from 0..1 164 | // NOTE: We are INVERTING the x and y because internally Unity does this 165 | float xPos = (float)x * widthAdjust; 166 | float yPos = (float)y * heightAdjust; 167 | 168 | // This converts our chunk position to a latitude/longitude, 169 | // which we can then use to get UV coordinates from the heightmap 170 | // FIXME: I think this is doing a pincushion effect 171 | // Someone smarter than me will have to figure this out. 172 | Quaternion pointRotation = ChunkRotation * 173 | Quaternion.Euler( 174 | xPos * DegreesPerChunk - halfDegreesPerChunk, 175 | yPos * DegreesPerChunk - halfDegreesPerChunk, 176 | 0 177 | ); 178 | 179 | 180 | Vector2 uv = CoordHelper.RotationToUV( pointRotation ); 181 | 182 | // Get the pixel from the heightmap image texture at the appropriate position 183 | Color pix = HeightMapTexture.GetPixelBilinear( uv.x, uv.y ); 184 | 185 | // Update the heights array 186 | heights[x,y] = pix.grayscale / heightMapTextureScaling; 187 | } 188 | } 189 | 190 | // Update the terrain data based on our changed heights array 191 | terrainData.SetHeights(0, 0, heights); 192 | 193 | } 194 | 195 | public SphericalCoord WorldToSpherical( Vector3 worldPosition ) 196 | { 197 | // WARNING: This will be weird/wrong if you pass coordinates 198 | // outside the bounds of this terrain 199 | return LocalToSpherical(worldPosition - this.transform.position); 200 | } 201 | 202 | 203 | public SphericalCoord LocalToSpherical( Vector3 localPosition ) 204 | { 205 | // We need to know our 0..1 206 | float xPos = localPosition.x / terrainData.size.x; 207 | float yPos = localPosition.z / terrainData.size.z; // NOTE: Z! 208 | 209 | Quaternion pointRotation = ChunkRotation * 210 | Quaternion.Euler( 211 | xPos * DegreesPerChunk - (DegreesPerChunk/2f), 212 | yPos * DegreesPerChunk - (DegreesPerChunk/2f), 213 | 0 214 | ); 215 | 216 | return CoordHelper.RotationToSpherical(pointRotation); 217 | } 218 | 219 | void BuildSplats(TerrainData terrainData) 220 | { 221 | SplatPrototype[] splatPrototypes = new SplatPrototype[ Splats.Length ]; 222 | 223 | for (int i = 0; i < Splats.Length; i++) 224 | { 225 | splatPrototypes[i] = new SplatPrototype(); 226 | splatPrototypes[i].texture = Splats[i].Texture; 227 | splatPrototypes[i].tileSize = new Vector2(Splats[i].Size, Splats[i].Size); 228 | } 229 | 230 | terrainData.splatPrototypes = splatPrototypes; 231 | } 232 | 233 | void PaintCliffs(TerrainData terrainData) 234 | { 235 | // splatMaps is a three dimensional array in the form of: 236 | // splatMaps[ x, y, splatTextureID ] = (opacity from 0..1) 237 | float[,,] splatMaps = terrainData.GetAlphamaps(0, 0, terrainData.alphamapWidth, terrainData.alphamapHeight); 238 | 239 | // Caching these dimensions and... 240 | int w = terrainData.alphamapWidth; 241 | int h = terrainData.alphamapHeight; 242 | 243 | // Replacing loop divisions with mults cuts this function by about 10% 244 | // -- Shout out to Karl Goodloe 245 | float widthAdjust = 1f / (w-1f); 246 | float heightAdjust = 1f / (h-1f); 247 | float angleAdjust = 1f / 90f; 248 | 249 | // Loop through each pixel in the alpha maps 250 | for (int aX = 0; aX < w; aX++) 251 | { 252 | for (int aY = 0; aY < h; aY++) 253 | { 254 | // Normal to 0..1 255 | float x = (float)aX * widthAdjust; 256 | float y = (float)aY * heightAdjust; 257 | 258 | // Find the steepness of the terrain at this point 259 | float angle = terrainData.GetSteepness( y, x ); // NOTE: x and y are flipped 260 | 261 | // 0 is "flat ground", 1 is "cliff ground" 262 | float cliffiness = angle * angleAdjust; 263 | 264 | splatMaps[aX, aY, 0] = 1 - cliffiness; // Ground texture is inverse of cliffiness 265 | splatMaps[aX, aY, 1] = cliffiness; // Cliff texture is cliffiness 266 | } 267 | } 268 | 269 | // Update the terrain texture maps 270 | terrainData.SetAlphamaps(0, 0, splatMaps); 271 | } 272 | 273 | public void SetNeighbors( DynamicTerrainChunk left, DynamicTerrainChunk top, DynamicTerrainChunk right, DynamicTerrainChunk bottom ) 274 | { 275 | // TODO: Fix the seams between chunks 276 | Terrain t = GetComponent(); 277 | 278 | Terrain leftTerrain = left == null ? null : left.terrain; 279 | Terrain topTerrain = top == null ? null : top.terrain; 280 | Terrain rightTerrain = right == null ? null : right.terrain; 281 | Terrain bottomTerrain = bottom == null ? null : bottom.terrain; 282 | 283 | // Hint to the terrain engine about how to improve LOD calculations 284 | t.SetNeighbors( leftTerrain, topTerrain, rightTerrain, bottomTerrain ); 285 | t.Flush(); 286 | } 287 | 288 | void BuildStructures() 289 | { 290 | // Loop through each pixel of the structures map 291 | // if we find pixels that aren't transparent (or whatever our criteria is) 292 | // then we will spawn a structure based on the color code. 293 | 294 | // IDEALLY -- We don't want to have to parse the building map for every chunk. 295 | // It would be nice instead if we did this once and just cached where all the 296 | // buildings should be. -- This is very easy. 297 | 298 | Color32[] pixels = StructureMapTexture.GetPixels32(); 299 | 300 | Color32 c32 = new Color32(255, 0, 0, 255); 301 | 302 | // Holy crap, it turns out that these .width and .height calls are SUUUUUUUUUPER expensive. 303 | // I cut my ENTIRE terrain-generation time in half by caching these. 304 | // -- quill18 305 | int w = StructureMapTexture.width; 306 | int h = StructureMapTexture.height; 307 | 308 | for (int x = 0; x < w; x++) 309 | { 310 | for (int y = 0; y < h; y++) 311 | { 312 | Color32 p = pixels[x + y * w]; 313 | if( p.a < 128 ) 314 | { 315 | // transparent pixel, ignore. 316 | continue; 317 | } 318 | 319 | //Debug.Log("Not transparent!: " + p.ToString()); 320 | 321 | foreach(StructureColor sc in StructureColors) 322 | { 323 | if(sc.Color.r == p.r && sc.Color.g == p.g && sc.Color.b == p.b) 324 | { 325 | //Debug.Log("Color match!"); 326 | // What is the position of the building? 327 | SphericalCoord buildingLatLon = CoordHelper.UVToSpherical( new Vector2((float)x/w, (float)(y)/h) ); 328 | 329 | 330 | Vector3 localPosition = SphericalToLocalPosition( buildingLatLon ); 331 | 332 | if(localPosition.x < 0 || localPosition.x > WorldUnitsPerChunk || localPosition.z < 0 || localPosition.z > WorldUnitsPerChunk) 333 | { 334 | // Not in our chunk! 335 | continue; 336 | 337 | } 338 | 339 | 340 | // Spawn the correct building. 341 | Vector3 globalPosition = localPosition + this.transform.position; 342 | 343 | // Fix the building's height 344 | float heightAtGlobalPosition = terrain.SampleHeight( globalPosition ); 345 | globalPosition.y = heightAtGlobalPosition; 346 | 347 | // Our rotation is going to be a factor of our longitude and the Z rotation of this chunk 348 | // FIXME: Test me -- especially near the poles and with different chunk rotations 349 | Quaternion rot = Quaternion.Euler( 0, ChunkRotation.eulerAngles.z + Mathf.Sin(Mathf.Deg2Rad * buildingLatLon.Latitude)*buildingLatLon.Longitude, 0 ); 350 | 351 | GameObject theStructure = (GameObject)Instantiate(sc.StructurePrefab, globalPosition, rot, this.transform); 352 | 353 | SmoothTerrainUnderStructure( theStructure ); 354 | 355 | // Stop looping through structure colors 356 | break; // foreach 357 | } 358 | } 359 | } 360 | 361 | } 362 | } 363 | 364 | /// 365 | /// Converts a SphericalCoord (Lat/Lon) into a Vector3 that represents 366 | /// the position of the Lat/Lon on this terrain chunk 367 | /// 368 | /// Sc. 369 | Vector3 SphericalToLocalPosition( SphericalCoord sc ) 370 | { 371 | //Debug.Log( gameObject.name + " -- " + sc.ToString()); 372 | 373 | Quaternion buildingQat = CoordHelper.SphericalToRotation(sc); 374 | 375 | float xAngleDiff = buildingQat.eulerAngles.x - ChunkRotation.eulerAngles.x; 376 | 377 | while(xAngleDiff < -360) 378 | xAngleDiff += 360; 379 | while(xAngleDiff > 360) 380 | xAngleDiff -= 360; 381 | 382 | float yAngleDiff = buildingQat.eulerAngles.y - ChunkRotation.eulerAngles.y; 383 | 384 | //Debug.Log( gameObject.name + " -- xAngleDiff: " + xAngleDiff); 385 | //Debug.Log( gameObject.name + " -- yAngleDiff: " + yAngleDiff); 386 | 387 | Vector3 distFromCenter = new Vector3( 388 | ((yAngleDiff / DegreesPerChunk)) * WorldUnitsPerChunk, 389 | 0, // HEIGHT of building 390 | ((xAngleDiff / DegreesPerChunk)) * WorldUnitsPerChunk 391 | ); 392 | 393 | // Rotate the vector based on chunk's rotation 394 | // FIXME: I AM WRONG HERE. MAKE MATH MORE BETTER PLEASE 395 | // Do we need to incorporate longitude? I think we do. 396 | // I think we need to check the different in longitude between the center of the 397 | // terrain chunk and where the building is. 398 | distFromCenter = Quaternion.Euler(0, -ChunkRotation.eulerAngles.z, 0) * distFromCenter; 399 | 400 | // Now move the vector's origin to the bottom-left corner and return that 401 | 402 | return distFromCenter + new Vector3( WorldUnitsPerChunk/2, 0, WorldUnitsPerChunk/2 ); 403 | } 404 | 405 | void SmoothTerrainUnderStructure( GameObject structureGO ) 406 | { 407 | 408 | // We need to figure out the bounds for this structure. 409 | 410 | 411 | Collider[] cols = structureGO.GetComponentsInChildren(); 412 | if(cols.Length == 0) 413 | { 414 | Debug.LogError("SmoothTerrainUnderStructure - Structure has no colliders?"); 415 | return; 416 | } 417 | 418 | Bounds structureBounds = new Bounds( cols[0].bounds.center, cols[0].bounds.size ); 419 | 420 | foreach(Collider col in cols) 421 | { 422 | structureBounds.Encapsulate(col.bounds); 423 | } 424 | 425 | // structureBounds describes the entire volume occupied by this structure (or at least the colliders anyway) 426 | 427 | // Now we need to figure out which points of our heightmap array are under these bounds. 428 | 429 | Vector3 terrainBottomLeftCorner = this.transform.position; 430 | 431 | Vector3 structureBottomLeftCorner = structureBounds.min; 432 | 433 | Vector3 structurePositionOffset = structureBottomLeftCorner - terrainBottomLeftCorner; 434 | 435 | // Our terrain is 1024 world units wide -- but how many array units wide is it? 436 | // It has a resolution/vertex count of 129 -- but that means it has a 128 edges/squares/whatever 437 | // So there would be 8 world units per array index 438 | // Imagine that our structure is at relative position 512, then 512 / 8 = array position 64 439 | float worldUnitsPerArrayIndexX = terrainData.size.x / (terrainData.heightmapWidth-1); 440 | float worldUnitsPerArrayIndexY = terrainData.size.z / (terrainData.heightmapHeight-1); 441 | 442 | int minX = Mathf.FloorToInt( structurePositionOffset.x / worldUnitsPerArrayIndexX ); 443 | int maxX = Mathf.CeilToInt ( (structurePositionOffset.x + structureBounds.size.x) / worldUnitsPerArrayIndexX ) + 1; 444 | 445 | // World space Z is array Y 446 | int minY = Mathf.FloorToInt( structurePositionOffset.z / worldUnitsPerArrayIndexY ); 447 | int maxY = Mathf.CeilToInt ( (structurePositionOffset.z + structureBounds.size.z) / worldUnitsPerArrayIndexY ) + 1; 448 | 449 | float[,] heights = terrainData.GetHeights(0, 0, terrainData.heightmapWidth, terrainData.heightmapHeight); 450 | 451 | // Express our height as a value from 0..1 452 | float correctHeight = (structureGO.transform.position.y - this.transform.position.y) / terrainData.size.y; 453 | 454 | for (int x = minX; x < maxX; x++) 455 | { 456 | for (int y = minY; y < maxY; y++) 457 | { 458 | // TODO: Consider doing a raycast here to see if this spot is ACTUALLY under the building. 459 | // Irregular (or highly "diagonal") buildings will currently result in an apparent mis-match 460 | // between the terrain and the building shape. 461 | 462 | // Invert x/y 463 | heights[y,x] = correctHeight; 464 | } 465 | } 466 | 467 | terrainData.SetHeights(0, 0, heights); 468 | 469 | } 470 | } 471 | -------------------------------------------------------------------------------- /Assets/Scripts/DynamicTerrainChunk.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ba2b502313d4e494fa14b4770909745a 3 | timeCreated: 1485019201 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Scripts/DynamicTerrainMaster.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Quill18 Productions. All rights reserved. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | using System.Collections; 8 | using System.Collections.Generic; 9 | using UnityEngine; 10 | 11 | /// 12 | /// The structure definining the textures used to paint the terrain 13 | /// 14 | [System.Serializable] 15 | public class SplatData 16 | { 17 | public Texture2D Texture; 18 | public float Size = 15; 19 | } 20 | 21 | [System.Serializable] 22 | public class StructureColor 23 | { 24 | public Color32 Color; 25 | public GameObject StructurePrefab; 26 | } 27 | 28 | 29 | 30 | /// 31 | /// Dynamic terrain master is responsible for starting from a Landing Point 32 | /// and spawning the 9-sliced DynamicTerrainChunk objects, as well as 33 | /// despawning/spawning new chunks as the player/camera moves around. 34 | /// 35 | public class DynamicTerrainMaster : MonoBehaviour 36 | { 37 | 38 | bool rotTest = false; 39 | void Start () 40 | { 41 | //BuildFromLandingSpot( new SphericalCoord( rotTest ? -4 : 0, 0 ) ); 42 | } 43 | 44 | void Update() 45 | { 46 | if(Input.GetKeyDown(KeyCode.Space)) 47 | { 48 | TESTING_SlideChunkArray(); 49 | } 50 | } 51 | 52 | /// 53 | /// The image texture used to populate the height map. 54 | /// Colour data is discarded: Only greyscale matters. 55 | /// 56 | public Texture2D HeightMapTexture; 57 | 58 | /// 59 | /// Unused at this time. 60 | /// 61 | public Texture2D StructureMapTexture; 62 | 63 | /// 64 | /// The array of splat data used to paint the terrain 65 | /// 66 | public SplatData[] Splats; 67 | 68 | public StructureColor[] StructureColors; 69 | 70 | float DegreesPerChunk = 5f; 71 | float WorldUnitsPerChunk = 1024; 72 | 73 | int numRows = 3; 74 | int numCols = 3; 75 | 76 | DynamicTerrainChunk[,] terrainChunks; 77 | 78 | public void BuildFromLandingSpot( SphericalCoord landingSpot ) 79 | { 80 | System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); 81 | sw.Start(); 82 | 83 | terrainChunks = new DynamicTerrainChunk[numCols,numRows]; 84 | 85 | // Create the center chunk. 86 | 87 | Quaternion rotation = CoordHelper.SphericalToRotation(landingSpot); 88 | 89 | if(rotTest) 90 | rotation *= Quaternion.Euler( 0, 0, 45 ); 91 | 92 | Vector3 position = new Vector3( 93 | (-WorldUnitsPerChunk/2f), 94 | 0, 95 | (-WorldUnitsPerChunk/2f) 96 | ); 97 | 98 | // FIXME: Hardcoded? 99 | terrainChunks[1, 1] = BuildChunk( rotation, position ); 100 | 101 | BuildChunkArray(); 102 | 103 | //RebuildChunks(); 104 | sw.Stop(); 105 | Debug.Log("Terrain generation time: " + (sw.ElapsedMilliseconds/1000f)); 106 | } 107 | 108 | void BuildChunkArray() 109 | { 110 | if( terrainChunks[1, 1] == null ) 111 | { 112 | Debug.LogError("No middle chunk!"); 113 | return; 114 | } 115 | 116 | for (int x = 0; x < numCols; x++) 117 | { 118 | for (int y = 0; y < numRows; y++) 119 | { 120 | if(terrainChunks[x,y] == null) 121 | { 122 | float xDir = x-1; 123 | float yDir = y-1; 124 | // Build the missing chunk 125 | DynamicTerrainChunk root = terrainChunks[1,1]; 126 | 127 | Quaternion rotation = root.ChunkRotation; 128 | rotation *= Quaternion.Euler( 129 | DegreesPerChunk * yDir, 130 | DegreesPerChunk * xDir, 131 | 0 132 | ); 133 | 134 | Vector3 position = root.transform.position; 135 | position += new Vector3( 136 | WorldUnitsPerChunk * xDir, 137 | 0, 138 | WorldUnitsPerChunk * yDir 139 | ); 140 | 141 | terrainChunks[x,y] = BuildChunk( rotation, position ); 142 | } 143 | } 144 | } 145 | } 146 | 147 | void TESTING_SlideChunkArray() 148 | { 149 | // Move south by one row of chunks 150 | 151 | for (int x = 0; x < numCols; x++) 152 | { 153 | // Top row, gets set to the values of the middle 154 | Destroy( terrainChunks[x, 2].gameObject ); 155 | terrainChunks[x, 2] = terrainChunks[x, 1]; 156 | 157 | // The middle gets set to the values of the bottom 158 | terrainChunks[x, 1] = terrainChunks[x, 0]; 159 | 160 | // The bottom gets nulled out 161 | terrainChunks[x, 0] = null; 162 | 163 | } 164 | // Then we call BuildChunkArray() -- which will create a new bottom relative to the new middle 165 | BuildChunkArray(); 166 | } 167 | 168 | 169 | void RebuildChunks() 170 | { 171 | // This function (at first) will tell each chunk 172 | // who its neighbours are. 173 | 174 | // Loop through all of our existing chunks. 175 | for (int x = 0; x < numCols; x++) 176 | { 177 | for (int y = 0; y < numRows; y++) 178 | { 179 | DynamicTerrainChunk left = (x > 0) ? terrainChunks[x-1, y ] : null; 180 | DynamicTerrainChunk bottom = (y > 0) ? terrainChunks[x , y-1] : null; 181 | DynamicTerrainChunk right = (x < numCols-1) ? terrainChunks[x+1, y ] : null; 182 | DynamicTerrainChunk top = (y < numRows-1) ? terrainChunks[x , y+1] : null; 183 | 184 | terrainChunks[x,y].SetNeighbors( 185 | left, top, right, bottom 186 | ); 187 | 188 | } 189 | } 190 | } 191 | 192 | DynamicTerrainChunk BuildChunk( Quaternion rotation, Vector3 position ) 193 | { 194 | 195 | GameObject go = new GameObject(); 196 | go.transform.position = position; 197 | go.name = rotation.eulerAngles.ToString(); //position.ToString(); 198 | 199 | DynamicTerrainChunk dtc = go.AddComponent(); 200 | dtc.HeightMapTexture = this.HeightMapTexture; 201 | dtc.StructureMapTexture = this.StructureMapTexture; 202 | dtc.Splats = this.Splats; 203 | 204 | dtc.ChunkRotation = rotation; 205 | dtc.DegreesPerChunk = DegreesPerChunk; 206 | dtc.WorldUnitsPerChunk = WorldUnitsPerChunk; 207 | dtc.StructureColors = StructureColors; 208 | 209 | dtc.BuildTerrain(); 210 | 211 | return dtc; 212 | } 213 | 214 | 215 | public SphericalCoord WorldToSpherical( Vector3 worldPosition ) 216 | { 217 | // FIXME: Do a raycast to determine which terrain chunk we are under 218 | 219 | // We are just going to fake it that we're on the middle chunk. 220 | 221 | return terrainChunks[1,1].WorldToSpherical(worldPosition); 222 | } 223 | 224 | public void DestroyChunks() 225 | { 226 | // TODO: Destroy gameobjects, clear array, etc... 227 | 228 | for (int x = 0; x < 3; x++) 229 | { 230 | for (int y = 0; y < 3; y++) 231 | { 232 | Destroy(terrainChunks[x,y].gameObject); 233 | } 234 | } 235 | } 236 | 237 | } 238 | -------------------------------------------------------------------------------- /Assets/Scripts/DynamicTerrainMaster.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c7cd88a24686a194db9dc08a46267960 3 | timeCreated: 1487265956 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Scripts/SphericalCoord.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Quill18 Productions. All rights reserved. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | using System.Collections; 8 | using System.Collections.Generic; 9 | using UnityEngine; 10 | 11 | public class SphericalCoord 12 | { 13 | public SphericalCoord() 14 | { 15 | //SphericalCoord(0,0); 16 | } 17 | 18 | public SphericalCoord( float lat, float lon ) 19 | { 20 | Latitude = lat; 21 | Longitude = lon; 22 | } 23 | 24 | /// 25 | /// Gets or sets the latitude. 0 the equator. -90 is the North Pole. +90 is the South Pole 26 | /// 27 | /// The latitude. 28 | public float Latitude { 29 | get 30 | { 31 | return _Latitude; 32 | } 33 | set 34 | { 35 | // Deal with values that exceed +/- 360 36 | _Latitude = value % 360; 37 | 38 | // If we're above 180, then we are in the northern hemisphere 39 | // and we represent that by a negative value 40 | if(_Latitude > 180) 41 | { 42 | _Latitude = -(180 - (_Latitude - 180)); 43 | } 44 | 45 | } 46 | } 47 | private float _Latitude; 48 | 49 | /// 50 | /// Gets or sets the longitude. 0 is left edge, 360 is right edge 51 | /// 52 | /// The longitude. 53 | public float Longitude 54 | { 55 | get 56 | { 57 | return _Longitude; 58 | } 59 | 60 | set 61 | { 62 | _Longitude = value % 360; 63 | 64 | } 65 | } 66 | private float _Longitude; 67 | 68 | 69 | /// 70 | /// Returns a that represents the current . 71 | /// This string will be in the classic Earthican format where 0° latitude is equator 72 | /// 73 | /// A that represents the current . 74 | public override string ToString() 75 | { 76 | string latString = string.Format("0°"); 77 | 78 | if(Latitude < 0) 79 | { 80 | // North 81 | latString = string.Format("{0}° N", (-Latitude) ); 82 | } 83 | else if(Latitude > 0) 84 | { 85 | // South 86 | latString = string.Format("{0}° S", (Latitude) ); 87 | } 88 | 89 | string longString = string.Format("0°"); 90 | 91 | if(Longitude <= 0.0001f) 92 | { 93 | // Do nothing 94 | } 95 | else if(Longitude <= 180) 96 | { 97 | longString = string.Format("{0}° E", (Longitude) ); 98 | } 99 | else if(Longitude > 180) 100 | { 101 | longString = string.Format("{0}° W", (180 - (Longitude - 180)) ); 102 | } 103 | 104 | 105 | return string.Format("{0}, {1}", latString, longString); 106 | //return string.Format("{0}, {1}", Latitude, Longitude); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /Assets/Scripts/SphericalCoord.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e1edd2a19230ad04f8eb81112985dfde 3 | timeCreated: 1485544101 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Scripts/UICoordinateDisplay.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Quill18 Productions. All rights reserved. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | using System.Collections; 8 | using System.Collections.Generic; 9 | using UnityEngine; 10 | using UnityEngine.UI; 11 | 12 | [ExecuteInEditMode] 13 | public class UICoordinateDisplay : MonoBehaviour 14 | { 15 | void Start () 16 | { 17 | text = GetComponent(); 18 | } 19 | 20 | private Text text; 21 | 22 | public Transform TargetObject; 23 | 24 | // TODO: Implement a system whereby "ParentObject" gets set to 25 | // whatever planet/moon/etc... you are actually closest to. 26 | public Transform ParentObject; 27 | 28 | void Update () 29 | { 30 | string s = ""; 31 | 32 | s += string.Format("Transform: {0}\n", TargetObject.position); 33 | 34 | SphericalCoord sphereCoord = CoordHelper.TransformToSphericalCoord( TargetObject.position, ParentObject.position ); 35 | s += string.Format("Spherical Coordinates: {0}\n", sphereCoord.ToString()); 36 | 37 | Vector2 uvCoord = CoordHelper.SphericalToUV( sphereCoord ); 38 | s += string.Format("Texture UV: {0}\n", uvCoord.ToString()); 39 | 40 | text.text = s; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /Assets/Scripts/UICoordinateDisplay.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b8bd6e2f13128aa4d9ff6b11637ccbff 3 | timeCreated: 1485543683 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Structures.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ff78b59a17e8fa5449c7c827eb4afcc7 3 | folderAsset: yes 4 | timeCreated: 1489085558 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Structures/Cool Base.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/Assets/Structures/Cool Base.prefab -------------------------------------------------------------------------------- /Assets/Structures/Cool Base.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0a975c5e1a87ae6458552a2784621308 3 | timeCreated: 1489085854 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Structures/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 635b4761e32cba742ba731b91e4e233f 3 | folderAsset: yes 4 | timeCreated: 1489085565 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Structures/Materials/Asphalt.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/Assets/Structures/Materials/Asphalt.mat -------------------------------------------------------------------------------- /Assets/Structures/Materials/Asphalt.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a7d0341957bfd534c905f78f09997be0 3 | timeCreated: 1489085573 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Structures/Materials/Brick.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/Assets/Structures/Materials/Brick.mat -------------------------------------------------------------------------------- /Assets/Structures/Materials/Brick.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8a484e02f2de5704284c5cefc861dbb5 3 | timeCreated: 1489085580 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Structures/Materials/Concrete.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/Assets/Structures/Materials/Concrete.mat -------------------------------------------------------------------------------- /Assets/Structures/Materials/Concrete.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 970aca7cf430c65428380aebf872ba3e 3 | timeCreated: 1489085598 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Structures/Materials/LightBulb.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/Assets/Structures/Materials/LightBulb.mat -------------------------------------------------------------------------------- /Assets/Structures/Materials/LightBulb.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 634c6050720503047b323d54991742b7 3 | timeCreated: 1489085778 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/_COMBINED_SCENE_.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/Assets/_COMBINED_SCENE_.unity -------------------------------------------------------------------------------- /Assets/_COMBINED_SCENE_.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dbe6f56b474ae854e90135b595ee0aac 3 | timeCreated: 1485018874 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/_COORDINATE_TEST_SCENE_.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/Assets/_COORDINATE_TEST_SCENE_.unity -------------------------------------------------------------------------------- /Assets/_COORDINATE_TEST_SCENE_.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b834a69df4789b8458a72c545898c77a 3 | timeCreated: 1485542845 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/_TERRAIN_GEN_TEST_SCENE_.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/Assets/_TERRAIN_GEN_TEST_SCENE_.unity -------------------------------------------------------------------------------- /Assets/_TERRAIN_GEN_TEST_SCENE_.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a5c80b7159cc3924a9d2c6851d946845 3 | timeCreated: 1485018874 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Copyright (C) 2017 Martin "quill18" Glaude 3 | 4 | 5 | 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: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | 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. 10 | 11 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/ProjectSettings/AudioManager.asset -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/ProjectSettings/ClusterInputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/ProjectSettings/DynamicsManager.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/ProjectSettings/EditorBuildSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/ProjectSettings/EditorSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/ProjectSettings/InputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/ProjectSettings/NavMeshAreas.asset -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/ProjectSettings/NetworkManager.asset -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/ProjectSettings/Physics2DSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/ProjectSettings/ProjectSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/ProjectSettings/QualitySettings.asset -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/ProjectSettings/TagManager.asset -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/ProjectSettings/TimeManager.asset -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quill18/ProjectMightySpud/8fad05470c16906de5765d7125b12a76df2d4529/ProjectSettings/UnityConnectSettings.asset -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ProjectMightySpud 2 | 3 | Project MightySpud is going to be a partial game setup that implements the space-to-ground-to-space movement of games like Kerbal Space Program or No Man's Sky. During the course of the project, we will be implementing these features: 4 | 5 | * Generating Terrain from a heightmap image. This will be a pre-existing image (topography of the actual moon), but there is no reason that the texture could not also be procedurally generated. Techniques for this will be discussed. 6 | * Spawning structures and other terrain features on the landscape using an additional structure image map. 7 | * Converting from space coordinates to spherical coordinates to flat-local coordinates and back. 8 | * Transitioning from a space view where a planet is a textured sphere to a land view where the landscape is a terrain object. 9 | * And more! 10 | 11 | While this will be a standalone projects for simplicity and clarity, there is nothing stopping you from intergrating features that we developed in Project SpaceCube or even the Procedurally-Generated Galaxy tutorial. 12 | 13 | 14 | ## How to Get It 15 | 16 | You can download the episode-by-episode version of the project from the [RELEASES](https://github.com/quill18/ProjectMightySpud/releases) page -- or stay synced it through normal Git processes (clone/pull/fork/etc...) 17 | 18 | ## License 19 | 20 | This code is licensed under the [MIT License](LICENSE). Basically, do whatever you want with it but don't blame me if it breaks. (Note that this does NOT give you the right to re-publish my tutorial videos.) 21 | 22 | --------------------------------------------------------------------------------