Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Oh yeah, I forgot to document the percentages I’m using in planet generation. This is almost certainly not final, but I’m starting to like the distribution of planets it creates:

Inhabited: 22.6% chance

Farmable: 28.4% change

Terraformable: 49.9% chance

Uhhh, how do plants work in this game?

Other Unity devs, I have a question for you!

I’m thinking that it would be really cool to store all of the plant data in a separate, plain text JSON file that gets read in at the start of the game. This would make it possible for players to modify their plants, and it begins to open the door for modding. This might sound crazy for a game jam, but I’d like players to be able to include additional plants with their own scripted features. I’ve had a highly superficial look at frameworks like NLua and Moonsharp for my other project, but haven’t had a chance to take ta good look at it.

Have any Unity devs reading this post tried either framework, or some other framework I don’t know about it? What is your experience with them? Where is a good place to start?

In the meantime, I have mostly written the code to read in plant data from a JSON file, and I’ve made some decisions about how stars and plants work.

Let’s come back to stars for a second. This whole system of GDA zones, when combined with different classes of stars and the number of photons (yes, those aren’t individual particles, they’re SPAAAACE UNITS!) they emit, is needlessly confusing. It’s much easier to have ONE NUMBER that determines whether a particular plant can grow there or not.

In the SimulationManager, this large class I have that handles a ton of game settings, all stars generated by the ConstellationFactory will generate between 1 and 3 photons, and they will each get a multiplier based on their class:

Class M star multiplier: 1

Class K star multiplier: 4

Class G star multiplier: 13

Class B star multiplier: 40

This means that a Class M star will produce 1 and 3 photons, Class K between 4 and 12, etc.

Additionally, if a plant get 1 to 2 times the amount of photons it needs, it will get a base yield when producing fruit, but at 3-6 times, it will produce a 50% higher yield. Anything higher than 6x, and it will burn out.

A plant will have three data fields that deal with what it needs to grow: photons_required, water_required, and fertilizer_required. You can buy water and fertilizer at the shops, but a plant will have to get at least photons_required photons from its sun before it can grow.

Here are some guess numbers for the first three plants, in the form of a JSON object in my Unity project:

{ "pdata" : [

{

"plantName": "Solar Strawberry",

"moisture_required": 1,

"soil_fertility": 1,

"photons_required": 1,

"canTravel": false,

"plantState": 0,

},

{

"plantName": "Apogee Apple",

"moisture_required": 2,

"soil_fertility": 4,

"photons_required": 1,

"canTravel": true,

"plantState": 0,

},

{

"plantName": "Waxing Watermelon",

"moisture_required": 3,

"soil_fertility": 1,

"photons_required": 4,

"canTravel": false,

"plantState": 0,

},

]}

Because Unity C# is weird abount Enums, that 0 next to plantState stands for SEED. I had a first stab at the code to read all this in from JSON, and then I noticed about 40 warnings telling me that I can’t create MonoBehaviour objects with new. (in Spongebob voice) Some hacking later (end Spongebob voice), I changed my plant class to PlantData, Star to StarData, Planet to PlanetData, etc. We can handle the instantiated Unity objects in separate classes.