The online racing simulator
Searching in All forums
(363 results)
T3charmy
S3 licensed
Since we're working on the controller, Would it be possible we could add something for the steering axis similar to what you can do with keyboard(steer rate/return rate) for those of us playing with handheld controllers such as PS4, Xbox controllers.

Edit: Xbox one controller doesn't get the Accel/Brake settings correctly. Mine are reporting as combined, and the default setting is separate. Changing to combined causes the correct axis to be selected, but invert is set to 1 by default, which as bobloblaw is the opposite of what you'd expect. All other settings seem reasonable

Also something that's slightly annoying, When running Win 10 technical preview, and they release a new update it seems to wipe out my license from LFS.

Edit 2: and if possible on top of the first point(which at that alone would be very much appreciated!), possibly add it to where we are able to adjust the multiplier/sensitivity for all axes not just the steering. kind of like how Mouse X and Mouse Y work where you're able to.

Another thing that could be useful would be to map the right joystick to being the look heading, but being able to set a limit for it, like all the way left is 90, all the way right is 90, and pressing the joystick down would be look behind
Last edited by T3charmy, .
T3charmy
S3 licensed
Yikes. It's yet another hell storm out there right now. Under a tornado warning. I'll let you guys know how things go.

Edit: Ended up going more North of me. Had some crazy winds, thunderstorms, and some hail. Tornados did touch down to my West but they were about an hour or so drive away. It was definitely scary I'll tell you that.
Last edited by T3charmy, .
Reposting these notes that are updated for use in PRISM version 0.5.0.7
T3charmy
S3 licensed
New version released:

Reposting these notes that have been updated for new version of PRISM

Notes:

