Stream/Draw distance or too many objects?
#1

I really miss those days when I was up to date with everything related to SA:MP. Now, I almost forgot how object streaming works so I need you guys to refresh my knowledge!

Basically, I was asked to help in a project already in deep development, which is fine for me. The problem is, I was expecting everything they did so far was great, but it wasn't.

There are many new objects added to the filterscript which is then loaded by the GM. At first, it looks like everything's fine, but then you realise streaming those objects is a nightmare. I don't know how to explain. It's like a hole in the ground when you are not near the object's position. Custom windows are in the air and the building whose windows are on only show when you are near.

I tried only one solution so far. I tried reducing/increasing streamer and draw distance. No gain. Maybe because I don't even know what those actually mean for dynamic objects. It would be really nice to get a detailed explanation for those :P
(STREAMER_OBJECT_SD, STREAMER_OBJECT_DD)

Second solution could be reducing the objects count.

Third solution could be using plain CreateObject for floors and big buildings instead of Dynamic

Now, if you still don't have a clue what am I talking about, I'll post some screenshots.
If you do, could you help me, please?

Thanks for reading
Reply
#2

Why don't you use CreateDynamicObject on every object (except custom interior) with the streamer plugin? Objects are destroyed until you are streaming in.
If I misunderstood, apologizes.
Reply
#3

Quote:
Originally Posted by Dayrion
View Post
Why don't you use CreateDynamicObject on every object (except custom interior) with the streamer plugin? Objects are destroyed until you are streaming in.
If I misunderstood, apologizes.
Everything is Dynamic as we speak
Reply
#4

PHP Code:
CreateDynamicObject(modelxyzrot_xrot_yrot_zsomethingsomething, .streamdistance 1000); 
You need to set the stream distance parameter value to something like this.
Reply
#5

Set the objects which are important such as ground, floor, walls to have higher stream distance, ofcourse based on the size and position. For a wide huge ground object (let's say a mountain, island, of a single object ofc) it would have larger stream distance than the smaller size (let's say interior items like furniture, decorations, or exterior items like grass, bushes), unless you are making a pathway for the player. New version of streamer plugin has "priority" parameter which you can use on those important objects. Draw distance shouldn't be matter and you can keep it on default value (it's for rendering) unless you noticed some in-game lags since your objects are too dense with full of small objects in one place. Object drawing/rendering performs better when the player is not in vehicle, sometimes the player cannot see the objects texture from the vehicle and they have to exit first and get in back.

Code:
native STREAMER_TAG_OBJECT CreateDynamicObject(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = STREAMER_OBJECT_SD, Float:drawdistance = STREAMER_OBJECT_DD, STREAMER_TAG_AREA areaid = STREAMER_TAG_AREA -1, priority = 0);
Additionally, If you also need to calculate the object model size to get its right priority, you can use this include as you said it's just going to be used when the gamemode loaded:
https://sampforum.blast.hk/showthread.php?tid=586040

Reducing the amount of object is also good choice to reduce the density, optimize the number of objects by using alternative object which has same shape with less amount, however using CreateObject wouldn't be good idea if you have alot dynamic objects. Also looking on the use if it's just going to be used temporarily then you could use CreatePlayerObject as alternative if you ran out of streamer options. But still it's good to keep these amount of objects as low as possible so streamer will work better.

If the dynamic objects are slow at loading, you have to freeze the player for few moments near the objects to let it being streamed-in, or very last option is to increase the plugin update rate (still it will also depend on the server & client connection and performance).

Sorry for bad english, i hope it helps.
Reply
#6

Thank you for the fast replies!
I'll try several objects CreateObject and leaving other at Dynamic. It won't be much, maybe a hundred at most. If that doesn't help, I'll try your tips and tricks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)