Saturday, May 11, 2013

Real-Life

This is real tomatoes growing. Notice the growth from the Top with thickening of the base.  Most plant growth occurs at the Meristem(wiki).

Plant growth is way more exciting in fast motion. Hence the 30 second day night cycles in game!

Thursday, May 9, 2013

Ultimate Goals

Plant Life should become a Sim-Tree game in which you live through the Life of a plant, growing and acquiring resources to grow. Upon reaching sexual maturity, you can produce a flower/fruit to move on to the next generation.  In-between generations, you will be able to spend earned Credits on plant upgrades such as solar efficiency, water efficiency, branch carrying capacities, and roots water gathering abilities.  Credits should also be able to purchase Plant-Add-Ons such as thorns and specialty structures like "Potatoes", bulbs, and Insect-Repelling-Lasers which will serve as Water or Sugar storage tanks, or defensive/offensive plant weaponry.

As you upgrade your plant with each successive generation, you can shape what kind of plant you become. A giant Sequoia would need massive Water Carrying capacities to pump water from the roots to leaves 100 meters up while a low lying thorny vine may survive by spreading along the ground.  

As for gameplay, each round starts as a Seedling with a certain amount of stored nutrients.  Using these nutrients you have to grow faster than your neighbors in order to capture sunlight and have room for your roots before being shaded out and left to die.  Once you have established your seedling, your goal becomes reaching adulthood. Properly growing and trimming your plant for maximum efficiency.  Late game will be supplying your flowers/fruit with their massive energy requirements in order to produce the next generation. The better your generation, the more upgrades you can buy for your offspring.  I may add an In-Game purchase of these credits for casual gamers to Fast-Track it to Domination, but the goal of the game should be incrementally making a Imaginary plant in the way you want it!

tl;dr Plant based RPG/Tokyo Jungle

Wednesday, May 8, 2013

Pulse Function Overview

The game consists of a series of Nodes composed of a Mesh Renderer, a Collider, 2 LineRenderers, and a Script specific to the cell type.

When a Node is created, it "Checks-Into" a "Game Manager" Script present in the scene.  The game manager controls the flow of time by calling my own Update() method called "Pulse()". The "Pulse" originates in the Stem at Depth 0 and gets called  in order of construction on each subsequent depth of nodes.
       

       Roots<--Stem ---> Branches
   4 - 3 - 2 - 1 - 0 - 1 - 2 - 3 - 4
           /                               \
    4 - 3                                 4 - 5 - 6

Here is an Example "Pulse" Function from a branch


