Jump to content

set vehicle draw distance


Xwad

Recommended Posts

How can i set the vehicles draw distance to maximum (1200m) ? I tried with creating low lod for the vehicle, used  "setVehiclesLODDistance" and set all the game settings to maximum but still have a draw distance for vehicles with the maximum of 300 m.

client:

function lod()
	for i,v in ipairs(getElementsByType("vehicle")) do 
		local model = getElementModel(v) 
		local x,y,z = getElementPosition(v)
		local rx,ry,rz = getElementRotation(v)
		local objLowLOD = createObject ( model, x,y,z,rx,ry,rz,true )
		setLowLODElement ( v, objLowLOD )
		engineSetModelLODDistance(v, 9999)
	end
end 
addEventHandler("onClientResourceStart", resourceRoot, lod)

setVehiclesLODDistance(6000)
setFogDistance(10)
setFarClipDistance( 9999 )

 

Link to comment

Hello Xwad,

you are probably fighting against the custom MTA SA element streamer in this situation that you describe. The MTA streamer does have it's own streaming distance settings. I am not sure how to adjust such properties or whether the MTA team did intend to have you look at vehicles from 1200 meters far away.

Edited by The_GTA
  • Like 2
Link to comment
2 hours ago, Xwad said:

Sad :( Thank you.

You can either request a new feature on the MTA GitHub issue tracker or respect the fact that MTA is working with a closed source engine that has big limitations to begin with, making the new features difficult to mature out. I wish you good luck ?

Link to comment
18 hours ago, Reyomin said:

In case it's MTA streamer in play like @The_GTA says, there's a function setElementStreamable. Since it's just enable/disable function, increasing the vehicle visibility distance would work by checking the distance repeatedly and enabling or disabling streaming based on that. But if you want to do this for all vehicles, doing it efficiently is where it gets complicated.

I would like to add that enabling or disabling the MTA streamer is not equivalent to streaming in or out an entity. You can simulate the MTA streamer by just creating MTA entities that you disable "streaming" on using setElementStreamable. The creation of such entities would be equivalent to streaming them in, the destruction equivalent to streaming them out.

Edited by The_GTA
Link to comment
On 07/12/2021 at 15:46, The_GTA said:

I would like to add that enabling or disabling the MTA streamer is not equivalent to streaming in or out an entity. You can simulate the MTA streamer by just creating MTA entities that you disable "streaming" on using setElementStreamable. The creation of such entities would be equivalent to streaming them in, the destruction equivalent to streaming them out.

It's an important distinction to make, yes. Doesn't make much difference in this case since the objective is to increase the streaming distance, but it's important not to forget (yet looks easy to confuse) because the same won't work if we want to decrease the distance.

If I correctly understand how the function works, then it's not even "disabling" the MTA streamer. If you "disable" the streamer for too many elements, the number will go beyond GTA limits so some of them will have to be streamed out regardless. What the function does is disabling the distance limit for the streamer and changing the priority so that elements with normal priority will get streamed out before those for which the streamer is "disabled".

Link to comment
52 minutes ago, IIYAMA said:

Note: Even if you could see an vehicle at 1200m away, it wouldn't have anything to stand on. You would see it just fall down the floor, over and over.

Do you know how scripted mission entities inside of the GTA SA engine have the map loaded underneath of them? Since I have my hands tied at the moment maybe you could look into that code inside of the engine and utilize it to help OP, in case he needs those collisions.

Link to comment
  • Moderators
37 minutes ago, The_GTA said:

Do you know how scripted mission entities inside of the GTA SA engine have the map loaded underneath of them? Since I have my hands tied at the moment maybe you could look into that code inside of the engine and utilize it to help OP, in case he needs those collisions.

I have never looked at the source code before, or rather I have no clue where to begin even.

If you mean the mission cars that are driving in the distance? I don't think they are actually driving those with collision in mind. They are (most likely) just following a way path with a non-variable speed. When you are getting close, first the car(target) spawns in and after that the traffic around it will be carefully generated. At least that is how I would create something like that. I did that same concept with trains, and that worked surprisingly well.

Link to comment
2 hours ago, IIYAMA said:

If you mean the mission cars that are driving in the distance? I don't think they are actually driving those with collision in mind. They are (most likely) just following a way path with a non-variable speed. ...

You should not really underestimate the work of Rockstar North when they developed this game. Since you have doubted the collision loading for mission entities here is a quick proof I have dug up (you made me go through many hoops to look it up!):

gta_sa_proof_mission_entity_collision_lo

I am not going to explain a lot since talking about these topics has become risky, but I did dig a lot into this code and mission entities do trigger map loading if they are configured in a very specific way. It should not take a lot of effort to patch this code so that it loads collisions for arbitrary points or even arbitrary MTA entities.

Edited by The_GTA
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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