How to create an open sea?

Hey, So I’m working on an open sea type game, where you sail and find islands and explore,
but I can’t seem to generate 10k/10k or even 8k/8k water map to build the islands on?

  1. Main Problem
    Every time I try and run this, it takes and hour then studio crashed When generating

  2. Why I need this
    You might think this is big, but imagine a sea where you have 4 islands, a few underwater places, and not far to sail before you are repeating yourself… exactly! that’s why I need a big place, and I do fully understand this will take time to build, which I have, this is a big project after all.

  3. Ways I could fix this

So, I have found one main way to fix this, game transferring, where when you come up to an island you get teleported to a different game supporting that island, here are comes the problems, servers will be way less fun, as they will have to be closed and less players, won’t be able to play with friends unless at the same island, and won’t have solid exploration/sailing, and just won’t be an actual open sea.

  1. Your input

I really really need your help and suggestions with this, make sure to reply with your input/thoughts, thanks!

4 Likes

Hey mate,

I love your idea, definitely sounds intriguing.
Now, if you think that would cause more lags, I think you might need to make a smaller sea[ you still can have 4 islands]

Not always 'The bigger the map is, the better the game is’

Good luck :slight_smile:

3 Likes

I understand that part, but I need the big sea as to fit the islands and support big exploration.

1 Like

are the islands using terrain as well?

my idea is to make a giant part that have the color of the sea, and where ever you go, a terrain get’s generated at the position of the player’s camera

1 Like

Yeah, multiple islands, all terrain.

question is writing voxels everytime the camera changes position not super demanding?

1 Like

well, it needs to be real sea as there is under water exploration, and their are ships, they only work on actual water, good idea tho.

as long as it’s on the client not as much as you would think

1 Like

okay great, thnx for the answer. i bet im gonna use this technique some day.

1 Like

When your sailing, you need to come up to islands that are actually built and visible to all, same every game due to map and quests.

yes, as he said you can load and unload voxels, basicly the vertual cells that can be filled with terrain. this way you only have water around the camera

I’m not too sure if you understand that I’m trying to say, so my idea is to do this in a local script

  • Clear all water
  • Create a ball of water at the position of the player’s camera
  • Clear all water above sea level

and boom you’re good to go, if posible you should try to make the ship float on water
and for swimming, you can just make water around the player’s character as well

1 Like

you could also make your own water logic,

this would all be client side.

take a part and let it follow the players x,z position
when the player is inside it (you could detect it with region3) parent a posy position or something similer to the players root part. so he keeps (floating)
you can apply effect like bloom and color correction to the lighting as well and axtivate them when tje camera is under water aka in thw region 3

Alright, what would happen to visuals? and upcoming islands ect, how would that load?

just like normal only thing that changes is that the water is now only loaded around the player

you don’t need to delete the islands, you just have to delete the water
Use this function ReplaceMaterial

the main problems that this have is waterfalls, this is going to delete any water falls you might have on your islands,

1 Like

how should the script to do this look like?

Alright listen, asking people to make assets and scripts for you is against the rules of developer forum, but I did make the script, next time please try your best to make the script youself.

Also, change the WaterSize variable to make the water bigger.
And make sure that there is a part called “WaterRef” in your workspace.

Put this script in a LocalScript in the StarterPlayerScripts

--Configuration
local WaterSize = 40;

--Services
local RunService = game:GetService("RunService");

--Assets
local Terrain = game.Workspace:WaitForChild("Terrain");
local WaterRef = game.Workspace:WaitForChild("WaterRef");

--User
local Player = game.Players.LocalPlayer;
local Camera = game.Workspace.CurrentCamera;
local Character;
local HumanoidRootPart;

--Variables
local CreateSize = Vector3.new(WaterSize, WaterSize, WaterSize);
local ClearSize = (CreateSize * 2);

--Functions
local function GetWaterRefTop()
	--Get the top position of the water ref
	return (WaterRef.Position.Y + (WaterRef.Size.Y / 2));
end

local function ClearWater(Position)
	--Create the region
	local Region = Region3.new((Position + (ClearSize * -1)), (Position + ClearSize));

	--Clear all water neaby
	Terrain:ReplaceMaterial(Region, 4, Enum.Material.Water, Enum.Material.Air);
end

local function CreateWater(Position)
	--Create the water
	Terrain:FillBlock(CFrame.new(Position), CreateSize, Enum.Material.Water);
	
	--Cut off all water above the sea level
	Terrain:FillBlock(CFrame.new(Position.X, (GetWaterRefTop() + (WaterSize / 2)), Position.Z), CreateSize, Enum.Material.Air);
end

RunService.RenderStepped:Connect(function()
	--Get needed assets and variables
	Character = Player.Character;
	if Character then
		HumanoidRootPart = Character.PrimaryPart;
	end
	local CameraPosition = Camera.CFrame.Position;
	CameraPosition = ((CameraPosition * Vector3.new(1, 0, 1)) + Vector3.new(0, GetWaterRefTop(), 0));
	
	--Clear all water near the Camera and the character
	ClearWater(CameraPosition);
	if HumanoidRootPart then
		ClearWater(HumanoidRootPart.Position);
	end
	
	--Create water near the Camera and the characer
	CreateWater(CameraPosition);
	if HumanoidRootPart then
		CreateWater(HumanoidRootPart.Position);
	end
end)
5 Likes