public void Pulse ()                                                                                                                                                                                                 
{                                                                                                                                                                                                                               
       DeterminePublicFillLevel (); // Determines fill Percentage of nutrients before Pulse                                                                                
if (Parent)                                                                                                                                                                                                      
CellMaintinance ();      // Uses 1 ATP and/or breaks a sugar into 31 more ATP                                                                                
if (CellIsPowered) {         // If a cell has ATP                                                                                                                                      
if (myLevel < desiredLevel) {                                                                                                                                                               
RequestUpgrade ();   // Cells Manage their queued upgrading                                                                                            
}                                                                                                                                                                                                             
ExternalWork ();         // If cell has power, Perform Diffusion and Active Transport of Nutrients                                                                                
} else {                                                                                                                                                                                                                       
CallForHelp ();          // If Cell is not powered, Request supplies from neighbors and Downgrade to stay alive                                                                                
if (myLevel > desiredLevel) {                                                                                                                                                                   
RequestDowngrade ();                                                                                                                                                                
}                                                                                                                                                                                                                                                
DiffuseNutrientFront (0); // Even if the cell is Unpowered, water will still diffuse Forwards(Up)             }                                                                                                                                                                                                                                                
DeterminePublicFillLevel ();  //Determine Fill Percentages after turn for other cells to View                                                                                
UpdateVisuals ();             // Update all visual aspects of cells activities during this turn                                                                                
}                                                                                                                                                                                                                                                

A cell will attempt to "Average" its nutrients with its neighbors during DiffuseNutrientsFront/Back() while constrained by certain Maximum outgoing and incoming bandwidths determined by each node individually.


public void DiffuseNutrientBack (int index)                                                                              
{                                                                                                                                                              
if (Parent) { // Parent is the Node that created this node                                                                              
GeneralCell f = Parent; // cache the Parent node(also standardizes Front/Back code as "f")                                       
if (PublicFillLevel [index] > f.PublicFillLevel [index]) {  // Averageing is done on wighted averages as percentages of maximum capacities                                                                                                                     
float Average = (PublicFillLevel [index] + f.PublicFillLevel [index]) / 2.0f;                                       
float NewTarget = Nutrients [index] - ((float)Capacities [index] * Average); // the Delta(difference) is calculated                                                                                                                                                            
float delta = Mathf.Abs (NewTarget);                                                                              
amountsRequested [index] += delta;                                                                              
delta = Mathf.Min (Mathf.Min (delta, OutGoingBandwidths [index]),  f.IncomingBandwidths [index]);//Delta is adjusted to be no larger than the outgoing or incoming bandwidths of the sender and reciever
sendResources (index, f, delta*.8f); //80 percent of the calculated exchange is sent.(helps stabilize simulation not to always send everything)                                                                                                                     
}                                                                                                                                                            
}                                                                                                                                                            
}                                                                                                                                                            

As always a link to the Freshest Version of Simulation:
GAME

Tuesday, May 7, 2013

Current Version of Game

Instructions:  Grow your plant however you want. Currently just a TOY!
Controls: WASD moves camera, Click a LimbNode to view its stats and Upgrade/GrowLimbs from it
Speed Controls on the LEFT control flow of time. Calculations are complete in any speed!
If your branches are showing Blue or Green it means they NEED Water or Sugar respectively.  If they are Normal Brown, they are fully stocked!

TIP: Your plant should fully refill with water during the Night and Convert that water to Sugar in the leaves during the Day! It is a daily back and forth of Nutrients!

TIP:  1 Sugar = 31 E(ATP) A cell that runs out of ATP will downgrade, Cashing in Structure to maintain Energy. When it reaches level 0 again it dies.

-Changelog May10:
-Leaves now "track the Sun" by adjusting their angle to its while in it!
-Branches and roots now auto level up till lvl 40, however, their branch widths have been reduced to account for the higher average levels
-Roots Water Generation is now tied to their "depth"(how many Nodes away from the stem they are)/5
-The Day/Night cycle has been standardized to 200 Pulse Cycles meaning a root with 1 H20 generation will make 200 water in 1 day, and each living cell will consume 200/31 = 7ish Sugars per day. Standardizing the Number of Pulses per day was nessesary to properly Balance the game. Now I can work with set Totals as opposed to complicated ratios
------------------------------------------------------------------------------------------------------------
-ChangeLog May 11:
-Began Adding Tree-Wide stat tracking. Now in the top right you can see your Maximum Water production per "Pulse" as well as actual Sugar produced last "Pulse".  Now, it takes 6 water to make 1 sugar(6CO2+6H20 + Sunlight = Sugar)(Photosynthesis 101), but max production matters because at night photosynthesis shuts off and respiration takes over.  ps, 1 Sugar = 31 ATP + 1 Water
---Probably no work done for the next day due to Mothers Day---
ChangeLog May 16th:
-Changed the Camera Movement, now zooms in when you click a node, zooms out when you click off of a node. Needs tweeking further, but gives the game a nice feel.
-Fixed some bugs and Reduced code base ALOT. Removed "Downleveling" to be replaced by eventual "Wither and die" 
-Leafs now have an image... 


1: May 7th 2013

Plant-Life is a Simulation-Game being developed for Android and iOs. Its Development will be as carefully blogged as I can manage with Nightly/Weekly updates to the Web-Player as long as Mouse Input continues to function.

Once mouse-input is replaced by Touch, the free Alpha will move channels to Android's Play Store.

Plant-Life is being developed by me; A recent UW graduate with too much time on my hands! Feedback is welcome through the comments, and I am always looking for ideas for improvement! Please check out my previous (and First Ever) game GenEric Platformer for Android! It is Free, but there is a $1.50 Donation-Version that really helps me out! It has a .04% donation rate! Find it here: Play Store Listing

And now, a link to the game!

Game