├── README.md ├── apiclient.lua ├── client.lua ├── configuration.lua ├── island.terrain.cache.json ├── islandconfiguration.lua ├── meta.xml ├── server.lua ├── terrain.cache.json └── textures ├── grass.png ├── sand.png ├── snow.png └── stone.png /README.md: -------------------------------------------------------------------------------- 1 | # Procedural world generation client 2 | This is an example resource for MTA:SA displaying procedural world generation. 3 | 4 | The generation of the .dff and .col files is done by an API. 5 | The server then caches the result for the terrain generation in `terrain.cache.json`. 6 | Deleting this file and restarting the resource will result in a new world being generated. Do note that if no settings were changed the newly generated world will be identical. 7 | 8 | `configuration.lua` contains a Lua table with configuration sent to the API. 9 | This file contains several sections of values, for specific parts of the terrain. 10 | - Root level 11 | The root level contains values specifying the size and detail of individual chunks. 12 | - Terrain 13 | This section of the configuration specifies the input variables to the noise function used to generate the height map for the terrain. 14 | - Texture 15 | The texture section contains the materials (in base 64 substrings), material scales, and the configuration for what materials to place at which height in the terrain. 16 | This also support smooth transitions between multiple materials. 17 | - Vegetation 18 | The vegetation section specifies where to place objects on the terrain. 19 | This section contains similar values to the terrain section, because this also uses a noise map to decide where to place the objects. 20 | 21 | The resource comes with a pre-configured, and pre-cached world. 22 | 23 | -------------------------------------------------------------------------------- /apiclient.lua: -------------------------------------------------------------------------------- 1 | local storageBaseUrl = "https://renderwaremodelgenerator.blob.core.windows.net/output/" 2 | -- local storageBaseUrl = "http://127.0.0.1:10000/devstoreaccount1/output/" 3 | 4 | local apiBaseUrl = "http://renderwaremodelgenerator.azurewebsites.net/api/" 5 | -- local apiBaseUrl = "http://renderwaremodelgenerator-development.azurewebsites.net/api/" 6 | -- local apiBaseUrl = "http://localhost:7071/api/" 7 | 8 | if (triggerServerEvent) then 9 | function requestDomains() 10 | requestBrowserDomains({ apiBaseUrl, storageBaseUrl }, true) 11 | end 12 | requestDomains() 13 | end 14 | 15 | function requestTerrain(options, callback, failureCallback) 16 | local json = toJSON(options) 17 | json = json:sub(2, json:len() - 1) 18 | 19 | fetchRemote(apiBaseUrl .. "generateTerrain", { 20 | postData = json, 21 | }, function(data, info) 22 | if (info.success) then 23 | local result = fromJSON("[" .. data .. "]") 24 | callback(result.id) 25 | else 26 | failureCallback(data) 27 | end 28 | end) 29 | end 30 | 31 | function requestChunk(id, x, y, callback, failureCallback) 32 | local json = toJSON({ id = id, x = x, y = y }) 33 | json = json:sub(2, json:len() - 1) 34 | 35 | fetchRemote(apiBaseUrl .. "generateChunk", { 36 | postData = json, 37 | }, function(data, info) 38 | if (info.success) then 39 | local result = fromJSON("[" .. data .. "]") 40 | callback(result.id) 41 | else 42 | failureCallback(data) 43 | end 44 | end) 45 | end 46 | 47 | function requestChunks(id, positions, callback, failureCallback) 48 | local json = toJSON({ 49 | id = id, 50 | chunks = positions 51 | }) 52 | json = json:sub(2, json:len() - 1) 53 | 54 | fetchRemote(apiBaseUrl .. "generateChunks", { 55 | postData = json, 56 | }, function(data, info) 57 | if (info.success) then 58 | local result = fromJSON("[" .. data .. "]") 59 | callback(result.ids) 60 | else 61 | failureCallback(data) 62 | end 63 | end) 64 | end 65 | 66 | function getDffIfExists(id, callback, failureCallback, retryCount) 67 | requestIfExists(storageBaseUrl .. id .. ".dff", callback, failureCallback, retryCount or 0) 68 | end 69 | 70 | function getTxdIfExists(id, callback, failureCallback, retryCount) 71 | requestIfExists(storageBaseUrl .. id .. ".txd", callback, failureCallback, retryCount or 0) 72 | end 73 | 74 | function getColIfExists(id, callback, failureCallback, retryCount) 75 | requestIfExists(storageBaseUrl .. id .. ".col", callback, failureCallback, retryCount or 0) 76 | end 77 | 78 | function getVegetationIfExists(id, callback, failureCallback, retryCount) 79 | requestIfExists(storageBaseUrl .. id .. ".vegetation.json", function(data) 80 | callback(fromJSON("[" .. data .. "]")) 81 | end, failureCallback, retryCount or 0) 82 | end 83 | 84 | function requestIfExists(url, callback, failureCallback, retryCount, retryTimer) 85 | local retryTimer = retryTimer or 1000 86 | fetchRemote(url, { 87 | method = "GET" 88 | }, function (data, info) 89 | if (info.success) then 90 | callback(data, info) 91 | else 92 | if (retryCount > 0) then 93 | setTimer(function() requestIfExists(url, callback, failureCallback, retryCount - 1, retryTimer * 2) end, retryTimer, 1) 94 | else 95 | failureCallback(data) 96 | end 97 | end 98 | end) 99 | end -------------------------------------------------------------------------------- /client.lua: -------------------------------------------------------------------------------- 1 | local modelStart = 2059 2 | local modelDistanceCache = {} 3 | 4 | function loadChunk(x, y, dff, col, txd, vegetation) 5 | if (dff and col and txd and vegetation) then 6 | print("Loading chunk at " .. x .. ", " .. y) 7 | local objectModel = modelStart 8 | modelStart = modelStart + 1 9 | 10 | local col = engineLoadCOL(col) 11 | local txd = engineLoadTXD(txd) 12 | local dff = engineLoadDFF(dff) 13 | 14 | engineReplaceCOL(col, objectModel) 15 | engineImportTXD(txd, objectModel) 16 | engineReplaceModel(dff, objectModel) 17 | 18 | engineSetModelLODDistance(objectModel, 3000) 19 | local object = createObject(objectModel, x, y, heightOffset) 20 | local lod = createObject(objectModel, x, y, heightOffset, 0, 0, 0, true) 21 | setLowLODElement(object, lod) 22 | 23 | for key, model in pairs(vegetation) do 24 | setTimer(function() 25 | engineSetModelLODDistance(model.Model, 100) 26 | local main = createObject(model.Model, x + model.Position.X, y + model.Position.Y, model.Position.Z + heightOffset, model.Rotation.X, model.Rotation.Y, model.Rotation.Z) 27 | local lod = createObject(model.Model, x + model.Position.X, y + model.Position.Y, model.Position.Z + heightOffset, model.Rotation.X, model.Rotation.Y, model.Rotation.Z, true) 28 | setLowLODElement(main, lod) 29 | 30 | local mainX, mainY, mainZ = getElementPosition(main) 31 | if (modelDistanceCache[model.Model] == nil) then 32 | modelDistanceCache[model.Model] = getElementDistanceFromCentreOfMassToBaseOfModel(main) 33 | end 34 | local offset = modelDistanceCache[model.Model] 35 | setElementPosition(main, mainX, mainY, mainZ + offset) 36 | setElementPosition(lod, mainX, mainY, mainZ + offset) 37 | end, key * 50, 1) 38 | end 39 | end 40 | end 41 | 42 | function requestChunk(id, x, y) 43 | local dff 44 | local col 45 | local txd 46 | local vegetation 47 | 48 | getDffIfExists(id, function(result) 49 | dff = result 50 | loadChunk(x, y, dff, col, txd, vegetation) 51 | end, function() 52 | outputDebugString("Failed to get chunk " .. id .. " dff") 53 | end, 16) 54 | 55 | getTxdIfExists(id, function(result) 56 | txd = result 57 | loadChunk(x, y, dff, col, txd, vegetation) 58 | end, function() 59 | outputDebugString("Failed to get chunk " .. id .. " txd") 60 | end, 16) 61 | 62 | getColIfExists(id, function(result) 63 | col = result 64 | loadChunk(x, y, dff, col, txd, vegetation) 65 | end, function() 66 | outputDebugString("Failed to get chunk " .. id .. " col") 67 | end, 16) 68 | 69 | getVegetationIfExists(id, function(result) 70 | vegetation = result 71 | loadChunk(x, y, dff, col, txd, vegetation) 72 | end, function() 73 | outputDebugString("Failed to get chunk " .. id .. " vegetation") 74 | end, 16) 75 | end 76 | addEvent("generation.loadChunk", true) 77 | addEventHandler("generation.loadChunk", getRootElement(), requestChunk) -------------------------------------------------------------------------------- /configuration.lua: -------------------------------------------------------------------------------- 1 | local function getFileBase64(filepath) 2 | if (triggerClientEvent) then 3 | local file = fileOpen(filepath) 4 | local content = fileRead(file, fileGetSize(file)) 5 | fileClose(file) 6 | 7 | local base64 = base64Encode(content) 8 | 9 | local segments = {} 10 | while (base64:len() > 65535) do 11 | segments[#segments + 1] = base64:sub(1, 65535) 12 | base64 = base64:sub(65535 + 1) 13 | end 14 | segments[#segments + 1] = base64 15 | return segments 16 | end 17 | return {} 18 | end 19 | 20 | chunkRange = 2 21 | waterHeight = -0.3; 22 | heightOffset = 150 23 | 24 | terrainConfiguration = { 25 | ChunkWidth = 400, 26 | ChunkHeight = 400, 27 | ChunkDelta = 8.0, 28 | Terrain = { 29 | Seed = 1, 30 | Octaves = 3, 31 | Lacunarity = 2.0, 32 | Gain = 0.4, 33 | Frequency = 0.001, 34 | HeightMultiplier = 100 35 | }, 36 | Texture = { 37 | Width = 1280, 38 | Height = 1280, 39 | Materials = { 40 | getFileBase64("textures/sand.png"), 41 | getFileBase64("textures/grass.png"), 42 | getFileBase64("textures/stone.png"), 43 | getFileBase64("textures/snow.png"), 44 | }, 45 | MaterialScaleFactors = { 46 | 1, 47 | 1, 48 | 1, 49 | 1 50 | }, 51 | MaterialOptions = { 52 | { 53 | min = -0.5, 54 | max = -0.275, 55 | from = 0 56 | }, 57 | { 58 | min = -0.275, 59 | max = -0.225, 60 | from = 0, 61 | to = 1 62 | }, 63 | { 64 | min = -0.225, 65 | max = -0.025, 66 | from = 1 67 | }, 68 | { 69 | min = -0.025, 70 | max = 0.025, 71 | from = 1, 72 | to = 2 73 | }, 74 | { 75 | min = 0.025, 76 | max = 0.225, 77 | from = 2 78 | }, 79 | { 80 | min = 0.225, 81 | max = 0.275, 82 | from = 2, 83 | to = 3 84 | }, 85 | { 86 | min = 0.275, 87 | max = 0.5, 88 | from = 3 89 | } 90 | } 91 | }, 92 | Vegetation = { 93 | Delta = 2, 94 | VegetationSets = { 95 | { 96 | Seed = 2, 97 | Octaves = 3, 98 | Lacunarity = 2, 99 | Gain = 0.5, 100 | Frequency = 0.03, 101 | 102 | objectRanges = { 103 | { 104 | minNoise = 0.4895, 105 | maxNoise = 0.49, 106 | minHeight = -0.225, 107 | maxHeight = -0.025, 108 | models = { 690, 693, 694, 698, 790, 791 } 109 | }, 110 | { 111 | minNoise = 0.409, 112 | maxNoise = 0.41, 113 | minHeight = -0.225, 114 | maxHeight = -0.025, 115 | models = { 705, 706, 709 } 116 | }, 117 | { 118 | minNoise = 0.309, 119 | maxNoise = 0.31, 120 | minHeight = -0.225, 121 | maxHeight = -0.025, 122 | models = { 615, 617, 764, 766, 768, 773 } 123 | }, 124 | { 125 | minNoise = 0.209, 126 | maxNoise = 0.21, 127 | minHeight = -0.225, 128 | maxHeight = -0.025, 129 | models = { 672, 700, 729, 780, 779, 782, 781 } 130 | }, 131 | { 132 | minNoise = 0.108, 133 | maxNoise = 0.11, 134 | minHeight = -0.225, 135 | maxHeight = -0.025, 136 | models = { 647, 728, 759, 760, 762, 800, 801, 802, 803, 805, 808, 809, 810, 811, 812, 813, 814, 815, 874} 137 | } 138 | } 139 | } 140 | } 141 | } 142 | } -------------------------------------------------------------------------------- /island.terrain.cache.json: -------------------------------------------------------------------------------- 1 | [ { "id": "dc7b92f2-dbf3-4d09-b1dd-7d6154ca2721", "chunks": { "-3200X-2800": "0267879a-de3d-441a-a885-591b3f088aab", "-2800X-2800": "ff4f48b6-4fe0-46b7-85b4-bfb7842b87fc", "400X400": "4ceca98a-7f4c-43e3-9f6d-96327674ea64", "-800X-1200": "bccf4099-8134-4882-83cd-cf06f2a944f6", "-1200X-400": "0b0e4612-4d70-4a07-a7d5-d0dfa8cc5bf1", "-2000X-2800": "3e997663-3e78-4272-8425-c096b9d2da62", "-2400X-2400": "9de92a4a-0a8f-431f-99fe-914ee99c16d8", "800X400": "914a9537-a7b4-455b-8fb2-aa5e23af4db2", "-6000X-2400": "9dc80ab3-e5e5-4faa-8452-5ad997205439", "-1600X-400": "b308ea4c-b964-4af8-b083-6faaf3fab6a0", "400X-800": "4378a1d4-a6f8-4453-9bf9-13ff286204c7", "-2000X-2000": "0affe4bb-6c95-4edd-90f2-cff0bbcb8fbe", "800X-800": "33d15efa-e205-4239-b3e2-179f5a522727", "-2800X-2400": "b5e37ec4-41e1-4627-bf99-01622d9e8475", "-2800X-4000": "5d44472a-0da8-475b-b6f0-99eed845348f", "-2000X-1200": "30a94982-88b7-4bfb-bfa4-ef793edb2b0e", "-4000X-3600": "5248a94d-4b5f-4a7f-ac45-c18b108aa313", "-2800X-800": "1918683a-cb96-45e3-b87d-fc7c086d86cb", "-2800X-1200": "2c9fc67c-5930-4e9f-9b48-9a77f021edc6", "-2400X-1600": "2e2160b8-c289-45e3-94d1-6a15e7670d76", "-1600X-2400": "f351e4db-a7f2-4544-8867-26569e4ddf3a", "-4800X-4400": "d09bb869-494c-4cef-beb6-836bb7af3120", "-1600X-1200": "6aff686b-ce19-42d7-98d0-4ac845e03a6d", "-4000X-3200": "863b1147-1463-4b98-a2f7-f54624af05ee", "-1600X-800": "771c307e-5b95-44d8-b33b-5f80d0932026", "-5600X-4000": "eec1a8b6-8fb6-42fc-8124-4f6893d0529b", "-4000X-4400": "d1cf10ff-f460-4c00-9421-31ccafc01461", "-3600X-2800": "3edf2e10-5c8b-42f4-adc9-13df1507380e", "-400X400": "e7a28179-3137-4cff-ba59-486b3eef794c", "0X-1200": "92dc9c0e-22e0-4402-96af-2089fd23a9bd", "-4800X-2800": "0da77be6-ff90-495d-945f-fa884d388c3d", "-4000X-2800": "0e1c8f99-751c-4eb1-b20e-93c164c11ca8", "-4000X-2000": "25b1aaba-fa39-4559-8cd7-ed98ce9aca77", "-4400X-2400": "b34687b1-5a84-4683-a752-4933dad73ff5", "-3200X-400": "c0a09bde-0c44-491a-9741-ba60f48d87f1", "-4800X-2400": "c8785004-55f1-4b62-8a68-b5f1285cd6b4", "-400X-800": "304bf22a-e9db-4d39-afde-e049810274b4", "-3600X-3200": "c39a619b-3bf0-417a-b5fb-f5c44bccd21c", "-5600X-4400": "c243e0e1-941a-4944-9014-46e04bd1f480", "-4400X-3600": "6cca3ef8-1f44-4f76-bd54-8d2ea3f46036", "-4800X-4000": "0d2499e8-b052-4f74-8500-6e7162cce8e7", "-2800X-3200": "c14bbedd-7408-438b-94a3-c7fb6d406319", "-3200X-2400": "beb8bece-03a2-405e-b4de-3c7ebce239c2", "-800X-400": "e73a3c1b-a984-4708-b6d4-fe86fefa7b01", "-2400X-400": "dbd9e24a-2499-43f8-9d4b-ad2e21c59bb6", "-5200X-4400": "2217c92d-1a11-4030-8c1b-b9d3b55f6047", "-400X-400": "7941190c-00d7-43cf-ad01-5c5ad00ccd4c", "-1200X-2000": "1de9d97f-4ca1-4f33-939a-091ac1280de3", "-4000X-1200": "db0a6016-6842-4e4e-bcb4-359130313d35", "-2000X-400": "201b6a8b-0a73-439e-b044-571598822a37", "-4000X-4000": "421c9a2e-9fef-490a-a853-963dc50635cc", "-3600X-1200": "931de763-766b-4609-a8aa-4b2dcc31072f", "-3600X-3600": "681fbff4-14e2-42d8-ba9d-8859cf8321d9", "0X400": "f018fca0-e5d6-442c-a323-59e336bcd8e8", "-1200X-1200": "5a9e62d2-6e58-442b-ab3f-40f98ad04202", "-400X0": "62ee25f4-a70c-477c-b83d-c19d57cf1b1d", "-400X800": "f67f9249-04df-466d-9d3f-76a92d6a214e", "-3200X-1600": "110a8083-1bd1-4e81-a0a2-51fa7a8638ea", "-6000X-3200": "4f088e36-7258-433b-b0a2-240ee551334d", "-1200X800": "a05fd3b4-dc90-4768-8d45-742b2b6572e4", "-1200X0": "516bc882-d820-4928-a49e-b77f7afe888b", "-2000X-1600": "6e9b0d10-d7dc-4d6b-8526-a446a545a1cd", "0X-400": "d826e523-9f98-4d09-9a13-b6f9be304e7b", "-5600X-2800": "de7954e7-071c-44e6-a235-a8394b7e38a5", "-2000X-2400": "7c295cfb-8982-4b8b-b21b-40f00e0ff341", "-2800X-2000": "2ef6a643-b016-4223-90ed-a2be6517a355", "400X800": "90917399-ca59-49d7-bb4a-054d65727776", "800X800": "936af216-5ed5-4cdd-9fd4-32082d7b640a", "-800X-1600": "975c6a00-53a1-4a75-a930-87f2904c2463", "-6000X-2800": "37433e02-b388-4ee8-b205-bc99eaec1825", "-3200X-3600": "0446eb64-37eb-4c00-a993-8cab368046ba", "-5600X-3200": "2b28f99e-2097-47b9-b2b0-b7cc7a007224", "-2000X-800": "8d2fb42c-9197-46d7-a748-84d7ac258030", "-5600X-2400": "ce97b6b3-5b9c-4f0f-b343-f31ba9e8b9e1", "-4800X-3200": "533eeb8d-3fd2-4967-950d-b589fcdabbb5", "-1600X-2000": "c11d9b1b-da86-446e-a1a8-540066af2f45", "0X-800": "6fc6b3a2-ce92-4a3b-b895-e432f3fea64e", "400X-400": "f351ac93-bf95-4f4b-be65-faaa3eef25de", "-3200X-4400": "2b172931-8d13-422c-b297-643a1620b38a", "-4800X-3600": "ea50b1dc-23c8-4228-a3f1-49b7eb53e371", "-6000X-4000": "c8431e28-a1e6-40e6-aace-8ceffcac2d0b", "-3200X-2000": "073b5bb3-cc28-4e8e-8499-6735384c940c", "-3200X-1200": "93e7184a-1543-4097-93c4-1d7dc48e4c9c", "-2400X-3200": "50890058-6876-4b6a-bc22-b2a883c326c1", "-3200X-800": "bc86f475-79b9-4214-82bf-d3155b296b76", "800X-400": "9ade245f-e45c-47c6-ae33-752755faf3f7", "-3200X-4000": "e999616e-607d-4c3f-9db3-a9313ad11b1c", "-4400X-4400": "bd4d2324-73ff-4bd9-a550-e1201aad3ff8", "-1200X-1600": "3c270264-2d64-40a4-bad2-5ffa8d55fd59", "-800X400": "5b84e6a6-99ca-4e65-9d83-5a1d1047f163", "-1600X0": "618a3b11-4723-41b0-aaab-05c19173ae4b", "400X0": "d5d5fc53-8aee-431c-83d6-6c280a63fd95", "-2000X400": "ff6880b7-f818-4b45-969e-0d2543879fdd", "-800X-800": "3b136482-2840-44b6-a548-a6d493f11c2c", "-2400X-2800": "56783887-6eae-43ee-8b18-bcaa7de26cd4", "-2400X-2000": "2fe7b0d4-8c59-4761-aa9f-4faa0399da22", "-4000X-2400": "dc6f6949-e0ab-4bd1-8bc7-7a8849ea1c0f", "-5200X-2400": "3ba2dd56-7880-4265-a6cc-e4eb96b8f5c0", "-1600X400": "434f1d4e-77e3-4230-a50c-f6b26b9d519d", "-6000X-4400": "a2b21ff0-9f02-410e-980c-b479ee5a4ef4", "-5600X-3600": "fd9790cb-8c7a-453d-adcb-5c968188bbaa", "800X0": "57103357-a8a9-4013-9293-940a76986635", "-3600X-4000": "d9994278-59ec-40b8-a303-7532c717c486", "-5200X-2800": "5cc6c8f0-3500-4448-a168-ff2033474961", "400X-1200": "432ab6fa-7164-4e51-8742-b5290814386f", "-5200X-3600": "138759ae-2b34-4a6c-8190-2f4bf49de2cb", "-2000X0": "a7bceb4a-b15c-4bc6-90e1-023b4ac7bc38", "-2400X0": "db3cab5e-4b99-4f31-aced-ad9ea78c5e65", "-2400X-1200": "f04330b9-940d-4040-bb0c-5d66879081b6", "-4400X-2800": "6e414892-0b06-446f-831f-60b6e8cade81", "-3600X-4400": "5b9ff7a5-0959-4272-b22d-373dd919045f", "-2800X-1600": "277c35b8-6328-40cf-a401-43e6fbcb2201", "-2400X-800": "cde1abd8-4377-440d-9441-90c88e41bce8", "-6000X-3600": "897b5c5a-8cbe-48d5-972f-d508a3541927", "0X800": "61f9f0ee-6a21-4fd4-8033-b18476d15160", "-400X-1600": "c25f9c3f-49bd-4127-a529-7d8042f78890", "-3200X-3200": "55f20853-a10c-4356-a75c-806fff6f4c82", "-4400X-4000": "48402e5d-5245-4b2d-8825-21d106a06d87", "-2800X-400": "9ec653d2-bc92-44da-869c-1da197bd4e24", "0X0": "0e5a0671-090f-499e-92dd-417861b7be8c", "-3600X-2000": "67fd4989-8f64-470d-9588-2e54baa410ee", "-2800X-3600": "83b8df54-b109-402c-a76b-0e934774a4d0", "-5200X-3200": "3f8d2e43-8b1b-491b-97f3-0f7406e60b05", "-2400X-4000": "958bcf15-36f6-469d-8d0f-6f452bdfb2de", "-4400X-3200": "0eddebb0-6124-4e7a-9dac-df66317aa43c", "-800X0": "45798245-1701-4f94-a15a-190e32db96f8", "-2400X-3600": "7f6132ec-5191-4202-a186-39a199930405", "-1600X800": "9a330802-c405-494a-bd5a-b1839839f909", "-400X-1200": "1edbd5f0-5e1a-4d6a-97f9-7e91a7d9e7d1", "-800X800": "95b6e556-14a7-45ec-8b1e-2eabe112e5ca", "-2800X0": "8d0c49a6-6a2c-4f2f-b61c-24044bd83e5f", "-4000X-1600": "de251ddc-145e-4c7d-b6b1-3ce14eec4f42", "-1200X400": "0828c75c-0feb-4e95-b42f-dc744699389f", "-1600X-1600": "52f8e94e-12a4-4488-8df2-a14b57d6ed3d", "-3600X-800": "ffce309a-7631-4133-8e5c-6855124a1c74", "-5200X-4000": "558cd729-943b-47fd-bd4d-fa9a60c93e1c", "-3600X-1600": "29b0781e-86db-4125-912a-abd1b74ea898", "-3600X-2400": "d2987748-2da0-4a57-a983-5e756b1ab60c", "-1200X-800": "039a36d2-de4a-4919-a3c2-985968e53fb3" } } ] -------------------------------------------------------------------------------- /islandconfiguration.lua: -------------------------------------------------------------------------------- 1 | local function getFileBase64(filepath) 2 | local file = fileOpen(filepath) 3 | local content = fileRead(file, fileGetSize(file)) 4 | fileClose(file) 5 | 6 | local base64 = base64Encode(content) 7 | 8 | local segments = {} 9 | while (base64:len() > 65535) do 10 | segments[#segments + 1] = base64:sub(1, 65535) 11 | base64 = base64:sub(65535 + 1) 12 | end 13 | segments[#segments + 1] = base64 14 | return segments 15 | end 16 | 17 | chunkRange = 2 18 | waterHeight = 0; 19 | heightOffset = 0 20 | 21 | terrainConfiguration = { 22 | ChunkWidth = 400, 23 | ChunkHeight = 400, 24 | ChunkDelta = 8.0, 25 | Terrain = { 26 | Seed = 5, 27 | Octaves = 3, 28 | Lacunarity = 3.0, 29 | Gain = 0.4, 30 | Frequency = 0.001, 31 | HeightMultiplier = 250 32 | }, 33 | Texture = { 34 | Width = 1600, 35 | Height = 1600, 36 | Materials = { 37 | getFileBase64("textures/sand.png"), 38 | getFileBase64("textures/grass.png"), 39 | getFileBase64("textures/stone.png"), 40 | getFileBase64("textures/snow.png"), 41 | }, 42 | MaterialScaleFactors = { 43 | 1, 44 | 1, 45 | 1, 46 | 1 47 | }, 48 | MaterialOptions = { 49 | { 50 | min = -0.5, 51 | max = 0.00, 52 | from = 0 53 | }, 54 | { 55 | min = 0.00, 56 | max = 0.050, 57 | from = 0, 58 | to = 1 59 | }, 60 | { 61 | min = 0.050, 62 | max = 0.5, 63 | from = 1 64 | }, 65 | } 66 | }, 67 | Vegetation = { 68 | Delta = 2, 69 | VegetationSets = { 70 | { 71 | Seed = 2, 72 | Octaves = 3, 73 | Lacunarity = 2, 74 | Gain = 0.5, 75 | Frequency = 0.03, 76 | 77 | objectRanges = { 78 | { 79 | minNoise = 0.48955, 80 | maxNoise = 0.49, 81 | minHeight = 0.08, 82 | maxHeight = 0.5, 83 | models = { 690, 693, 694, 698, 790, 791 } 84 | }, 85 | { 86 | minNoise = 0.4095, 87 | maxNoise = 0.41, 88 | minHeight = 0.08, 89 | maxHeight = 0.5, 90 | models = { 705, 706, 709 } 91 | }, 92 | { 93 | minNoise = 0.3095, 94 | maxNoise = 0.31, 95 | minHeight = 0.08, 96 | maxHeight = 0.5, 97 | models = { 615, 617, 764, 766, 768, 773 } 98 | }, 99 | { 100 | minNoise = 0.2095, 101 | maxNoise = 0.21, 102 | minHeight = 0.08, 103 | maxHeight = 0.5, 104 | models = { 672, 700, 729, 780, 779, 782, 781 } 105 | }, 106 | { 107 | minNoise = 0.1085, 108 | maxNoise = 0.11, 109 | minHeight = 0.08, 110 | maxHeight = 0.5, 111 | models = { 647, 728, 759, 760, 762, 800, 801, 802, 803, 805, 808, 809, 810, 811, 812, 813, 814, 815, 874} 112 | } 113 | } 114 | } 115 | } 116 | } 117 | } -------------------------------------------------------------------------------- /meta.xml: -------------------------------------------------------------------------------- 1 | 2 |