The online racing simulator
Radar (WIP!)
(18 posts, started )
#1 - Racon
Radar (WIP!)
Radar:

This one is a Work In Progress! There are some issues still to be sorted,
the code and functionality is a little messy for this reason. It's still
enough to be useful though, if you can live with a couple of annoyances.

The radar panel can be moved and scaled freely, and shows cars around you
in two ranges: Short range is drawn across the panel, long range is drawn
around the edge of a circle inside the panel. Different colours are used
to show:
  • you (green)
  • long/short range (cyan/white)
  • cars a lap up/down from you (blue/red)
  • cars causing yellow flag (yellow)
  • lagging (magenta)
  • cars in contact with others (black)


Issues:

Other programmers out there with any ideas don't need to be shy pointing out
anything daft I've done, I'm not proud Wink

InSim buffer overflow:
When joining a server with the radar running, there is a period where we
are receiving MCI (position) packets and sending buttons, but LFS is still
loading mods before processing InSim packets. If the server is busy with
mods that you haven't already downloaded, this wait will easily fill the
insim buffer and LFS will close the connection. Joining 'Just A Ride' server
will kill the radar 9 times out of 10, for instance.

Also, time-skipping in replays will do the same thing.

Car markers persisting/'getting stuck':
Sometimes a marker will persist on the radar screen when it shouldn't. I am
working on this! The code seems to be fool-proof in clearing all the old
markers before drawing the new ones, but alas. More testing is required to
know if this bug is in my radar logic, my PIE logic, or LFS button clearing.

Currently handled by doing a full clear of all buttons every X seconds to
catch the stragglers - usable but imperfect.
Attached files
radar.zip - 3.4 KB - 165 views
Quote from Racon :Sometimes a marker will persist on the radar screen when it shouldn't.

this is the same issue I had with Detect Monitor, on top of markers getting stuck the radar sometimes completely freezes for me
I don't know if that's an insim network issue (win firewall occasionally blocking insim packets?), bad implementation or both
I hope your version will be much more stable than that, good luck!
#3 - Racon
Quote from macafmac :edit: is this a server side script?

No, it's a local one - just for the person running it like LFSLazy or AONIO, rather than like JAR's server-side radar.
right, it took me a while to notice which section of the forum this thread is in
obviously to run the script I will need to get PIE first
#5 - Racon
Yep.

Quick recap for anyone who needs it: drop this script into a folder containing pie.exe, then from the commandline (or a batch file) run it with:
pie radar.php

Default port is 29999, more detailed instructions in the main PIE post Thumbs up
pie? Can you make a video on how to do this? I did not understand anything.
Quote from RealistAdam :pie? Can you make a video on how to do this? I did not understand anything.

I decided to give it a try, and it is explained relatively well in another post
https://www.lfs.net/forum/thread/98929-PHP7-Win---PIE-%28PHP%3B-InSim%3B-Easy%29---Windows-EXE-running-a-PHP-InSim-framewor

You basically download the PIEvX.X.X.zip. Open a command line from that folder, and type .\PIE.exe radar.php and it'll connect.

EDIT: You will of course need to have the radar.php file in the same directory as PIE.exe Big grin
Quote from kristofferandersen :I decided to give it a try, and it is explained relatively well in another post
https://www.lfs.net/forum/thread/98929-PHP7-Win---PIE-%28PHP%3B-InSim%3B-Easy%29---Windows-EXE-running-a-PHP-InSim-framewor

You basically download the PIEvX.X.X.zip. Open a command line from that folder, and type .\PIE.exe radar and it'll connect.

EDIT: You will of course need to have the radar.php file in the same directory as PIE.exe Big grin

Thank you. Is there a shorter way to do this? I will always have to open it when I enter the server. How can we add this to the lapper to save some time? Can we sync this with LFS Lapper?
Quote from RealistAdam :Thank you. Is there a shorter way to do this? I will always have to open it when I enter the server. How can we add this to the lapper to save some time? Can we sync this with LFS Lapper?

Yeah that can be done with a .bat script.

All you have to do is edit the file with the correct path to your pie directory.
Attached files
pie-script.zip - 177 B - 53 views
Quote from Racon :Radar:

This one is a Work In Progress! ....

I wasn't able to get this script to work.

Error message
Quote :PHP Warning: socket_write(): unable to write to socket [10053]: En etablert tilkobling ble avbrutt av programvaren p� vertsmaskinen.
in decoded on line 328
Failed TINY (3) (1-3-104-3 (h)): En etablert tilkobling ble avbrutt av programvaren p� vertsmaskinen.

Translated to "An established connection was terminated by the software on the host machine."
I don't know about the possibilities with PHP, but perhaps the error message should be displayed in english?

Another thought is the php version, i believe it said in the PIE post that it was for PHP7 - but my computer had 8.2.0 installed.
Quote from kristofferandersen :Yeah that can be done with a .bat script.

All you have to do is edit the file with the correct path to your pie directory.

Actually, I wanted to say this. I have lapper on my server. How can I make this work with Lapper?
Quote from kristofferandersen :I wasn't able to get this script to work.

Error message


Translated to "An established connection was terminated by the software on the host machine."
I don't know about the possibilities with PHP, but perhaps the error message should be displayed in english?

Another thought is the PHP version, i believe it said in the PIE post that it was for PHP7 - but my computer had 8.2.0 installed.

Thanks for helping explain things above.

If it doesn't connect at all, it might be that you have a password set for local InSim, you can check in the 'start host' section.

Your PHP installation isn't used for running PIE, so it's not a version thing. And I get my error messages in english, so my compiler is full of surprises Big grin

There is an update coming for PIE soon that can catch a disconnection more cleanly, and I'm still looking at a better way to detect when it's safe to start spamming buttons... but currently I'm receiving the packets that have to be drawn, I think, before it's safe to start. It's not every server, just when you have a lot of new mods to download in one place.

Definitely a WIP script, this one Wink
Quote from RealistAdam :Actually, I wanted to say this. I have lapper on my server. How can I make this work with Lapper?

PIE and Lapper are different things, they're not compatible.

This script is only for the local user, not a server. (It could be modified to connect to a server and draw this for everyone connected, but that's not what this one does)
I used it in 2 races and it worked flawlessly, didn't notice any hiccups and didn't have to restart it or anything, very good software
here's settings i use:
positioninterval 50
shortrange 45
longrange 100
panelbackground false
paneltop 0
panelleft 30
panelwidth 140
panelheight 140
dotwidth 4
dotheight 7

tested on 1920x1080 fullscreen
this could only be better with adjustable transparency
Thanks for the testing Thumbs up

You can't adjust the button transparency in InSim I'm afraid, but maybe the lighter colour would be better. (Replace ISB_DARK with ISB_LIGHT)

Note to me: Adam suggested in discord the option for adding usernames above the dots.
Hello. I detected an error. I used the radar on an online server. There were no problems. But after I closed the program, all the internet on my computer disappeared. I had to restart the modem. This is a big problem.
That's not something PIE could do even if it wanted to! It uses PHP's built-in socket functions to communicate over the internet, but it doesn't have any more power than that over your connection.

Radar (WIP!)
(18 posts, started )
FGED GREDG RDFGDR GSFDG