I’m developing a farming game that will utilize the same kind of things with individual servers like Islands does, expect with a valley. Is there any information out there on how this is done or how it could be coded?
Wouldn’t you simply use something like a datastore? I’m not sure about cloud API because I haven’t read about it, looked into it, or messed with it.
Is it possible to put things like instances into a datastore?
If you’re actually asking me that (I can’t tell your tone, sorry) then possibly? I haven’t toyed with it. Maybe you could make a system that goes through instance data and recreates it using the data put into the function.
I haven’t done anything like it before, so…
Yes, I was asking if that was possible. Sorry if it sounded sarcastic. I might have to rearrange my crop growing script into 5 separate ones. It’s all one right now and if you leave the game mid-growth cycle I think it’ll start back at age 1 for the crop.
I’m curious- what would each of the 5 scripts do?
Also, maybe you could save an age value for the crop (unless there’s multiple factors).
Each script would be one of the growth stages. Like once age 1 is done, it disables the script and enables the next one. This is probably really inefficient though. I’m not good when it comes to efficiency.
You should use something like task.spawn(functionName) to operate multiple functions within the same script (the end of a function would trigger another one/growth stage, maybe?)
You need to turn the data to make the instances into something that can be stored in the datastore. For the example of a placed item, you can store the type and position of the item into the datastore then use that data to recreate it.
Correct me if there is a more efficient way to do this, but if those parts contained scripts, could I just make the script, then put it in storage, then duplicate it to be put into the part that needs it?
Do you mean ‘storage’ as in DataStores?
I think I’ve found a module for you.
I’m not exactly sure if it’ll work as I just looked over it, but it could be useful!
What I mean by storing type is having some models in ServerStorage and mapping them to strings or numbers.
Then you can apply some metadata to them (position, state, etc).
For example, you might store some placed items like so:
{
{Type = "Chair", Position = {5,4,3}, Rotation = {0,0,0}, Color = {240, 100, 100}};
{Type = "Chair", Position = {4,4,3}, Rotation = {0,90,0}, Color = {240, 100, 100}};
-- etc.
}
Then have a chair model to clone and a module script for chairs to apply the metadata (position, rotation, and color).
For a voxel based game you can get even more efficient by using voxel based data and item enumeration.