Due to some LFS limitations, if you want to actually send any translations on connect(or in my case I had an account class that was spawned on Client Connect)
  1. on your __construct of your plugin do this

    <?php 
            $this
    ->setTranslationSettings('plugin_name'); # if your default fallback language is English(en)
            
    $this->setTranslationSettings('plugin_name'LANG_FR); # if you'd rather specify a different fallback
            # Translations will fail if this isn't ran.
    ?>

  2. Your fallback language is the language the translation engine will go to if the users language is missing.
  3. Due to some limitations of implementation in LFS, if you want to use translations, you'll need to do stuff you would normally do in NCN, in an NCI packet.

    <?php 
        
    public function onClientConnect(IS_NCI $NCI)
        {
            
    $NCN $this->getClientByUCID($NCI->UCID);
            
    #Continue on with rest of NCN packet the way you would in the IS_NCN packet
    ?>

  4. Example usage(These can not be used in NCN or any packets before the NCI connection):

    <?php 
        
    public function onPlayerJoin(IS_NPL $NPL)
        {
            
    $client $this->getClientByUCID($NPL->UCID);
            
    $this->translatePrivateMessage($NPL->UCID'User_Welcome', array($client->PName));
            
    $this->translateGlobalMessage('Global_Message'); # You can also specify an argument array here aswell
        
    }
    ?>

  5. File setup:

    ; PRISM/data/langs/plugin_name/LANG_EN.ini
    ; Might return this to the old file naming convention
    ; which was /PRISM/data/langs/plugin_name/en.ini
    Global_Message = "^7This is a global message!"
    User_Welcome = "^7Hello, %s^7!"

    ; PRISM/data/langs/plugin_name/LANG_FR.ini
    Global_Message = "^7Ce est un message global!"
    User_Welcome = "^7Bonjour, %s^7!"

Last edited by T3charmy, .
T3charmy
S3 licensed
And yet another minor update pushed that fixes getPlayerByUName not working as UName was not defined in Player Handler. As usual download can be found here: https://www.lfs.net/forum/post/1903571#post1903571
T3charmy
S3 licensed
I suppose it could be done that way. Guess I can use that as a work around for now Tongue
IS_JRR causes IS_CRS, options?
T3charmy
S3 licensed
Question(Mainly for Scawen, but if anyone has any input please do tell!), is there anyway that we can have a user who is currently on track re-spawn with IS_JRR packet without having the packet cause an IS_CRS packet to be sent? Trying to add a !flip(Puts them back on their wheels without repairing the damage) command to my server, with the JRRAction JRR_RESET_NO_REPAIR (5), but this is causing my insim to do other things with the user as it also triggers a IS_CRS.

Just for giggles I tried doing a JRRAction of 6, and of course that doesn't even reset the car at all(not that I expected it to).
T3charmy
S3 licensed
Quote from Flame CZE :It's still not perfect, for instance when you turn while towing, the towed car keeps the same angle and distance, not how you'd expect a towed car to be following... if you know what I mean. I'll see if I can code it so it works as if the car was a trailer, so it'd "bend" as you turn. Interesting challenge Big grin

I'm interested to see what you come up with. Smile
T3charmy
S3 licensed
Quote from Flame CZE :With a slight modification in onMCI, the towed car now follows the towing car behind it. It looks choppy but interesting Big grin

Yea, if you want it to be more smooth, you could increase the PPS in PRISM's host config. I believe 25PPS is the max. Also I probably broke it when I was last min rewriting it to clean it up, and get rid of useless code... Hm. I will have to look at PRISM's core. UName should be defined in Player Handler

Also Nice! I was gonna make it follow behind, but my math skills were a little rough, so I just threw it together this way. I think I would like following behind better honestly... but increasing PPS may cause the car to spawn inside you... not sure.

Edit: Fixed this(getPlayerbyUName) in 0.5.0.6 of PRISM which I will release later today.
Last edited by T3charmy, .
T3charmy
S3 licensed
Quote from Scawen :I think to convert from MCI heading to ObjectInfo heading you do this:

- Shift it right 8 bits (i.e. divide by 256) so it has 256 values (0 to 255).
- Add 128 (i.e. rotate by 180 degrees) to align it with the ObjectInfo headings.

Yep. that worked great. Sadly, what I was playing with can never be more than a proof of concept, but never the less, it's kinda cool I'm really glad to finally have this packet added ... and as much as other might not like to hear this. It really has great potential on cruise servers.

For anyone interested here is the PRISM plugin I ended up with:
Spoiler - click to reveal

<?php 
php
class example extends Plugins
{
    
// Set our URL, Name, Author, Version, Description
    
const URL '';
    const 
NAME 'JRRTesting';
    const 
AUTHOR 'T3charmy';
                    
#Year.Month.Day.Time in 24 hour (UTC)
    
const VERSION '16.2.18.0132';
    const 
DESCRIPTION 'Proof of Concept JRR spawning';
    
    protected 
$location = array();
    protected 
$tows = array();
    protected 
$slabs = array();

    public function 
__construct() {
        
$this->registerPacket('OnPlayerPit'ISP_PLP);
        
$this->registerPacket('onPlayerLeave'ISP_PLL);
        
$this->registerPacket('onMCI'ISP_MCI);
        
        
$this->registerSayCommand('tow''cmdTow''');
    }
    
    public function 
OnPlayerPit(IS_PLP $PLP)
    {
        unset(
$this->tows[$PLP->PLID]);
    }

    public function 
OnPlayerLeave(IS_PLL $PLL)
    {
        unset(
$this->tows[$PLL->PLID]);
    }
    
    public function 
onMCI(IS_MCI $MCI)
    {
        foreach (
$MCI->Info as $CompCar) {
            
$towby array_search($CompCar->PLID$this->tows); # to check for who is towing said user
            
            
$X = ($CompCar->4096);
            
$Y = ($CompCar->4096);
            
$Z = ($CompCar->65536);
            
$Heading $CompCar->Heading;
            
console($Heading);
            
$this->location[$CompCar->PLID] = array('X' => $X'Y' => $Y'Z' => $Z'Heading' => $Heading);
            
console("{$CompCar->PLID} : towed by: $towby");
            if(
$towby !== false){
                
$towLoc $this->location[$towby];
                
$newCarLoc = new ObjectInfo();
                
$newCarLoc->X($towLoc['X']);
                
$newCarLoc->Y($towLoc['Y']);
                
$newCarLoc->Z($towLoc['Z'] + 4);
                
$newCarLoc->Flags(128);
                
$newCarLoc->Index(0);
                
$newHeading = ($towLoc['Heading'] / 256) + 128;
                if(
$newHeading >= 256) {
                    
$newHeading -= 256;
                } elseif (
$newHeading 0) {
                    
$newHeading += 256;
                }
                
$newCarLoc->Heading($newHeading);
                
$deleted false;
                if(isset(
$this->slabs[$towby])){
                    if(
$this->slabs[$towby]->x() !== ($towLoc['X'] / 16)) {
                        
IS_AXM()->PMOAction(PMO_DEL_OBJECTS)->Info(array($this->slabs[$towby]))->Send();
                        
$deleted true;
                        
console('deleted');
                    }
                }
                
$this->slabs[$towby] = new LayoutObject(($towLoc['X'] / 16), ($towLoc['Y'] / 16), $towLoc['Z'] + 2LayoutObject::$OBJ_REAL_OBJECT, (90 $towLoc['Heading']/32768 180), LayoutObject::$AXO_CONCRETE_SLAB, ($CompCar->PLID 4));
                if(
$deleted){
                    
IS_AXM()->PMOAction(PMO_ADD_OBJECTS)->Info(array($this->slabs[$towby]))->Send();
                }
                
IS_JRR()->PLID($CompCar->PLID)->UCID(0)->JRRAction(JRR_RESET_NO_REPAIR)->StartPos($newCarLoc)->Send();
                
//Need to add a concrete slab above "towing" user using $location 1 and remove slab at location 2
            
}
        }
    }
    
    public function 
cmdTow($cmd$ucid)  
    {
        
$strcsv str_getcsv($cmd' ');
        list(
$cmd$towing) = $strcsv;

        
$CurrentClient $this-getPlayerByUCID($ucid);
        
$TargetClient $this-getPlayerByUName($towing);
        
$this->tows[$CurrentClient->PLID] = $TargetClient->PLID;
        
console("create tow {$CurrentClient->PLID} :: {$TargetClient->PLID}");
    }
    

}
?>

Last edited by T3charmy, .
T3charmy
S3 licensed
Quote from saitch76 :£12 is waaaay too expansive for a single track

Scawen has addressed this multiple times..

Quote from Scawen : Although S3 content is already being developed, we cannot provide a guarantee that it will be released. Please only buy an S3 license upgrade if you feel it's worth it to use Rockingham right now. We will be continuing to work on S3 after Christmas!

Quote from Scawen :I understand what you are saying, but the alternative is to wait and not release it until something else is ready. We think most people would rather have the option.

From now on, we can work on S3 content and release it immediately.

We do intend to add more to the S3 license, though we cannot guarantee it. If anyone prefers to wait for our content updates before they buy a license upgrade, that is a reasonable decision.

T3charmy
S3 licensed
Quote from cargame.nl :Well rougly I came to this;


$JRR_heading = round($MCI['direction'] / 182);


Probably needs to be more precise but JRR cannot be very precise, because 'only' 256 steps. So this is a problem if you want to use JRR for very precise operations.

256 may be precise enough. we will find out.I mean it's not a super big deal that they're EXACTLY the same, but roughly the same would be nice. I think I tried dividing by 182, but did not round it... so that may be why it didn't work. will try it when I get home.
T3charmy
S3 licensed
Quote from cargame.nl :As far as I can understand JRR uses the lyt heading;

https://www.lfs.net/programmer/lyt

NOTE2 :
-------
Heading represents 360 degrees in 256 values.

Heading = (heading_in_degrees + 180) * 256 / 360

128 : heading of zero
192 : heading of 90 degrees
0 : heading of 180 degrees
64 : heading of -90 degrees

While MCI has its own;

# direction of forward axis : 0 = world y direction, 32768 = 180 deg


So some sort of conversion formula needs to be used.

Hmm, ok, when I get home I will look closer. it may be a matter of I'm rotating too much(May only need to use 90 instead of 180. don't know. will find out in about an hour
T3charmy
S3 licensed
Question, was playing with the new JRR packet.

Right now I'm spawning a concrete slab below where I spawn them so that I am able to spawn them in the air(since ground checking is enforced), but I am currently trying to implement it so that a car can "hover" above another car(the slab is no big deal, as it prevents the car from falling on top of the other car which when that happens they intersect and go flying).

But my problem is. I can't seem to get the heading to match the heading of the car it's hovering above. Is there some weird math that is being done? from what LFS outputs with MCI, and what JRR takes in?

I tried the existing code we used in another PRISM plugin that takes the data and uses it to place a chalk arrow on the ground... and that still seems to be off...

here's the code from the plugin for layout objects, should the same code work? if so, something might be bugged either in PRISM's handling of the data or the way LFS handles it(or I'm misunderstanding how it should work).

<?php 
#Code from CompCar/MCI
$x $Info->X/65536;
$y $Info->Y/65536;
$obj = new LayoutObject($x$y, ($Info->Z/65536) + 3LayoutObject::$OBJ_REAL_OBJECT180 $Info->Heading/32768 180LayoutObject::$AXO_CONCRETE_SLAB, ($Info->PLID 4));

$AXM = new IS_AXM();
$AXM->PMOAction(PMO_ADD_OBJECTS)->Info(array($obj))->send();
#JRR X,Y,Z code is slightly different($x & $y divided by 4096 instead of 65536)
#I'd include it but it's on my other computer...
#but no matter what I try for the heading, I can't get it to match up.
?>

Last edited by T3charmy, .
T3charmy
S3 licensed
0.5.0.4 is out now. Fixes some issues when PRISM is ran in single player.

Edit 2/17 @ 21:50 GMT: 0.5.0.5 is released, adding ability to colorize the terminal thanks to cargame.nl. as well as fix another issue with PHP 7 compatibility & a minor change to the translation engine(how it's handled when requested text is missing from the user's language).
Last edited by T3charmy, .
T3charmy
S3 licensed
Might be an issue with PHP 7 and TCP then. Regardless my fix works in both 5.6 and 7.0
T3charmy
S3 licensed
I believe the flag would be ISF_LOCAL, though not 100% sure. I will test later today and find out for sure.

Edit: Yep: from prism_packets.php:

<?php 
define
('ISF_LOCAL',     4);         // bit  2 : guest or single player
?>

So try adding 4 to what ever the total of your flags is in hosts.ini, and see if it still causes errors

Edit: Added checking on my github repo, will do a merge later today and release an update.
Last edited by T3charmy, .
T3charmy
S3 licensed
Interesting. I will take a look.
T3charmy
S3 licensed
@Dygear but you must have overlooked one. (Fixed now as of 0.5.0.2)
T3charmy
S3 licensed
Quote from Dygear :T3 your my hero!

I try. Hopefully everything I've done today is up to par. Big grin
T3charmy
S3 licensed
Hmm, was testing PRISM, and was having issues when connecting to a local server over a TCP connection, but worked ok over UDP, what is everyone else using?

Edit: Fixed PHP 7 compatibility issues with command callbacks

Edit 2: Version 0.5.0.2 is now available for download.

Edit 3: I think I've narrowed the crashing with TCP problem to this function in prism_hosts.php

<?php 
    
public function read(&$peerInfo)
    {
        
$this->lastReadTime time();
        return 
stream_socket_recvfrom($this->socketSTREAM_READ_BYTES0$peerInfo);
    }
?>

Edit 4: when I do

<?php 
var_dump
(fread($this->socketSTREAM_READ_BYTES));
?>

I get this as the output in the console:

string(20) " 0.6M S2 "

Edit 5: seems to be running fine if I replace the existing function with fread I will release this as another update here shortly.

Edit 6: Version 0.5.0.3 is now released, and I am now off to sleep!
Last edited by T3charmy, .
T3charmy
S3 licensed
Let's go for one more bug fix today! Just pushed a commit on my repo that should fix this issue.

I want to do some testing before I merge it. if anyone wants to try these changes themselves here is what changed.
T3charmy
S3 licensed
Stream is running really great now! no more skipping like it was in the test!
T3charmy
S3 licensed
Hate replying to old threads. but is there anyway to reduce sensitivity? Hate when the smallest movement of the joystick results in the wheel cranking to the either side. LFS detects my controller without any additional software, and if I recall inputmapper didn't help with the sensitivity last time I tried setting it up.
T3charmy
S3 licensed
No worries. All is good! Smile

Edit: Released 0.5.0.1 with minor changes(documentation updates, and addition of Rockingham path files)
Last edited by T3charmy, .
T3charmy
S3 licensed
Quote from cargame.nl :Packet IS_SLC is missing UCID in the unpack

It should be;
const UNPACK = 'CSize/CType/CReqI/CUCID/a4CName';


And this is the only minor remark (not using SLC at the moment but just in case for someone who needs to). Excellent job all together.

Ah good catch! I will fix that and put out a new update

Edit: Just double checked. it appears to be there?
Last edited by T3charmy, .
FGED GREDG RDFGDR GSFDG