Currently working on a MMORPG type game with the intention of it being large with multiple locations each with a different level of style -
Was wondering what’s the best way of developing a chunk loader?
My initial thought was having a local script within the player that detects when it hits a “chunk” block, then gets the necessary values such as: Fog, ambient, Position Destination, Chunk name etc from within it before then loading it via a module script.
Just curious as to thoughts and/or suggestions.
local script:
local Player = game.Player.LocalPlayer
Player.Character:WaitForChild(“Humanoid”).Touched:Connect(function(Obj)
if Obj.Name == “ChunkLoader” then
– Gets the values from within etc.
require(game.ReplicatedStorage:WaitForChild(“ChunkLoader”)).LoadChunk(Values, etc)
else return end
end
Module script:
local Module = {}
function Module.LoadChunk(Values, etc)
– Gets the appropriate details, changing the lighting, inserting the required chunk
&& sets the Players CFrame to the appropriate location for ‘entering’ said chunk.
end
return Module
local Player = game.Player.LocalPlayer
Player.Character:WaitForChild("Humanoid").Touched:Connect(function(Obj)
if Obj.Name == "ChunkLoader" then
-- Gets the values from within etc.
require(game.ReplicatedStorage:WaitForChild("ChunkLoader")).LoadChunk(Values, etc)
else
return
end
end
Module script:
local Module = {}
function Module.LoadChunk(Values, etc)
-- Gets the appropriate details, changing the lighting, inserting the required chunk
--& sets the Players CFrame to the appropriate location for 'entering' said chunk.
end
return Module
This sounds like a good way to do it. You’re probably going to need a loading sign though-- Seems like your maps would be so big they would take a decent amount of time to load in.
The best way to do this would probably be through an implementation of the perlin noise function, or math.noise.
There was a pretty similar post I remember helping with. The difference with this post is obvious, it was asking how to infinitely generate models:
The question you are asking is pretty much the same, just in concept of a “model” instead of a “chunk.” You could probably just store extra data in it such as fog or ambience, and update it as maybe an average of the attributes for all the current chunks loaded.