• Announcements

    • jhxp

      Forums are online again after a maintenance.   18/03/17

      MTA Forums maintenance is completed, although some automatic time-heavy tasks are still in process and will be finished eventually in background. Expect some features such as Forum Search to not display all results until all processes are finished. Please let us know if you spot a forum feature that worked correctly before the maintenance but does not work anymore now. Thanks. --MTA Team


  • Content count

  • Joined

  • Last visited

  • Days Won


Mr_Moose last won the day on November 5 2016

Mr_Moose had the most liked content!

Community Reputation

30 Good


About Mr_Moose

  • Rank
    Road Dawg
  • Birthday 26/10/93


  • Gang
    RageQuit community
  • Location
    RageQuit office
  • Occupation
    Software developer
  • Interests
    Programming, Web design, building and running servers using lightweight Linux distrubutions.

Recent Profile Visitors

673 profile views
  1. trailerSyncTimers needs to be initialized, add this: trailerSyncTimers = { } between line 2 and 3 in the first Lua block right before it's being used.
  2. Thanks to lower operational costs we are now lowering our prices, especially on our big plans. Here's some examples: Compute VPS (squirrel) 25 GB SSD, M.2 storage 1 vCore at @2.4GHz (Intel) 1,024 MB RAM Backup & live snapshots (from $0.002/hour) Dedicated low latency DDoS protection (from $0.015/hour) For reasonable $0.009 per hour Compute VPS (hedgehog) 40 GB SSD, M.2 storage 1 vCore at @2.4GHz (Intel) 2,048 MB RAM Backup & live snapshots (from $0.0034/hour) Dedicated low latency DDoS protection (from $0.015/hour) For reasonable $0.017 per hour (save $0.001 per hour compared to squirrel) Compute VPS (rabbit) 60 GB SSD, M.2 storage 2 vCore at @2.4GHz (Intel) 4,096 MB RAM Backup & live snapshots (from $0.0064/hour) Dedicated low latency DDoS protection (from $0.015/hour) For reasonable $0.032 per hour (save $0.004 per hour compared to squirrel) Compute VPS (beaver) 100 GB SSD, M.2 storage 4 vCore at @2.4GHz (Intel) 8,192 MB RAM Backup & live snapshots (from $0.0124/hour) Dedicated low latency DDoS protection (from $0.015/hour) For reasonable $0.062 per hour (save $0.010 per hour compared to squirrel) www.99stack.com
  3. That's strange, I was somehow convinced that all those calculations was the reason for the FPS drops. Have you considered using icon shaders on default blips instead? from what I can see this is some kind resource for managing custom blips, and those are usually pretty resource hungry no matter how you implement them.
  4. Processing blips all over the map is a heavy task, maybe you could process blips within a distance of 180 distance units only (same size as the radar area). Try replacing line 4-5: if (localPlayer ~= getElementAttachedTo(blip) and getElementInterior(localPlayer) == getElementInterior(blip) and getElementDimension(localPlayer) == getElementDimension(blip)) then local blipDistance = getDistanceBetweenPoints2D(blipX, blipY, playerX, playerY) with this: local blipDistance = getDistanceBetweenPoints2D(blipX, blipY, playerX, playerY) if blipDistance < 180 and (localPlayer ~= getElementAttachedTo(blip) and getElementInterior(localPlayer) == getElementInterior(blip) and getElementDimension(localPlayer) == getElementDimension(blip)) then
  5. Well there's a few things you can do to optimize but I can't guarantee that it would make any big difference, but it's still worth a try tho. First of all, in this case you can replace ipairs with pairs which is slightly faster. As long as you don't need to process your blips in a certain order that change should be safe. for _, blip in pairs(getElementsByType('blip', resourceRoot, true)) do The function getElementsByType can also be instructed to look into this resource only (or further down the element tree), in case that you have blips in other resources that shouldn't be processed by this loop. Last but not least since this appears to handle the mini map, you may want to look for streamed in blips only as well (all blips within a 180m radius from a player).
  6. The only reason for choosing 10ms is that you'll get 1 update per frame on a server running at 100FPS. In reality however default FPS rate for a server is 36 (27.77..ms sync interval) and most displays today runs at 60FPS (16.66..ms sync interval). My test server runs at 60FPS so in my case I wouldn't have noticed any difference if I've used say 20ms, other than support for more players and objects before noticing any lag. I did try this with Crystals bot resource however and 50-75 bots works just fine with a 10ms sync interval, first after spawning more than 75 bots and vehicles I did notice some lag. Without testing I think a 100ms sync interval should be sufficient as well. Luckily it's easy to change these values while testing what works best for individual servers.
  7. This is a complex problem but you can make it work almost perfect in most cases. Changing unoccupied_vehicle_sync_interval like 3aGl3 suggested (and the other sync intervals too) is a good start. I'm using 10ms on all of them except lightweight sync where 100ms is used: <!-- Player sync interval. Default: 100 --> <player_sync_interval>10</player_sync_interval> <!-- Lightweight (player) sync interval. Used when players are far apart. Default: 1500 --> <lightweight_sync_interval>100</lightweight_sync_interval> <!-- Camera sync interval. Default: 500 --> <camera_sync_interval>10</camera_sync_interval> <!-- Ped sync interval. Default: 400 --> <ped_sync_interval>10</ped_sync_interval> <!-- Unoccupied_vehicle sync interval. Default: 400 --> <unoccupied_vehicle_sync_interval>10</unoccupied_vehicle_sync_interval> <!-- Keysync mouse rotation sync interval. For limiting key sync packets due to mouse movement. Default: 100 --> <keysync_mouse_sync_interval>10</keysync_mouse_sync_interval> <!-- Keysync analog movement sync interval. For limiting key sync packets due to joystick movement. Default: 100 --> <keysync_analog_sync_interval>10</keysync_analog_sync_interval> This high sync intervals are barely noticeable on the server's CPU usage (Debian 8.7, mtasa-1.5.3), same applies for the network speed (Avg: 30 kBit/s) with 2 players online. Now this isn't everything you need, you would also need something that detects and update differences in positioning. Here's one potential solution, first the server side code which will obtain the current coordinates of a first (and a second trailer attached to an invisible Tanker semi truck attached to the first trailer). Coordinates server side will match the element syncer which should be the player who is driving the big rig. -- Trailer sync function trailerSyncTimers[client] = setTimer(function(client) -- Sync first truck trailer if there is any if vehicles and vehicles[client] and isElement(vehicles[client]) and isElement(getElementData(vehicles[client], "GTWvehicles.attachedTrailer")) then local tx,ty,tz = getElementPosition(getElementData(vehicles[client], "GTWvehicles.attachedTrailer")) local trx,try,trz = getElementRotation(getElementData(vehicles[client], "GTWvehicles.attachedTrailer")) setElementData(getElementData(vehicles[client], "GTWvehicles.attachedTrailer"), "GTWvehicles.trailer.location", toJSON({tx,ty,tz, trx,try,trz})) else killTimer(trailerSyncTimers[client]) end -- Sync first truck trailer if there is any if trailers and trailers[client] and trailers[client][1] and isElement(trailers[client][1]) and isElement(getElementData(trailers[client][1], "GTWvehicles.second_trailer")) then local tx,ty,tz = getElementPosition(getElementData(trailers[client][1], "GTWvehicles.second_trailer")) local trx,try,trz = getElementRotation(getElementData(trailers[client][1], "GTWvehicles.second_trailer")) setElementData(getElementData(trailers[client][1], "GTWvehicles.second_trailer"), "GTWvehicles.trailer.location", toJSON({tx,ty,tz, trx,try,trz})) end end, 250, 0, client) Now on the client side. This is where the coordinates are obtained from the trailer object itself which we set on the server earlier. Here's where we'll look for the big changes like if the trailer is rotated ~45 degrees for a player looking at the rig from the outside while everything looks perfectly normal to the driver. We'll also check for differences in positioning, in this case a distance of 20 units are used while the difference in rotation are π/6 rad (30 degrees) setTimer(function() for k,v in pairs(getElementsByType("vehicle", root, true)) do if getVehicleType(v) == "Trailer" and getElementData(v, "GTWvehicles.trailer.location") and getElementData(v, "GTWvehicles.towingVehicle") and getElementData(v, "GTWvehicles.towingVehicle") ~= getPedOccupiedVehicle(localPlayer) then local data = fromJSON(getElementData(v, "GTWvehicles.trailer.location")) --outputChatBox("Trailer "..k.." is streamed in at position: {"..math.floor(data[1])..", ".. -- math.floor(data[2])..", "..math.floor(data[3]).."} with rotation: {"..math.floor(data[4])..", ".. -- math.floor(data[5])..", "..math.floor(data[6]).."}") local tx,ty,tz = getElementPosition(v) local trx,try,trz = getElementRotation(v) --local sx,sy,sz = getElementVelocity(v) --outputChatBox("Updated trailer position for player: "..getPlayerName(localPlayer)..", Diff: x: ".. -- math.floor(math.abs(tx-data[1])).." sx: ("..math.floor(sx).."), y: ".. -- math.floor(math.abs(ty-data[2])).." sy: ("..math.floor(sy).."), z: ".. -- math.floor(math.abs(tz-data[3])).." sz: ("..math.floor(sz).. -- "), Diff rot: rx: "..math.floor(math.abs(trx-data[4])).. -- ", ry: "..math.floor(math.abs(try-data[5]))..", rz: "..math.floor(math.abs(trz-data[6]))) local t_tower = getElementData(v, "GTWvehicles.towingVehicle") if t_tower and isElement(t_tower) then setTimer(attachTrailerToVehicle, 100, 1, t_tower, v) end local t2_tower = getElementData(t_tower, "GTWvehicles.second_tower") if t2_tower and isElement(t2_tower) then setTimer(attachTrailerToVehicle, 100, 1, t2_tower, v) end if math.abs(tx-data[1]) > 20 or math.abs(ty-data[2]) > 20 or math.abs(tz-data[3]) > 20 or (math.abs(trz-data[6]) > 30 and math.abs(trz-data[6]) < 150) then --outputChatBox("Old pos: "..math.floor(tx)..", "..math.floor(ty)..", "..math.floor(tz)) setElementPosition(v, data[1],data[2],data[3]) setElementRotation(v, data[4],data[5],data[6]) --local tx,ty,tz = getElementPosition(v) --outputChatBox("New pos: "..math.floor(tx)..", "..math.floor(ty)..", "..math.floor(tz)) end end end end, 500, 0) Next thing to do here would be to not allow an element to stream out. This is slightly easier tho since you only need to pass the newly created trailer element (and the semi truck) to the client and then use setElementStreamable client side. Here's an example I've been using to solve this issue with trains carrying 20-30 trailers. Server: triggerClientEvent(root, "GTWvehicles.onStreamOut", root, vehicles[client]) Client: function check_stream_out(c_train) setElementStreamable(c_train, true) end addEvent("GTWvehicles.onStreamOut", true) addEventHandler("GTWvehicles.onStreamOut", root, check_stream_out) This code is a part of https://github.com/404rq/GTW-RPG/tree/v4.0-development and might need a few adjustments to work in your server but it shows the principles. vehicles[client] contains the semi truck and trailers[client][1] contains the first trailer. The trailer can identify it's tower from it's element data set to: GTWvehicles.towingVehicle which is set upon creation. If you're having any trouble, try changing the values in this line, that's pretty much how aggressive the sync will be, if it's too aggressive you may experience other issues: if math.abs(tx-data[1]) > 20 or math.abs(ty-data[2]) > 20 or math.abs(tz-data[3]) > 20 or (math.abs(trz-data[6]) > 30 and math.abs(trz-data[6]) < 150) then I hope this works for you too
  8. Are you sure that you're checking and destroying the same element then ( syrena ).
  9. You need to check if the element exist before trying to remove it: if theElement and isElement(theElement) then destroyElement(theElement) end
  10. Backup snapshots and improvements in billing history is now available, a transaction page has also been added in where you can trace your payments and their current status. That and many other minor improvements has been made to the layout for a better overview of your active services. We've also added support for http2 to our control panel/dashboard which made it load 3 times faster than before.
  11. January update is finally here, read all about it in our forum post: https://forum.99stack.com/d/81-new-plans-and-locations-available News summary 14 new VPS configurations available in 12 new locations New data centers available in Canada, Singapore, India IPv6 and private networking is now free 50% off on dedicated DDoS protection All prices are now viewed as hourly
  12. You may consider using both, an unstable connection may after all result in data loss so while a freeze called server side may sync across all other players the affected player might not receive the freeze call, client side will freeze the affected player and thus theoretically stop him from moving but due to eventual data loss that signal might not reach the server, that could cause other players to see the affected player continue to move while he should be frozen.
  13. Those "errors" are only there to inform about a deprecated function, there should be replacements available in wiki already. House system needs access to the command ' executeCommandHandler' which can be set in acl.xml. The compiled file is simply outdated and unfortunately a third party resource I don't have access too, developers name should be available in it's meta file. Some location data can be modified via commands while others will require a modification of a table or XML file, most commands are listed in /help except for the admin commands.
  14. You should change your router password now, as soon your server is up your public IP is exposed to the world and anyone who paste that IP into a browser can connect to your network on port 80 which goes directly to your router (unless you have a web server at home).
  15. @iPrestege MTA servers are still available but they will no longer run on shared servers. When you click on "game servers" you'll be redirected to www.gameservers.com, a different company who is now fully responsible for the shared game server hosting. Unfortunately they don't have MTA servers so you'll need a VPS or a dedicated server for that which we have here and here. A universal installation script for all Linux distributions will be published in our knowledge base in the beginning of next year.