Slime Rancher

Slime Rancher

View Stats:
Jon.Topps Feb 16, 2021 @ 10:48am
Questions for devs
Firstly GREAT job on the game! Tons of fun, satisfying feedback, creative use of the physics, unique twist on a classic genre. I'm an amateur in Unity, so I had some questions, if you don't mind.

1. How did you do saving for all entities? What sort of stuff should I look up for doing that in Unity? Like the idea that every slime and item in the world has a location value is nuts if you're doing that piece by piece with a manually written save system, so clearly you're doing something far more efficient, and I'd love to know what it is.

2. I believe I read you're a two-person team. How long was development for the two of you, and roughly how many hours were each of you putting in each week? (Like a regular 40hr work week as a job, or was it a few hours a day as a hobby?)

3. Any tips for wrangling the Unity UI system? I can still see some of the problems inherent with Unity's garbage UI system, but for the most part you really took advantage of it, and it turned out super well, especially considering there's a lot of depth to your UI system with menus and what not. Just wondering if you had any tips for making it work better?

4. Did you guys go to school for coding/development? If not, how did you learn? So far I've found tons of great YouTubers that teach it, but a lot of it is quite surface level, and I have difficulty when I start getting into more complicated concepts. Unity's tutorials are kinda garbage, so I'd love to get my hands on some more complicated stuff.
Last edited by Jon.Topps; Feb 16, 2021 @ 10:51am
< >
Showing 1-3 of 3 comments
mellow Feb 17, 2021 @ 1:57pm 
im a newish game dev too, but i can answer a question

1. look into json: https://docs.unity3d.com/Manual/JSONSerialization.html
it can turn everything about an object into a string, and copy all values from the string into an object again.
and i think it works with lists too, saving everything on them.

then you would just need everything you want to save to be on a list
Jon.Topps Feb 17, 2021 @ 4:29pm 
Originally posted by mellow chan:
im a newish game dev too, but i can answer a question

1. look into json: https://docs.unity3d.com/Manual/JSONSerialization.html
it can turn everything about an object into a string, and copy all values from the string into an object again.
and i think it works with lists too, saving everything on them.

then you would just need everything you want to save to be on a list
Cool thanks! So the JSON makes sense in that it takes all the variables and converts them to a string. That's pretty cool, and I will try to use that for sure, because it's more efficient. Let me just try to walk through the logical progression of how a save file script might work for a game like this.

Suppose the class being converted to the JSON as the object type and to coordinates, just to keep things simple. It makes a string out of that data. Suppose then I have a hundred objects all do that, and they all throw their strings as a save file script. The save file script takes all the strings, and links them all as one string with XXX in-between as a separator, and saves it as a txt file in the datapath folder.
Upon loading, it takes the string from the txt file, seperates it all by the XXXs, and stores it in a string array. I could then grab the length of the array, create a "for" loop of that length, and for each entry in the array, I could create a prefab gameobject that has a script in it, and the array entry throws the string[] into that script. The script will then take that string[] entry, and use the fromJSON to convert it back to a class. It will then grab the object type variable from the class, "do something with it", and create a new gameobject of that type, grab the coordinates from the class and make the gameobject have those coordinates.

Does that make sense? I think that would work. The only problem I have is the "do something with it" part. How do you convert a class.object variable into a reference of a prefab? Like even if I have a script where it holds all the prefabs, how does the class.object variable with value "cat" know that it should reference the prefabscript.cat.gameobject?

Hopefully my question makes sense, lol.
mellow Feb 17, 2021 @ 5:07pm 
Originally posted by Jon.Topps:
Originally posted by mellow chan:
im a newish game dev too, but i can answer a question

1. look into json: https://docs.unity3d.com/Manual/JSONSerialization.html
it can turn everything about an object into a string, and copy all values from the string into an object again.
and i think it works with lists too, saving everything on them.

then you would just need everything you want to save to be on a list
Cool thanks! So the JSON makes sense in that it takes all the variables and converts them to a string. That's pretty cool, and I will try to use that for sure, because it's more efficient. Let me just try to walk through the logical progression of how a save file script might work for a game like this.

Suppose the class being converted to the JSON as the object type and to coordinates, just to keep things simple. It makes a string out of that data. Suppose then I have a hundred objects all do that, and they all throw their strings as a save file script. The save file script takes all the strings, and links them all as one string with XXX in-between as a separator, and saves it as a txt file in the datapath folder.
Upon loading, it takes the string from the txt file, seperates it all by the XXXs, and stores it in a string array. I could then grab the length of the array, create a "for" loop of that length, and for each entry in the array, I could create a prefab gameobject that has a script in it, and the array entry throws the string[] into that script. The script will then take that string[] entry, and use the fromJSON to convert it back to a class. It will then grab the object type variable from the class, "do something with it", and create a new gameobject of that type, grab the coordinates from the class and make the gameobject have those coordinates.

Does that make sense? I think that would work. The only problem I have is the "do something with it" part. How do you convert a class.object variable into a reference of a prefab? Like even if I have a script where it holds all the prefabs, how does the class.object variable with value "cat" know that it should reference the prefabscript.cat.gameobject?

Hopefully my question makes sense, lol.
you could do something like that, but you could also make it simpler by just saving everything onto one object in a list or something.

i never used it before, but i think for loading you could use resource.load() to find prefabs
https://docs.unity3d.com/ScriptReference/Resources.html

and it doesnt really matter, the saving will work either way, but json files have a .json extension to them.

and things that you save need to have [Serializable] on them. i think a list isnt like that, so i think youd need to make a list class, which just has your list then mark it serializable.


[Serializable]
public class ListClass{
public List<int> list;
}

then you just use the class and i think it would work
Last edited by mellow; Feb 17, 2021 @ 5:12pm
< >
Showing 1-3 of 3 comments
Per page: 1530 50

Date Posted: Feb 16, 2021 @ 10:48am
Posts: 3