The online racing simulator
Searching in All forums
(9 results)
Better pit stop
NoNder
S2 licensed
Hello. I got a few ideas. Sometimes race is won in pit and everything depend on pit stop.

1) It will be nice if we can have little more detailed settings on what should be repaired - in F12/new pitstop panel.

2) See estimated time of repair for every part - in F12/new pitstop panel.

3) Usually, All tyres are changed in same time but in lfs it is - changing first tyre -> second -> third -> fourth. This will really faster.
NoNder
S2 licensed
When i first time played lfs and clicked on show server list it showed me something about packets (i think big packets dialog) but it is not doing now so it is not problem.

Problem is that i can't connect to my favourite server (TC cruise server). Server always simply refuses my connection. So i installed B7 but i still can't connect and server doesn't want my connection. Other servers are ok.
NoNder
S2 licensed
It will be nice if u show it. Is not Qt framework simple c++ with forms creator ?
NoNder
S2 licensed
Yeah, That's it. Thank you. I am playing with Qt framework now.
I am glad that here is some experienced programmer.
NoNder
S2 licensed
Thank you. I think It works. Another problem is that there is delay. I don't know why (Is it because i stop console output when i press slider?). Do you know about some really simple form framework where I can output these variables ?

#include <stdlib.h>
#include <iostream>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
#include <winsock.h>
#include <bitset>

#define MYPORT 55321 // the port users will be connecting to

using namespace std;

typedef struct
{
unsigned int Time; // time in milliseconds (to check order)

char Car[4]; // Car name
unsigned short Flags; // OG_FLAGS (see below)
unsigned char Gear; // Reverse:0, Neutral:1, First:2...
unsigned char PLID; // Unique ID of viewed player (0 = none)
float Speed; // M/S
float RPM; // RPM
float Turbo; // BAR
float EngTemp; // C
float Fuel; // 0 to 1
float OilPressure; // BAR
float OilTemp; // C
unsigned DashLights; // Dash lights available (see DL_x below)
unsigned ShowLights; // Dash lights currently switched on
float Throttle; // 0 to 1
float Brake; // 0 to 1
float Clutch; // 0 to 1
char Display1[16]; // Usually Fuel
char Display2[16]; // Usually Settings
int ID;
} __attribute__ ((packed)) OutGaugePacket;

int main(void)
{
int sockfd; // let's make a file descriptor
OutGaugePacket og_packet; // let's create an packet
struct sockaddr_in my_addr; // my address information
struct sockaddr_in their_addr; // connector's address information
int addr_len;
int numbytes;
WORD wVersionRequested = MAKEWORD(1,1);
WSADATA data;
memset(&(og_packet),'\0',96); // zero out the struct

cout << "a" << endl;

if (WSAStartup(wVersionRequested, &data) != 0)
{
perror("first");
exit(1);
}

cout << "a" << endl;

//let's create the socket
if ((sockfd = socket(PF_INET, SOCK_DGRAM, 0)) == -1) {
perror("socket");
exit(1);
}

cout << "a" << endl;

// setting up our contact information here
my_addr.sin_family = AF_INET;
my_addr.sin_port = htons(MYPORT); // short, network byte order
my_addr.sin_addr.s_addr = INADDR_ANY; // automatically fill with my IP
memset(&(my_addr.sin_zero), '\0', 8); // zero the rest of the struct

cout << "a" << endl;

//binding our socket to a port and address
if (bind(sockfd, (struct sockaddr *)&my_addr, sizeof(struct sockaddr)) == -1) {
perror("bind");
exit(1);
}
addr_len = sizeof(struct sockaddr);


for (;;){
// receiving the goodies
if ((numbytes=recvfrom(sockfd, (char *)&og_packet, sizeof(OutGaugePacket) , 0, (struct sockaddr *)&their_addr, &addr_len)) == -1) {
perror("recvfrom");
exit(1);
}

cout << "Time " << og_packet.Time << endl;
cout << "Car " << og_packet.Car << endl;
cout << "Gear " << int(og_packet.Gear) << endl;
cout << "PLID " << int(og_packet.PLID) << endl;
cout << "Speed " << og_packet.Speed << endl;
cout << "RPM " << og_packet.RPM << endl;
cout << "Turbo " << og_packet.Turbo << endl;
cout << "EngTemp " << og_packet.EngTemp << endl;
cout << "Fuel " << og_packet.Fuel << endl;
cout << "OilPressure " << og_packet.OilPressure << endl;
cout << "OilTemp " << og_packet.OilTemp << endl;
cout << "DashLights " << og_packet.DashLights << endl;
cout << "ShowLights " << og_packet.ShowLights << endl;
cout << bitset<CHAR_BIT>( og_packet.ShowLights ) << endl; // Yeah i know - only 8 bits...
cout << "Throttle " << og_packet.Throttle << endl;
cout << "Brake " << og_packet.Brake << endl;
cout << "Clutch " << og_packet.Clutch << endl;
cout << "Display1 " << og_packet.Display1 << endl;
cout << "Display2 " << og_packet.Display2 << endl;
cout << "ID " << og_packet.ID << endl;
}

closesocket(sockfd);
WSACleanup();

return 0;
}

