Procedural Objects/Plants
#1

Some of you may remember this topic I made: https://sampforum.blast.hk/showthread.php?tid=339962

Where procedural plants in single-player look like this:



I found MOST of the objects for it, and made a script to randomly populate an area with these objects using MapAndreas:




pawn Code:
PopulateArea(-104.0, 1605.0, 274.3, 1796.32, 1, 3.0,
    PROC_SAND,
    PROC_SAND_DENSE,
    PROC_SAND_ARID,
    PROC_SAND_COMPACT
    );
BUT the little grass patches (in the image at the top) don't seem to be a creatable object, so I'm not going to bother working on it. Was planning to release this as an include

I'm thinking that perhaps mods could be used, to change the ID of the grass or something. I think I found the dff/txd files in \Rockstar Games\GTA San Andreas\models\grass. Could easily be put in CUSTOM.img and used from that. In fact I may do that.

But yeah, it's a fairly simple script, but VERY inefficient. That area took ~3 seconds to populate (731 objects) due to many while() loops checking if any other objects were nearby. It could probably be made 1000 times faster if someone like Slice/Y_Less made it but unfortunately I am not as advanced as them. I guess efficiency isn't the most important thing for this though as it only gets loaded when the server starts then it's gone.

Another drawback is that the streamer (or GTA/SAMP) can only show 500 objects at a time, so you get a 'circle' of streamed plants around you :P

I know actually running this ALL OVER SAN ANDREAS with many players would probably melt a server's CPU and probably cause it to run out of memory though. I wish this was added in SA:MP ((((((

FYI the 'density' on that area is set to 1 percent. It's an integer so can't go lower but I guess I could change it to a float and make it like 0.5 percent. Something about it doesn't look right. Not sure if it's the lack of heathaze or what. Also the objects have random rotation.

pawn Code:
new plants_needed = floatround(area/(100-density));
(I had to reverse density because I fucked something up).
Then there's a loop with plants_needed iterations.

Also the objects in single-player have a 'scale' parameter, but of course that's not supported in SA:MP.

Thoughts?
Reply


Messages In This Thread
Procedural Objects/Plants - by MP2 - 13.07.2012, 22:41
Re: Procedural Objects/Plants - by Joe Staff - 13.07.2012, 23:25
Re: Procedural Objects/Plants - by MP2 - 13.07.2012, 23:28
Re: Procedural Objects/Plants - by Joe Staff - 13.07.2012, 23:33
Re: Procedural Objects/Plants - by MP2 - 13.07.2012, 23:35
Re: Procedural Objects/Plants - by Joe Staff - 13.07.2012, 23:52
Re: Procedural Objects/Plants - by MP2 - 14.07.2012, 00:24
Re: Procedural Objects/Plants - by kurta999 - 13.07.2013, 21:58
Re: Procedural Objects/Plants - by Kyle - 13.07.2013, 22:07
Re: Procedural Objects/Plants - by kurta999 - 13.07.2013, 22:11

Forum Jump:


Users browsing this thread: 2 Guest(s)