Note: This is my first topic (Groan of pain from all users of the DevForum), so please let me know if anything I’m going is wrong!
I’m currently working on a map update for my game. I’ve been using part-based maps so far in ServerStorage and using :SetPrimaryPartCFrame
to position them in a pre-determined location. However, I want to now start using Terrain-based maps (with parts for trees and such of course). I don’t know how to approach this. I know about the copy region and write voxels functions, but since I will have multiple maps, I don’t know how to use this. And I will need them to be deleted when they are not needed, and spawn them in in a certain location when a round starts.
The issue is simple: I don’t know how to do this. What hierarchy should I use for the maps? How do I save them all separately? How do I position them? How would I store them all in ServerStorage?
I’ve read up about the terrain functions on the Developer Hub, but I don’t know how to piece this together.
I’m not asking for a full script, just an explanation of how to put it all together and answer the questions above. Thanks for reading, and tell me if I’m doing anything wrong!
3 Likes
As a note, I am planning to have all the maps in the same game. The size will be 512 x 512 studs. If you need any other information, ask! Ideally, I would like to have everything stored in ServerStorage on a map-by-map basis.
1 Like
I would just have all the maps spread far enough away from one another so that you can’t see them. I know that its a bit of a hacky solution but It seems to be the simplest way (in my opinion) to solve your problem .
1 Like
My game has a similar system to yours where I need to periodically spawn and despawn terrain maps whenever the round ends. If you are making your terrain beforehand as part of the map, I recommend using the save/load terrain plugin:
The plugin will return a terrain object (after saving) which you can then put anywhere you like, such as the ServerStorage. The plugin also comes with a module that allows you to easily load this terrain object in game. The only downside is that you cannot position the terrain upon loading, so you will have to make sure to build the terrain around the location that players will spawn in.
11 Likes
I would recommend programming and running a cmd in studio to turn your terrain into a table (using ReadVoxels), then using WriteVoxels in game to load the terrain when you need it.
Edit:
Refer to @Swordphin123’s solution above.
1 Like
Thank you! This helped a lot. I marked your post as the solution.
1 Like