OutGauge Mode 2
OutGauge Delay 1
OutGauge IP 127.0.0.1
OutGauge Port 55321
OutGauge ID 2

Reading outgauge indicators bits
NoNder
S2 licensed
Hello. I have problem with reading indicators bits. Other values are OK. I am total noob in C++ so i edited some codes from forum. Everything is ok but i still cant read informations from Spare3. std::cout << bits[X] << std::endl; is always 0

#include <stdlib.h>
#include <iostream>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
#include <winsock.h>
#include <bitset>

#define HTONL(n) (((((unsigned long)(n) & 0xFF)) << 24) | \
((((unsigned long)(n) & 0xFF00)) << 8) | \
((((unsigned long)(n) & 0xFF0000)) >> 8) | \
((((unsigned long)(n) & 0xFF000000)) >> 24))

#define NTOHL(n) (((((unsigned long)(n) & 0xFF)) << 24) | \
((((unsigned long)(n) & 0xFF00)) << 8) | \
((((unsigned long)(n) & 0xFF0000)) >> 8) | \
((((unsigned long)(n) & 0xFF000000)) >> 24))


#define MYPORT 55321 // the port users will be connecting to

using namespace std;

typedef struct
{
unsigned int Time; // time in milliseconds (to check order)

char Car [4]; // Car name
unsigned short Flags; // OG_FLAGS (see below)
unsigned char Gear; // Reverse:0, Neutral:1, First:2...
float Speed; // M/S
float SpareB;
float RPM; // RPM
float Turbo; // BAR
float EngTemp; // C
float Fuel; // 0 to 1
float OilPress; // BAR
float Spare1;
unsigned Spare2;
unsigned Spare3;
float Throttle; // 0 to 1
float Brake; // 0 to 1
float Clutch; // 0 to 1
char Display1[16]; // Usually Fuel
char Display2[16]; // Usually Settings
int ID;
} __attribute__ ((packed)) OutGaugePacket;


float floatSwap (float value)
{

char raw_speed[4];
raw_speed[0]= ((char*)&value)[ 3 ];
raw_speed[1]= ((char*)&value)[ 2 ];
raw_speed[2]= ((char*)&value)[ 1 ];
raw_speed[3]= ((char*)&value)[ 0 ];

float speed = reinterpret_cast<float&>(raw_speed);
return speed;
}

