Overkillz Posted March 7, 2018 Posted March 7, 2018 (edited) Hello dear community. Im currently developing a game mode from scraths and recently I have found an issue which I have no idea how to fix it. When I die and I start to spectate someone, while im seeing to other player it is very very lag. I tried with my local machine and it is still looking lagging. I tried to use the following function after the vehicle is created but it doesn't work. myVehicle = createVehicle(v,x,y,z,0,0,rz) if setElementSyncer then setElementSyncer( myVehicle, false ) end I hope u can bring me a hand to fix it. Edited March 7, 2018 by Overkillz
MIKI785 Posted March 7, 2018 Posted March 7, 2018 Does the GUI really flash like that or is it only the recording? Because if you've got errors in onClientRender it may cause lags.
Overkillz Posted March 7, 2018 Author Posted March 7, 2018 There are not renders errors. I have checked debugacript 3 on both machines. As I said, arent fps issues, are lags (like ping) issues. Might collision with objects or something like that but it is coded pretty well. I hope u can help me.
MTA Team Dutchman101 Posted March 8, 2018 MTA Team Posted March 8, 2018 There's some general issues with spectating players in another dimension/int and also at coordinates far away, where it only "updates" the player's position every ~ 4 seconds resulting in something similar, but with a far lower interval than in your video. (you can even reproduce this with admin panel spectate across dim+int's) I didn't yet uncover the underlying issue or get a fix for the issue I am describing, it seems related to lightsync or something over that distance + dim, but I doubt we're talking about the same thing, although it could be related. Please show us the code of your spectator, and attach it to a command to trigger it so you can start spectating a specific player while you're still alive. Does anything in your gamemode move the dead player's position upon death, like to some centralised location far away? De-spawn them? @Overkillz
MisterQuestions Posted March 8, 2018 Posted March 8, 2018 (edited) Maybe dimensions desyc make sure player & vehicle are on same dimension (if using hidden check that current camera target is on your dimension) Edited March 8, 2018 by MisterQuestions 1
MTA Team Dutchman101 Posted March 8, 2018 MTA Team Posted March 8, 2018 26 minutes ago, MisterQuestions said: Maybe dimensions desyc Exactly where I was getting to, try not to move dead players to another dimention/int once they're out and the spectator starts.. until the root cause surrounding that type of desync is revealed.. let us know if that changed anything, because as I said the update interval I can see in your video doesn't look like typical cases of the issue I've seen before.
Overkillz Posted March 8, 2018 Author Posted March 8, 2018 (edited) Well, when the players and the car is created I have set them the same dimension 11 and the same interior(0) The 3rd player you see on the video isn't in the arena. Objects are created in the same dimension (11) - Outputting Vehicle Dim and Players Dim Code function sayPVdIM() local players = getElementsByType("player") for i,player in ipairs(players) do local pName = getPlayerName(player) local pDimension = getElementDimension(player) local vehicle = getPedOccupiedVehicle(player) if vehicle then local vDim = getElementDimension(vehicle) outputChatBox(pName.."#ffffff Dim:"..pDimension.." | Vehicle Dim: "..vDim) else outputChatBox(pName.."#ffffff Dim:"..pDimension.." | Vehicle Dim: none") end end end - Spawning player in Vehicle Code function spawnPlayerInVehicle(thePlayer) if thePlayer then local rSpawn = math.random(1,#arenaSpawns) local v,x,y,z,rz = unpack(arenaSpawns[rSpawn]) local pDimension = getElementData(thePlayer,"aDimension") spawnPlayer ( thePlayer, 0.0, 0.0, 5, 90, 0,0,pDimension ) myVehicle = createVehicle(v,x,y,z,0,0,rz) setElementDimension(thePlayer,pDimension) setElementDimension(myVehicle,pDimension) setElementInterior(thePlayer,0) setElementInterior(myVehicle,0) end end Here I have done a second video about it Thanks for reading. Best regards. Edited March 8, 2018 by Overkillz
ZL|LuCaS Posted March 9, 2018 Posted March 9, 2018 This is a problem with dimensions other lag that may appear when you use removePedFromVehicle with the moving vehicle you may notice the lock in the vehicle to correct can you use setElementSyncer
Antix Posted March 9, 2018 Posted March 9, 2018 The issue is probably that your spectating function is probably only client sided and that is exactly the issue. If you ( localPlayer ) spectate someone in another dimension it will look desynced. If you ( localPlayer ) set your dimension to the spectated players dimension client sided and then spectate it will look desynced. So the only solution is setting the localPlayers dimension server sided to the spectated players dimension and then start spectating.
Moderators IIYAMA Posted March 9, 2018 Moderators Posted March 9, 2018 I wonder what happens if you set the dimension of the camera element: https://wiki.multitheftauto.com/wiki/GetCamera (experimental)
Overkillz Posted March 10, 2018 Author Posted March 10, 2018 23 hours ago, Antix said: The issue is probably that your spectating function is probably only client sided and that is exactly the issue. If you ( localPlayer ) spectate someone in another dimension it will look desynced. If you ( localPlayer ) set your dimension to the spectated players dimension client sided and then spectate it will look desynced. So the only solution is setting the localPlayers dimension server sided to the spectated players dimension and then start spectating. I tried making the spectating on both sides Client and server and I get the same result. 19 hours ago, IIYAMA said: I wonder what happens if you set the dimension of the camera element: https://wiki.multitheftauto.com/wiki/GetCamera (experimental) I did it and Im still geting the same issue. Regards,
MisterQuestions Posted March 10, 2018 Posted March 10, 2018 We cant really help anymore if you dont show current code of spectating system, also may be issue regarding how do you spawnPlayers, i do have worked with various multigamemodes and never had an issue like this regarding to spectator
Overkillz Posted March 11, 2018 Author Posted March 11, 2018 (edited) EDIT: Issue fixed. It was the unfreeze function on clientside instead serverside. Thanks for ur help. On 10/3/2018 at 19:07, Keiichi32 said: Hi! Why don't you use setCameraTarget? Im using setCameraTarget On 10/3/2018 at 21:50, MisterQuestions said: We cant really help anymore if you dont show current code of spectating system, also may be issue regarding how do you spawnPlayers, i do have worked with various multigamemodes and never had an issue like this regarding to spectator Yes, here it is. Btw, the issue shouldn't be on the camera target. It must be on the spawning player, vehicle or soemthing like that due to I see the rest of players too lag. function spectateSomeoneC() for i,player in ipairs(cArenaPlayers) do if getElementData(player,"state") == "alive" then setCameraTarget(player) local cam = getCamera() local myDim = getElementData(localPlayer,"aDimension") setElementDimension(cam,myDim) return end end end addEvent( "onClientSpectateSomeone", true ) addEventHandler( "onClientSpectateSomeone", getRootElement(), spectateSomeoneC) And here it is my spawning player and vehicle function function spawnPlayerInVehicle(thePlayer) if thePlayer then local rSpawn = math.random(1,#arenaSpawns) local v,x,y,z,rz = unpack(arenaSpawns[rSpawn]) local pDimension = getElementData(thePlayer,"aDimension") spawnPlayer ( thePlayer, 0, 0, 5, 90, 0,0,pDimension ) myVehicle = createVehicle(v,x,y,z,0,0,rz) setElementDimension(thePlayer,pDimension) setElementDimension(myVehicle,pDimension) setElementInterior(thePlayer,0) setElementInterior(myVehicle,0) setElementFrozen(myVehicle,true) warpPedIntoVehicle ( thePlayer, myVehicle ) setCameraTarget(thePlayer) end end Btw, vehicle is unfrozen clientside. I don't know if this can affect to it. Regards. Edited March 11, 2018 by Overkillz
MisterQuestions Posted March 12, 2018 Posted March 12, 2018 Have you tried already doing it server side? 1
Moderators IIYAMA Posted March 12, 2018 Moderators Posted March 12, 2018 Yes, that can affect it. As freezing/unfreezing elements client-side isn't synced with other players. And even you did unfreeze it for all clients without serverside, I wouldn't know how the server would manage that. 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now