mauserrifle / simresults Goto Github PK
View Code? Open in Web Editor NEWSim racing result reader for PHP
Home Page: http://simresults.net
License: ISC License
Sim racing result reader for PHP
Home Page: http://simresults.net
License: ISC License
Read skin and ballast information.
"Cars": [
{
"CarId": 0,
"Driver": {
"Name": "Driver",
"Team": "",
"Guid": "7111111111111459"
},
"Model": "ag_porsche997rsr_11",
"Skin": "porsche_1",
"BallastKG": 0
},
Change code like this:
$file_path = realpath(__DIR__.'/logs/assettocorsa-server/discarded.laps.txt');
$session = Data_Reader::factory($file_path)->getSession(3);
To something like:
$session = Data_Reader::factory(realpath(__DIR__.'/logs/assettocorsa-server/discarded.laps.txt'))->getSession();
When doing regex above Lap data. Somehow detect that there are no lap changes after that lap? So this means 2 regexes, but maybe safe like 10-60 after that.
Make an interface of Session. Make the current Session class an implementation of it. Remove all cache code from that implementation and make use of a cached decorator implementing the interface.
CachedSession --> Session --> SessionInterface
Consider adding toString to the Lap class. This makes code simpler by excluding getTime()
from the following code
\Simresults\Helper::formatTime($participants[$i]->getBestLap()->getTime());
Split tests into unit and integration
Someone changes here during race:
http://simresults.net/171210-yg5
Read Dedicated server JSON output
Alot of readers share common functionality (for example fix positions based on participant order). Also all readers started to have their own implementation and order how to get things (big clutter in getSessions()
method too).
We need to fix this and make all readers act within with the same behavior using a common interface. Template methods? Is this possible due to different data formats?
Calculate the consistency of a driver based on its laps. Useful for league owners and drivers themself.
Is now throwing Simresults\Exception\NoData: Cannot find a reader for the given data
which is incorrect. The "given data" is not read.
Throw a File Not Found exception instead.
Set race grid position based on the previous qualify session for the Assetto Corsa reader (race_out.json). Same functionality as used within Assetto Corsa Server reader.
Prevent duplicate code?
Set the session date as original string too. This is useful for readers of logs that don't include dates that can be converted to a proper PHP timezones. I think this is better for the ac-server reader.
Almost every reader has the code below. Fix it.
/**
* Retrieve a single key from an array. If the key does not exist in the
* array, the default value will be returned instead.
*
* // Get the value "username" from $_POST, if it exists
* $username = Arr::get($_POST, 'username');
*
* // Get the value "sorting" from $_GET, if it exists
* $sorting = Arr::get($_GET, 'sorting');
*
* This function is from the Kohana project (http://kohanaframework.org/).
*
* @param array $array array to extract from
* @param string $key key name
* @param mixed $default default value
* @return mixed
*/
protected function get($array, $key, $default = NULL)
{
return isset($array[$key]) ? $array[$key] : $default;
}
Read how much time has been cut
Implement pitstops? The events seem available in the log.
See Race gaps: http://simresults.net/151107-1jd
Create test for: #44
I'm using your website to calculate the points for our league and it is showing one of our players as being a separate user across two races. Here is a link to the result:
https://simresults.net/181018-4Jj
If it would be useful I can attach the logfiles I used to create this result. You can see that the player 'V8_Fiero' is listed twice on the points breakdown and is in both race 2 and 3. We are using the MotoGP points schedule.
One thing to note is that I entered each race as a separate json file. We run two races a week and I removed all the other history results from each file so it only contained one practice/qual/race session.
Hi , I'm one of the admins at simracingonline.co.uk & we have an issue with my info (as admin & first on the server) never appearing in the results for pc2 , I have done the edits to the sms_stats_json ,here are my edits >
-- Session game state changes.
function handle_session_game_state_change( old_state, new_state )
if not old_state or old_state == "" then
old_state = "None"
end
session_game_state = new_state
if ( old_state == "None" ) and ( new_state == "Lobby" ) then
handle_new_session_lobby()
elseif ( old_state == "Returning" ) and ( new_state == "Lobby" ) then
handle_returning_session_lobby()
elseif ( old_state == "Lobby" ) and ( new_state == "Loading" ) then
handle_session_loading()
elseif ( old_state == "Loading" ) and ( new_state == "PostRace" or new_state == "Race" ) then
handle_session_loaded()
elseif ( old_state == "PostRace" or old_state == "Race" ) and ( new_state ~= "PostRace" and new_state ~= "Race" ) then
if new_state == "None" then
handle_session_finished_prematurely()
else
handle_session_finished()
end
end
end
These seem to work as we now have results ! however my info is never parsed and Im left out of every result ?
here is a pic of race 1 (of 2 that day & should be the last 2 races in the results) Im admin on the server and finished 6th 'Rob Milliken'
& this
This is what we get from simresults without any of my info ..
We don't know what to do ?? its been like this from the start meaning my data is never shown ..
I tried to upload my sms_stats_data but i dont have winzip and wrar wont work ..it's posted in this thread at SMS forums http://forum.projectcarsgame.com/showthread.php?56405-No-Race-Results-in-sms_stats_data-json&p=1461236&viewfull=1#post1461236
Im reading in the forum that other players have it working with no issues & so it must be something on my end ?
Thanks in advance if you find any time to help !
Rob .. ;-)
Integration test for: #43
Hello,
I try to use the API for grouping the result of my league (on R3E). For that purpose, I created a JSON as described in your docs:
http://ec2-35-180-32-180.eu-west-3.compute.amazonaws.com/results/json/simresult.json
Seems to work well : http://simresults.net/remote?results=http%3A%2F%2Fec2-35-180-32-180.eu-west-3.compute.amazonaws.com%2Fresults%2Fjson%2Fsimresult.json
Unfortunately, it does not work well at the moment because, if I update my json input file, for example by adding a new event, this event does not appear in the dropdown list when I refresh the page in simresults (while I can see the change in my webserver). Finally, I'll see this event a few hours later (which is problematic as our drivers want to see the results just after the race).
Seems that there is some caching or something?
I also notice that when I select one event and then an other in the dropdown, there is a duplicated parameter in the URL : "&result=4&result=11". This bug is also visible when using the demo in your API description page : http://simresults.net/remote?results=http%3A%2F%2Fsimresults.net%2Fexample.json&result=1&result=0
Maybe is those two issue related with each other?
Thanks in advance for your support,
BR
PS : there is also another bug in raceroom, all names are now "broken" : John D instead of John Doe (only when using manual upload, not through the API)
Date support Assetto Corsa server
A driver can switch between cars. Should we parse this? Save which car per lap?
I have an instance where lap 1 is missing for all participants. All other laps are processed ok. This is an Assetto Corsa json file. I can see lap 1 in the file for all participants. Any workaround for this problem? Thanks.
Hi,
Since a few weeks, the qualifications times are missing in the display of raceroom qualification table, like here : http://simresults.net/171023-vG1
Those times are still in the Json so it should be a bug :
Ex :
{
"FullName":"David Torned",
"Username":"Torned",
"Car":"McLaren MP4-12C GT3",
"CarPerformanceIndex":60,
"Position":2,
"PositionInClass":2,
"BestLapTime":97958,
"TotalTime":-1,
"FinishStatus":"Finished",
"RaceSessionLaps":[
{
"Time":-1000,
"Position":2,
"PitStopOccured":false
}
]
I've looked in the code and I think I know why it does not worked. Qualification has a section "RaceSessionLaps" (which is wierd) and has a consequence, you parser does not take into account "BestLapTime" which is where we can find the time for the qualification. See line 183 and 212 of Data/Reader/RaceRoomServer.php.
Thanks
Example:
LAP ShijouR26B 2:42:396
SPLIT COUNT: 3
Dynamic track ok
LAP REFUSED BECAUSE THE SESSION HAS NOT STARTED YET
Filter them out too. See how we can change the regex. Currently works only when it's on the next line (\n|\r)(?!WARNING: LAPTIME DISCARDED|LAP REFUSED)
which won't work in this case :(
(example log is known at Alex or Mauserrifle).
I use $session->getIncidents() for retrieving collisions. That's kind of ugly because i have to parse these message strings someway, try to match it against my drivers to get in touch with the involved driver guids.
I saw an "Events" section in the json which provides detailed information about collisions including type (car collision / environment collision) and the involved driver's guid.
My it be possible to include these information in you library?
From the PC forum:
I have a small request,
in the log file, there is a value "trackdistance" by drivers.
It would be nice to integrated with the total number of laps made during the different sessions.
They are now:
...
Should be
...
Clean up so ready for release
Tyre wear info has been added to the XML's. Read it.
Add the 'dedicated' field. Identifies if it's a server file or not.
Add cuts per driver to CSV on website (not library related)
Clean up so ready for release
Project Cars now excludes invalid laps. But it could be nice to still have these laps for stats but exclude from all other logic such as best lap.
(example log is known at Alex or Mauserrifle).
Hey,
since some update (i don't know which one exactly) we have the ability to use restrictors for BOP'ing cars. These are part of jsons's Cars Array, just like ballast.
Would you mind adding $participant->getVehicle()->getRestrictor(); to the library?
Thanks in advance!
Cheers
Alex
See Race07Test.php@testRaceroomLogDifferences()
http://simresults.net/160113-0VW
This result shows an empty driver (AI)?
In the AC Server JSON reader, drivers that have not completed 50% of the laps are marked as FINISH_NONE. Implement this on other (AC) readers too?
Easy converting to JSON would be of big value for users who do not know PHP and just want to get a fast universal JSON output.
Detect Automobilista in rFactor reader
Detect race using number of laps? We clearly can't trust RaceMode=5 on almost all logs.
Recent GTR2 upload: http://simresults.net/160207-o8y . Clearly a race.
Request by CordellCahill:
Another thing is calculating pit stop bogey times. Looking at the stream part it seems it can be calculated using that. Say take the last sector 3 starting time stamp before a pit then get the timestamp of the start of the proceeding sector 2. Take that time and subtract an avg of what that time is without the pit....boom, bogey time.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.