Page 7 of 14

Re: A game about growing plants

Posted: Tue Dec 28, 2010 5:24 pm
by pygy
What about emulating how a real tree works?

The process is also recursive, but a bit more complex.

Roughly (I'm not a botanist, some of the details could be off):
  • The apical sprout gets out of the ground, and produces a straight stem pointing to the light and/or away from the ground.
  • On a regular pace, nodes are created on the stem. From the nodes emerge leafs (either on both sidees, or alternating.
  • The segments between the nodes continue to grow, but a a slower pace than the emerging one. They also get gradually larger.
  • At some point, new sprouts emerge from the nodes, and the leaves fall.
  • goto 1 for each new sprout
The ballance between how much a stem is dragged to the light or away from the ground should produce naturally beautiful forms.

You could also tweak the weight and elasticity of the branches, and the probability for a new stem to emerge from a leaf.

Branches should cast shadows on one another. A stem / sprout whose leafs get too little light would die.

Genes could be the number of nodes before the new sprouts come out, the node length, the stem weight and the elasticity of the nodes...

Re: A game about growing plants

Posted: Wed Dec 29, 2010 5:47 am
by Taehl
Jasoco, use 7zip to open the file, not whatever (apparently) sub-standard program you're currently using. The code dealing with branches is plant.lua lines 63-139 and gamefunctions.lua 59-85 (you may also need to look at helper.lua for a few tiny functions like varandom() and table.endReverse()).

pygy... Short answer, no. Especially on that part about the light and shadows. I have it the way it is now for a huge number of reasons, including:
- Performance
- Easy-to-comprehend (to the player) genetics instead of easy-to-program genetics. (that is, they're fun, not arcane)
- Performance
- Centering the plant mechanics around the intended gameplay mechanics (crossbreeding plants)
- Performance! Casting light and shadows? Good god, man, listen to yourself!

Re: A game about growing plants

Posted: Wed Dec 29, 2010 9:30 pm
by Jasoco
OS X with all three versions. And don't blame my ZIP program. It's the same ZIP function I have used since forever and never have any problems. I'd blame whatever program you used to ZIP it. 7Zip works fine though. I do have that program, but I never would have thought to use it to open a LOVE project.

Anyway, I figured out how to do branches myself through trial and error and remembering some of the methods I saw in the sample code that was somewhere on this forum. I don't remember if it was this thread, or a thread this one was branched off of... pun intended.

Re: A game about growing plants

Posted: Thu Dec 30, 2010 11:10 am
by Taehl
I used 7zip to compress it.

Anyway, back on topic: Flower genes and generation are implemented:
Image

Not all plants have flowers, of course. You need a fairly high flowerAmount gene before any flowers will be present. Flowers have separate hue and lightness from the stems and leaves, as well as a gene to control their size.

Re: A game about growing plants

Posted: Thu Dec 30, 2010 1:50 pm
by Robin
And the clouds?

Re: A game about growing plants

Posted: Thu Dec 30, 2010 3:24 pm
by Taehl
The clouds in that picture are messed up because that's a collage, not a screenshot.

Or do you mean, how do they work? They're pretty simple. Each puff is a transparent .png with its own (slow) velocity (there's only a little bit of variance here, you can just barely see it, but it's nice). When they move off the left side of the screen, they're put on a new random location off of the right side of the screen. Nothing fancy.

Re: A game about growing plants

Posted: Thu Dec 30, 2010 6:53 pm
by StoneCrow
are we going to get an update soon ?
:3

Re: A game about growing plants

Posted: Fri Dec 31, 2010 12:52 am
by Robin
Taehl wrote:The clouds in that picture are messed up because that's a collage, not a screenshot.

Or do you mean, how do they work? They're pretty simple. Each puff is a transparent .png with its own (slow) velocity (there's only a little bit of variance here, you can just barely see it, but it's nice). When they move off the left side of the screen, they're put on a new random location off of the right side of the screen. Nothing fancy.
So, pretty much the same as my 'clouds' library? (One of the first things I made with LÖVE. :P)

Re: A game about growing plants

Posted: Fri Dec 31, 2010 1:45 am
by Taehl
I guess so?

I suppose I'll give you guys a new version to play with once I finish adding fruit (and doing another round of tweaks). At that point, plants will have all of the genes we currently have planned.

EDIT) Okay, new version. This one has clouds, flowers, fruit, and a finished genome. It also has countless little bugfixes and tweaks (for example, skeletal plants are affected less by the wind than dense, leafy plants). It should also theoretically run faster, especially when multiple plants are growing at the same time. Download it here. Please tell me what you think of the new plant graphics!

Image

First person to show me a plant with red fruit and white flowers gets a cookie (play the game to make it instead of just hacking my code, please).

Re: A game about growing plants (beta 2 released)

Posted: Fri Dec 31, 2010 9:09 am
by Robin
:nyu:
cookie.png
cookie.png (475.66 KiB) Viewed 2724 times