Jump to content

MrGilbert

Members
  • Posts

    1
  • Joined

  • Last visited

 Content Type 

Forums

Gallery

Downloads

Tutorials

News Stories

Wiki

Community Guidelines

LSPDFR BOLO Series

GTA5 Native Database

GTA5 Native Parameters

Release Highlights

LSPDFR Mod Showcase

LML User Contributions

Everything posted by MrGilbert

  1. tl;dr: Speedy will allow you to ask dispatch for the speedlimit on the road at your current location. There are actually 4 limits in the game (afaik): 15 mph, 25 mph, 35 mph, 65 mph (trial-and-error values) Hi everyone, I'm Daniel, a LSPDFR long-time-aficinado, and also a software dev for some time now. Ever since, I wanted to build a plugin for LSPDFR, just for fun. But I never had an idea for one. Until this weekend. (So newbie API talk ahead, be warned!) The Problem When doing traffic patrol involving speed detection in LSPDFR, I find it hard to remember the speed limits for the different roads in GTA - I'm not from the US, so this might be the problem here. Also, I wanted to know the "real" speed AI should travel on the road I'm currently on. I did some research, and only found one plugin which was able to do what I wanted (and a bunch of stuff more, which I didn't need). Unfortunately, it crashed on start. Furthermore, I later learned that it does some lookup based on the streetname, and draw conclusions about what the speed limit might be from the name. That wasn't what I wanted. The Research (tech-talk) Apparently, this topic is hard to deal with. From what I've found so far, there where attempts to decode the "paths.xml" and "paths.ipl" file, which contains all the nodes in game. Also, there are several apis which return a node related to the road I'm on, with a "flag"-field that could contain valuable information. However, from what I've learned so far, the "paths.xml" file isn't actually used in game - but a file called "paths.rpf", which contains ".ynd"-files. These files are actually filled with node data, round about 77.000 nodes are spread across several files in this file. By using the logic of a 3rd-party tool ("CodeWalker" by dexyfex - awesome work, really great), I was able to extract the nodes from these files. As there doesn't seem to be a native api for this data, I destilled it into a 6 megabytes csv my plugin could use to do a quick lookup (excerpt): X,Y,Z,StreetHash,AreaID,NodeID,Freeway,Slow1,Slow2,Slow3,Slow4,Speed1,Speed2 5488.00,-5171.25,77.31250,1945201252,186,25,True,False,False,True,True,True,False 5487.75,-5159.25,77.12500,1945201252,186,26,True,False,False,True,True,True,False 5488.00,-5150.25,77.09375,1945201252,186,27,True,False,False,True,True,True,False 5488.25,-5141.50,77.18750,1945201252,186,28,True,False,False,True,True,True,False 5626.75,-5135.75,80.18750,1945201252,186,29,True,False,False,True,True,True,False 5611.75,-5135.75,79.84375,1945201252,186,30,True,False,False,True,True,True,False The speed flags can (obviously) have 4 different states: 00 10 01 11 To get a feeling for the speed (and prove me wrong or right), I did a small script which would patch one of the .ynd-files. I then went "on-duty", equipped with my speedcam (from Traffic Policer, love that plugin), and tried to measure the average speed. I came up with these data: 00 = 15 mph (9 - 17 mph) 10 = 25 mph (19 - 34 mph) 01 = 45 mph (32 - 59 mph) 11 = 65 mph (57 - 72 mph) The numbers in brackets are the minimun to maximum speeds I have measured so far. I might need to do some more research here, though. (For , uh, "science", I also patched an area which was located in downtown LS, and set the speed flags to "11" (=highway speed). As you might have guessed, cars had a hard time breaking, and peds had a hard time walking over the street.^^) The Dirty Work I liked the idea that you actually have to ask dispatch for the speedlimit of your current location (as all police vehicles are gps-monitored by dispatch, this is of course not a problem at all ) Currently, I have a first prototype running, which you can see on the screenshot: Conclusion So far, it was a fun and interesting weekend project. I know that this kind of plugin has it's "niche", and I guess I'm writing most of this just for my own education and fun. Also, it's a pretty small plugin (code-wise), most of the time has been dedicated to research. A first prototype is working, and I will definitely expand it beyond a typical "weekend project". Things that will come next: - Integrate into PoliceSmartRadio - Use name from Traffic Policer - Uhm... Release it soon? Thanks for reading!
×
×
  • Create New...