- Optimized, and infinite on the horizon
that is running with 300 studs of render distance and this processor:
(I won’t translate it, but you know the drill)
And bruh look at this graph, he’s begging for help, yet it’s running the sea mesh, with maximum graphics, on ~27ms. In edit mode with nothing running, it’s 15ms to 17ms (even in an empty baseplate).
As for RAM, it’s taking 1.3 GB but that’s probably because the planes that are not being animated (distance from the camera > 300 studs) have their full geometry, I couldn’t get render fidelity to automatic, so I just left it like that.
I don’t know if Roblox Studio is throwing all the work on my GPU (it’s a little bit better than my CPU), but even if that’s the case mine is with 5ms on the video, worse GPUs can take up to 20 or 30ms and FPS should be alright.
I only tested this on my PC, but I think most devices will perform reasonably, as the render distance can be lowered or increased.
- Wave height lookup function, which I used to make this toolbox boat float for showcase:
As you can see it moves and rotates, my approach to make this work was using only constraints to rotate and move the boat, this way I can make one vector value parented to the ship control its “move direction” (an offset summed to the primary part’s CFrame every X frames), and one int value control its “orientation increment y” that does the same thing as the move direction, but its multiplied and only on Y.
finalCFrame *= CFrame.Angles(0, boatModel.PrimaryPart.orientationIncrementY.Value, 0)
local moveDirection = boatModel.PrimaryPart.moveDirection.Value
local part = boatModel.PrimaryPart.desiredPosition
part.CFrame = finalCFrame + moveDirection
“desiredPosition” refers to the invisible part that the constraints (align position and align orientation) are trying to align the primary part with
As for rotating X and Z, I used this approach explained by robro786. (it’s getting old , but math doesn’t go ou of date)
Another benefit of using constraints is that physics can interact with the boat, it’s not an anchored block changing position every frame, stuff that collide with it can move it around.
- Synced between all clients
(Sorry for the quality, the game bar has a better one but doesn’t record multiple windows, I had to use OBS)
The clocks are synced with an error of ~0.1 seconds, but that doesn’t visually affect the waves.
As for the boat movement it’s also synced between all clients, even though the movement is handled locally, because the network ownership of the boat is on the client.
The constraints start acting crazy if I don’t set the network ownership of the boat to one of the clients (probably because the “desiredPosition” is handled locally, the constraints trying to follow it and while they are on the server doesn’t turn out good), but it’s completely fixed by setting the network ownership to the client.
All this was created with a local plugin I made for myself, you just open it, configure your waves, and save it, then configure all boats you want to sync with them, I’m planning to release it to the creator store but my country is not supported yet, and I don’t want to make it free on the creator store (on GitHub maybe, but not on the creator store as people who buy will have the advantage of automatic updates).
Currently it uses Gerstner waves.
I think I’ll be the first to distribute a project like this on Roblox, people act like it’s the secret crabby patty formula. If anyone wants it, it’s a matter of time until I release this somewhere
Thank you for reading.
By the way, I created this out of frustration with how Roblox hides terrain water properties from us, ****@# terrain water >: (. That’s also why I want to distribute it somewhere, to make it another version of terrain water, a better one.
Edit: forgot to mention, I got the blender node configuration of the texture in a post by @apenzijncoolenleuk1, just removed the seams from it and uploaded to Roblox, it’s not mine.