Grass Engine V1.0.2 - A FREE interactive foliage system

Grass engine

“Imagine charging 4.99 for grass” - some random guy*

What is grass engine?
Grass engine is an optimized interactive grass system, it makes it so objects that touch grass can actually push the grass and give it more life.

How to use
To setup, simply drag the module into wherever you like that the client can access and then require and call GrassEngine.Initialize()

To create grass in your world create a part that is the size of your grass and put it anywhere you like, Then add a tag to it called InteractiveGrass, then give it an attribute that is called GrassType and set it as the GrassType Enum you preffer, if no Enum is set it will be 1 by default.

To create diferent types of grass make sure to create open the GrassEnums module, and create a new enum for your grass type.
image

After this open the GrassTypes module, and define the data for said grass type
image

You can also change some basic settings of the system such as:
image

Features I want to add
This resource is somewhat unfinished, but I decided to release it now since it was on a functional stage.

I still want to finish some features like finishing the viewport animation culling, playing sound effects when grass is touched and making the grass work with WindShake for wind movement.

Download
GrassEngineV1.0.2.rbxm (42.8 KB)

GrassEngineV1.0.1.rbxm (33.3 KB)

Test place
( ✦ ) Grass Engine V1.0.1 - Roblox

55 Likes

I grass to this :fire:
Charcharchar

5 Likes

Finally touching grass in the metaverse!

Real talk, this looks amazing, will be experimenting with it!

5 Likes

first time I post something people find useful.

2 Likes

dude i just started tearing up. ive been waiting for someone to make a performant interactive grass system since 2017. thank you.

also, i have some questions:

  • why do you use :Dot over magnitude checks between the camera and grass? it may be easier to use the settings if you use studs, which is what magnitude outputs.
  • do you think chunking is possible? for example, at run-time, you could group grass together if it’s close to other grass pieces and simulate them all at once. i feel like this would be a good idea for performance.

also, you left a few requires to FastSignal in your .rbxm file, which will cause errors to anyone who doesn’t have them. easiest workaround is just to comment them out.

2 Likes

I’m glad you liked it

1 I use :Dot() over magnitude because it is faster when running natively.

2 It is possible although when I built this system I did not had that in mind, and I am not sure if a thing like that would require to redesign the code’s arquitecture.

3 Oops I forgot to remove those, ill remove them once i’m home, I left them there on accident because I work with chickynoid.

1 Like

Just realised that I actually found it right when it came (probably after a hour)
But its a good one, if plugins would be for robux and not $, I would buy that plugin, but this free and still good, I will use it
(I mean that this thing is very good, I will use it, thanks)

2 Likes

related to part 2) isn’t steaming of parts , and also they need to be touching the grass to enable it taking care of that? or why would you need to enable chunking if they are not touching all of the chunks?

2 Likes

i wrote this reply before i did some stress tests. im not a good benchmarker by any means, but i didnt see any devastating changes when i had hundreds of pieces of grass near my camera. im not even sure if chunking would be beneficial.

would you be able to benchmark it? i 100% believe it’s well optimized, but id love to see where it isnt. if you dont have any benchmarking plugins, dont sweat it. am just curious.

my other question is, why are there so many modules for different states? it feels like they could be wrapped up under one module. were you planning to add more functionality to those modules?

my “problem” with it is that it seems to loop over every tagged instance, which could get sped up by using chunking.

again though, it’s not really a problem as it’s incredibly optimized already (wish i had a benchmarking plugin to see for sure). i had hundreds of grass and didnt really see a difference with the microprofiler, so either chunking is unnecessary or there are other optimizations in place that i missed when looking over its source.

i believe windshake uses some sort of octtree search algorithm instead of chunking, so that may be worth looking into if desired.

(again, amazing resource, cant believe its free)

1 Like

How many grass it can have until it starts to lag? Many Grass Engines say that they are fast and optimized, while in the demo videos, there is really small amount of them. Is it possible to make the grass dense without it lagging?

2 Likes

I am not sure about it so ill just tell you the optimizations i implemented.

Grass far away from camera is hidden, In the future I want to completely destroy it to use less memory and use part cache to create the models without lag.

Grass that is very close to the camera is simulated, this means that it will start casting collisions, I used :GetPartsaboundsInBox() for simplicity.

Part CFrames are updated through :BulkMoveTo() since it is faster.

Distance checks are done natively and with:Dot() so it is fast.

Tables are manually cleared instead of just being thrown away and replaced to avoid overwelming the garbage collector or something.

There is also an unfinished optimization which is supposed to not animate grass outside the camera’s viewport.

You can also modify the render distance, simulation distance and update rate, its on 30hz/fps by default.

1 Like

I failed to understand anything of what you said, Sorry.

1 Like

I have no idea how to benchmark stuff’, if it was easy and I knew, I would have posted some here.

There are a lot of modules because on early development the main module was bloated with so much stuff, Also i was experimenting with this new pattern for handling the grass state, which I like to call the level pattern.

Again, no idea if chunking could be easy to add, and I am busy atm with Descent XYZ development, not sure when ill come back to update it.

1 Like

Hi,

Would it be possible to make an example editable place as an example?

2 Likes

Update V1.0.1

  • Fixed fast signal errors that @debugMage pointed out.
  • Added a setting to change the collision size offset.
  • Added a test place like @CanterCrow suggested.
1 Like

I’m not entirely sure what I’m doing wrong, I can’t get this to work for the life of me, it always defaults to the Test grass type, i’ll have some pictures below, I tried using a string & number Attribute, both set to “2”, and even tried setting the string attribute to “Tall”, nothing worked.

EDIT:
When replacing the Test type with my own model / info it worked, but adding new types just doesn’t seem to be functioning? I know it’s most likely user error, I’m just really confused.

EDIT#2:
Printing the grass type before you default to the Test Type returns 2… not sure why it wouldn’t be picking up on it.



image

1 Like

Ill look into this later, thanks for reporting it.

I personally just deleted built-in grass and putted my own with same name

yeah but I still want to fix this, because then I cant have flowers and other plants in the game either.

I have identified the issue and have published a fix, redownload the resource.