Jump to content

How to enable streaming


Recommended Posts

Is it possible to enable streaming of custom elements (created with createElement) the way vehicles are streamed (only nearby elements are sent to player)?

Also, it is possible to enable streaming of objects in the same way? Currently every client receives and operates on whole set of objects and custom elements.

Link to comment
They're streamed out when they're about 300 GTA SA units of distance from you.

Isn't that 500 units?

Anyway, all physical elements are streamed in the same way. Streaming is done client-side. Every server-side element is available client-side unless you disable the visibility with setElementVisibleTo or visibility argument in element creation function (if it has such argument). However, visibility can't be toggled on players, vehicles and objects, so to make a server-side streamer, you need to trigger client events and use them to create client-side objects. But I can hardly see any point in streaming elements in such way.

Link to comment

But I can hardly see any point in streaming elements in such way.

To achieve a higher bandwidth usage-lower cpu usage tradeoff.

If I want to create, for example, several thousands of custom elements, that would be rendered (onClientRender) on all connected clients, with an assumption that client won't see more than, let's say, 20 elements at once - it may be quicker to just stream nearby 20 elements to client, than to implement custom client-side sieve/streamer.

Although I get it - I need to sift the elements clientside to save on processing power, and that's the way it should be done in MTA. All in all it doesn't seem a bad idea :D.

Link to comment

Element streaming in MTA is putting/taking the element into/out of GTA SA. Streaming means that GTA becomes aware of element, so only physical GTA elements can be used by MTA streamer. GTA itself is never aware of custom elements. Also, streamer needs to know element positions. Custom elements don't have positions. Even if you use element data to store coordinates, objectively it's still just element data and not position. So it's easy to understand why custom elements can't be streamed. As I said, just write an algorithm to find the nearest text labels. Lua has everything you may need, like tables or coroutines.

Link to comment
... Custom elements don't have positions. Even if you use element data to store coordinates, objectively it's still just element data and not position.

Actually, they do - position can be assigned with setElementPosition and is accesible with getElementPosition. Also it is processed like any other element - for example it can be selected using getElementsWithinColShape.

As I said, just write an algorithm to find the nearest text labels. Lua has everything you may need, like tables or coroutines.

Agree.

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...