int main(void)
{
int sockfd; // let's make a file descriptor
OutGaugePacket og_packet; // let's create an packet
struct sockaddr_in my_addr; // my address information
struct sockaddr_in their_addr; // connector's address information
int addr_len;
int numbytes;
WORD wVersionRequested = MAKEWORD(1,1);
WSADATA data;
memset(&(og_packet),'\0',96); // zero out the struct

cout << "a" << endl;

if (WSAStartup(wVersionRequested, &data) != 0)
{
perror("first");
exit(1);
}

cout << "a" << endl;

//let's create the socket
if ((sockfd = socket(PF_INET, SOCK_DGRAM, 0)) == -1) {
perror("socket");
exit(1);
}

cout << "a" << endl;

// setting up our contact information here
my_addr.sin_family = AF_INET;
my_addr.sin_port = htons(MYPORT); // short, network byte order
my_addr.sin_addr.s_addr = INADDR_ANY; // automatically fill with my IP
memset(&(my_addr.sin_zero), '\0', 8); // zero the rest of the struct

cout << "a" << endl;

//binding our socket to a port and address
if (bind(sockfd, (struct sockaddr *)&my_addr, sizeof(struct sockaddr)) == -1) {
perror("bind");
exit(1);
}
addr_len = sizeof(struct sockaddr);


for (;;){
// receiving the goodies
if ((numbytes=recvfrom(sockfd, (char *)&og_packet, sizeof(OutGaugePacket) , 0, (struct sockaddr *)&their_addr, &addr_len)) == -1) {
perror("recvfrom");
exit(1);
}

cout << "Time" << NTOHL(og_packet.Time) << endl;
cout << "Car" << og_packet.Car << endl;
cout << "Gear" << og_packet.Gear-1 << endl;
cout << "SpareB" << og_packet.SpareB << endl;
cout << "Speed" << floatSwap(og_packet.Speed)*3.6 << endl;
cout << "RPM" << floatSwap(og_packet.RPM) << endl;
cout << "Turbo" << floatSwap(og_packet.Turbo) << endl;
cout << "EngTemp" << floatSwap(og_packet.EngTemp) << endl;
cout << "Fuel" << floatSwap(og_packet.Fuel) << endl;
cout << "OilPress" << floatSwap(og_packet.OilPress) << endl;
cout << "Spare1" << floatSwap(og_packet.Spare1) << endl;
cout << "Spare2" << floatSwap(og_packet.Spare2) << endl;
cout << "Spare3" << floatSwap(og_packet.Spare3) << endl;
std::bitset<sizeof(int)> bits(og_packet.Spare3);
std::cout << bits[0] << std::endl;
std::cout << bits[1] << std::endl;
std::cout << bits[2] << std::endl;
std::cout << bits[3] << std::endl;
std::cout << bits[4] << std::endl;
std::cout << bits[5] << std::endl;
std::cout << bits[6] << std::endl;
std::cout << bits[7] << std::endl;
std::cout << bits[8] << std::endl;
cout << "Throttle" << (floatSwap(og_packet.Throttle) * 100) << endl;
cout << "Brake" << (floatSwap(og_packet.Brake)* 100) << endl;
cout << "Clutch" << (floatSwap(og_packet.Clutch)* 100) << endl;
cout << "Display1" << og_packet.Display1 << endl;
cout << "Display2" << og_packet.Display2 << endl;
cout << "ID" << NTOHL(og_packet.ID) << endl;
}

closesocket(sockfd);
WSACleanup();

return 0;
}

Last edited by NoNder, .
Complete outgauge tutorial
NoNder
S2 licensed
Hello. I am learning something about OutGauge but networking/chip programming is very difficult for me. Youtube is now full of homemade gauges and indicators. It can be very nice if someone create tutorial for beginners how to make working all gauges and all indicators. I don't mean only dll. I mean something like:

- Buy this: ATMega XY, Servo XY 3x, Resistor XY, LED XY...
- Scheme for it
- Working EXE for these components.

So player needs only define insim port in lfs and run program and calibrate servos for his instruments.

I will be really thankfull and other players too if someone write it. It's my LFS dream

Thank you
Last edited by NoNder, .
Better mirror system
NoNder
S2 licensed
It can be nice to see my own car in mirrors. Its very hard to know where is end of my vehicle. Its necessity.

Editing mirrors rotation is nice idea but its not very needed.
NoNder
S2 licensed
FGED GREDG RDFGDR GSFDG