Not logged inOpenClonk Forum
Up Topic Development / Scenario & Object Development / Random Thought of the Day: Prettier Placement of Plants
- - By Zapper [de] Date 2015-08-19 13:26
..or 'The Story of the Monte Carlo Cave' RFC.

Currently, we place plants by randomly sampling 10'000 points of the landscape and hoping for a good position. Aaand we do that for every plant.
I'd like to do that once initially to create some sort of meta information database about the map.

For example, we could sample points (either grid sampling or monte carlo), categorize the points (cave, surface, water, lava, bla..) and then cluster them by fitting rectangles to them.
Those rectangles could be hold in some sensible datastructure (quad-tree and a simple list for every material, or whatever might help) that allows scripts to quickly find candidate positions for some landscape type.

During the game, every X frames a new random position could be sampled and used to update the rectangles so that we have continually updated information.

Especially once we have much more plants and/or bigger landscapes, this might turn out to be very useful.

I just wanted to write this down somewhere before I forget it.
Parent - - By Sven2 [us] Date 2015-08-19 14:54
Good thoughts. A forum posting will definitely not be forgotten and drop off the list after a few months.
Parent - By Zapper [de] Date 2015-08-19 14:58
Thanks, I am pretty proud myself
Parent - By Marky [de] Date 2015-08-20 12:51
I came across the same problem when I did my OpenClonk Classic stuff. I'll share my code, which is a modification of Tyron's GZE-Code shortly.
Parent - - By Clonkonaut [de] Date 2015-08-31 10:41
Just another thought:
The rectangle fitting might be very nice for plants with a broad, flat bottom that looks stupid on slanted surfaces. Thinking of wheat here.
Reply
Parent - - By Zapper [de] Date 2015-08-31 11:06
The wheat could also just be rotated to fit the ground, though :)
Parent - By Matthias [de] Date 2015-08-31 13:47
If you offset the bone rotation by the negative amout so that it still points up, this could be a nice approach.
Reply
Parent - - By Clonkonaut [de] Date 2015-08-31 14:42
Problem is, you have to put a lot of effort into making the plants customisable. Like what Matthi suggested, bone rotation and so on. You can't just rotate the whole plant because even if on a slope, plants grow straight up.
This isn't limited to wheat. Take Matthi's new tree design (for anyone who's not on Trello, see attachment). Broad, flat trunk that doesn't look good when on a slope.
Reply
Parent - - By Zapper [de] Date 2015-09-02 09:45
Yes, okay. That would not be covered by the original idea in this thread though, because I guess that would need to only estimate the landscape to be useable performance-wise.

I suggest adding a FindLocation criterion like Find_Flat that can allows only non-slope ground/walls/ceiling? If you have an idea what "flat ground" is, that should be rather easy to add
Parent - By Clonkonaut [de] Date 2015-09-02 11:04

> If you have an idea what "flat ground" is, that should be rather easy to add


Something like PathFree between x1 of (supposedly) flat surface and x2 of flat surface where y is ground-y - 5 (or so). You defined the distance between x1 and x2.
Reply
Up Topic Development / Scenario & Object Development / Random Thought of the Day: Prettier Placement of Plants

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill