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
#2

Looks nice, but as you mentioned, it isn't a very viable method. I don't think even the best of the best could make it worth while (server sided).

The only option is to make it client sided, perhaps with a CLEO mod.
Reply
#3

Yeah that's probably the best option. I have a friend that tried (and possibly succeeded can't remember) to enable the heathaze and the sun. I could ask him to take a look at this.
Reply
#4

Or perhaps there's a simpler way that we've ignored. Do we know what steps are taken to disable them in the first place? Perhaps that's a method that could be explored, to see if the process of stopping it can be stopped...
Reply
#5

No idea in regard to that. Could that be 'stopped' with CLEO?
Reply
#6

Can't imagine so, seems more like a direct .DLL hack job
Reply
#7

Ah well I haven't the faintest idea about that, all I can do is hope Kye can/will add this :/
Reply
#8

If someone want to enable it, then download this and put into GTA SA root folder (where gta_sa.exe located)

Source code added, so if someone don't want to enable blur, remove it. Recomplie as .dll, rename to .asi and put into your gta sa folder.

http://www.mfr.clans.hu/SAMP/blur_and_grass.rar
Reply
#9

Looks totally over populated with plants. :/
Reply
#10

Quote:
Originally Posted by KyleSmith
View Post
Looks totally over populated with plants. :/
Looks how looks in the SP. The best solution for me would be disable theese big plants, and enable only the small which doesn't have collision. But I'm not a professional C++ programmer, so I can't do it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)