The online racing simulator
Searching in All forums
(63 results)
elkdanger
S2 licensed
No problems mate
elkdanger
S2 licensed
Hi there,

A query like that won't quite work unfortunately; this is because the pubstat service itself does not support selecting in that way; it doesn't even support searching by team name.

The way to get around it is to essentially split it into two separate queries, like:


var query = (from team in context.Teams select team).ToList();
var query2 = (from team in query where team.Name == "F1RST Racing" select team.Members);

Or this following sample may also work (I can't test it at the moment), but give it a shot:


// Almost the same as your query, but note the placement of the call to ToList()
var memberList = from team in context.Teams.ToList()
where team.Name == "F1RST Racing"
select team.Members;

The "work-around" in both samples above is the call to ToList(), which of course evaluates and executes the query before your extra query parameters are added in to the mix. The difference is after the ToList() call you are performing your query on the results in memory, rather than trying to send to the pubstat service which is why the error is occuring.

Let me know how you get on with that

Edit: Since you mentioned the racer sample from my first post, I seem to remember something funny going on with that sample and that actually may not be the correct code, because I don't think you can actually perform a select like that without evaluating the result set first. I'll have a look later and update the code with the correct version if it doesn't in fact work.
Last edited by elkdanger, .
elkdanger
S2 licensed
Quote from michele0676 :I need help guys.
Using "pst" action i receive:
157663430
4767155
33346
2045
506
468
363
2835
235
45
44
17
Italy
0
^1R^7eady^32^1R^7oll GT2 Racing
1251054488
631
FXR


There is a way to retrieve this only one ?
^1R^7eady^32^1R^7oll GT2 Racing

Not on it's own, no - you'll have to parse that response from LFS World to retrieve only the content that you need. All those elements are separated by line breaks I believe, so it should be a simple case of just splitting it into an array then indexing the element that contains the server name. If you let us know which language you're using, I'm sure someone here can help you out with some code.
elkdanger
S2 licensed
Quote from traxxion :Great! That did the trick! Many thanks for your quick reply!!

Hehe no probs; CHM help docs can be a bit of a pain sometimes
elkdanger
S2 licensed
Quote from traxxion :Thanks! I have one issue.. the library documentation file doesn't seem to work here (see attached). I have IE8 installed, might have anything to do with that? Any ideas?

Hmm not sure about this one. I've had something similar when trying to view .chm files from a network drive.

Also, have a look here and let me know if this works for you.
elkdanger
S2 licensed
No problem - let me know if you have any issues with the library :-)
elkdanger
S2 licensed
Hi

I've just released LinqToLfsWorld v1.0.2, which has a couple of minor bug fixes, support for Xml and Json serialization/deserialization and some helper constants for working with Car, Track ident and Steering type parameters.

You can grab it on the 1.0.2 release page.
elkdanger
S2 licensed
Hello,

I've written up a reference which shows all the queries you can make and what parameters you need; you can read it on my blog :-)

Also, if anyone is after some VB.Net samples of these queries, please ask and I'll sort some out.
Last edited by elkdanger, .
elkdanger
S2 licensed
Quote from dougie-lampkin :Nice work, just the thing I was looking for earlier

D/L'ing

Thanks bud. Let us know if you have any issues with the library
elkdanger
S2 licensed
Hello,

Just to let you know v1.0 of LinqToLfsWorld has now been released! You can grab it from the project homepage.

The interface has essentially stayed the same since the 0.8 release at the beggining of the month, but the main difference is the expression engine which is used to translate your initial queries into a pubstat query; it's a lot more expressive and is a lot less fickle to work with.

My blog still has some discussion on using the library, and this week I plan to write up a bit more about exactly what changes have gone on since the preview release, and some more code examples.

For now, enjoy using it and if there are any issues with the library please email me, contact me on my blog or raise an issue on the Codeplex project page.
Last edited by elkdanger, . Reason : Editing urls
elkdanger
S2 licensed
I'm interested, but just wondering how long a 50-lap race with that combo would take?
elkdanger
S2 licensed
Hi

Just to let you know I've updated my blog with a fairly lengthy post giving more details about the inner workings of LinqToLfsWorld, and more importantly how to use and configure it!

You can read it here
Last edited by elkdanger, . Reason : Editing urls
elkdanger
S2 licensed
Quote from DarkTimes :Wow, very nice work!

Cheers!
elkdanger
S2 licensed
Quote from BurnOut69 :Nice proof of concept with LINQ, I've been wanting to give it a go for some time now.

I'll try to test this when I have time - may be quite some time from now though.

No probs - thanks for having a look. And if you get a chance to have a go, let me know what you think
.Net - LinqToLfsWorld - a custom LINQ provider for LfsWorld
elkdanger
S2 licensed
Hello programmers,

I've just released the first full version of LinqToLfsWorld, which is a custom LINQ implementation used to query the LfsWorld Pubstat service through the .Net Framework.

If you're not quite sure what LINQ is or does, this is a good place to start. Essentially it allows you to write a Language INtegrated Query to transform one set of information into another (such as a url).

What this means is, using .Net and my library, you can query LfsWorld like so (in C#):

var query = from stats in LfsWorldContext.RacerStats
where stats.RacerName == "elkdanger"
select stats;

This query will produce the appropriate url to send to LfsWorld and retrieve the racer's stats for you.

All of the available actions have been implemented according to v1.4 of the pubstat service, and all of the required and optional parameters have been implemented.

Another goal of the project has been to implement a caching system where you can easily cache your responses to save hitting the pubstat service too often, without having to write special code yourself. It also prevents you from hitting the 5-second tarpit if you're not a premium member; of course you can switch this off if you are a premium member.

The library also allows you to use a custom configuration section to store all your LinqToLfsWorld settings in the application configuration file (app.config or web.config). Included with the release download (link below) is an example website which shows you how to use this configuration section.

For the moment, rather than pre-empt any questions that arise on how to use it, if you post here I can answer questions as they come up (assuming someone tries this out of course).

So here's the good stuff. The library comes as a DLL which you reference into your .Net project, and from there you can get access to the LfsWorldContext (the hub for making your queries). Also contained within the download archive is full class library documentation.

You can grab the library on the LinqToLfsWorld project site. Included with the download is an example website which shows you how to use the library to perform a hosts query and how to use the custom configuration section. All the source code is available from the Source Code tab on that site too. I'm also going to provide some code samples and issues with the library on my blog at stevescodingblog.co.uk over the next week or so.

Here's the code from the sample website included which gives you an idea of what you can do with it:

using (LfsWorldContext context = new LfsWorldContext())
{

// Make sure caching is enabled
context.CachingEnabled = true;

// Handle any "request made" events
context.RequestMade += new LfsRequestHandler(context_RequestMade);

/* Make an initial query to the hosts action */
var query = from host in context.Hosts
orderby host.RacerCount descending
select new
{
host.RacerCount,
host.TrackName,
host.HostName,
host.QualifyingMinutes,
host.Laps
};

// Refine further - only show active hosts
var list = query.Where(host => host.RacerCount > 0).ToList();

// Bind to the grid view
LfsHostsGridView.DataSource = list;
LfsHostsGridView.DataBind();
}

Links
Last edited by elkdanger, . Reason : Updated some urls
elkdanger
S2 licensed
Additionally, would it be possible for us to filter the teams action too? It's a similar situation to the hosts issue raised above, where I want to display information about my team (as entered into on LfsWorld) but I have to transfer information about all the teams (currently there are 889) just to get to mine. Possibly a filter on the Id or the name.

Would save bandwidth on both ends
elkdanger
S2 licensed
Quote from OldBloke :Am I right in thinking that to display a simple 'server status' and/or 'racers on server' page requires pulling in the data for every server and then discard the unwanted stuff?

If I am correct could I request the addition of:

?action=host&hostname=xxxxx

I second that request. What would also be good is if we can filter the host name irrespective of the colour options that are placed inside the hostname text.
elkdanger
S2 licensed
Ok I've sorted my initial problem. I went back to using the BackgroundWorker, and created a separate system for so-called 'one shot messages', for things suchs as a player crossing the start/finish line, stuff like that.

I've come across another problem however. I'm tracking each player's lap times and split times during a race, but when I come to display it on the LCD, I'm only interested in displaying information for the car that the camera is currently looking at. Any ideas on how to retrieve the player id that the camera is currently showing? I've tried handling the RaceTrackPlayerCameraChange but this doesn't seem to work well.
elkdanger
S2 licensed
Quote from BurnOut69 :Try using your own thread and setting its priority to BelowNormal. That made the trick for me

Hmm same problem. I think part of my problem is in the code which manages the LCD, I use Thread.Sleep() with an interval of 1ms after sending a command (which I need to, really). Is there any way around this? I wouldn't have thought a delay of 1ms would screw things up this much
LFSLib woes
elkdanger
S2 licensed
Hey,

I'm using C# and LFSLib to get information out of LFS to display on an LCD display (speed, gears, fuel, etc), but the problem is when using Outgauge; the OutgaugeHandler event seems to be getting called with a 15 second-or-so delay.

In my OutgaugeHandler I call a method which basically formats some text and sends it to the LCD, and I can get around the above problem somewhat if I multithread the text writing operation using the BackgroundWorker object but I can only send data when the BackgroundWorker's IsBusy property is false. It means the application often misses one-shot events, such as the player crossing the start/finish line. If I wait for the busy flag to go low, obviously the app slows and affects the performance of LFS considerably. I've tried swapping out the BackgroundWorker and creating my own threads, but this has the same effect (in fact, there's a longer delay before Outgauge starts sending me event notifications).

I've also tried processing messages to be sent to the LCD in a queue (which is processed in a separate thread) but this doesn't help (I get the long delay).

I've had a look through the LFSLib source and can't see anything unusual with it's multithreading, so it's obviously my app. The problem feels like it's to do with threading priorities, but i'm not sure what else to do.

Anyone else come across something similar?
elkdanger
S2 licensed
Quote from Becky Rose :Rubbish. People dont buy games for high system requirements. They buy games because the screenshots look pretty / the demo played well and their computer is ABOVE the system requirements. DX9 gives a programmer some tools to produce better graphics, but DX9 is in itself not a selling point.

@Tweaker: DX9 wont magically make the game run faster. Although with the framerates it knocks out on my modern system it's already substantically faster than the eye can see except at a race start. If you want DX for faster framerates on your cutting edge PC - do you realise the human eye wont spot a difference over around 50-60 fps anyway? (neither will most monitors for that matter).



I've noticed that PC playing games junkies seem hell bent on believing that some things are not possible without DX9/10 whatever, like "Rain needs DX10" etc. This is simply not true. Later DX versions can help to create some nice effects or can make nice effects easier to produce, but whether an effect looks good or not has nothing at all to do with which version of DX is used.

I still use DX7 most of the time I do 3D [and OpenGL] and I have produced games with some stunning graphics and special effects, I used DX8.1 for a special effects bonanza of a game once - then looked at it and realised that everything in it I could have done in DX7 and had wider compatibility. Ironically the game flopped because of a graphics card compatibility issue...

Sure my stuff isn't a patch on LFS anyway, LFS is a whole new league, but what i'm saying here is that as players we should completely ignore what version of DX is used to give us pretty or ugly screenshots, and just assess the screenshot on its own merits.

You can do great stuff in low DX versions, and you can do appalling stuff with high DX versions.

This is pretty much what I came in here to post - totally agree.
elkdanger
S2 licensed
Quote from franky500 :I will change it to 22100 for you as default now. Its possible its a coincidence but we can only hope

It didn't work I'm afraid.

My ISP got back to me last night. They do indeed shape traffic but for which port range I don't know. It seems like quite a broad range however. They gave me a couple of ports to try which they have specifically opened up for LFS; I tried these with our server and they work absolutely fine (I've set them back now) - it's the fastest i've ever seen LFS connect to anything, and this was bang in the middle of peak-time.

The problem is, it doesn't mean anything unless other servers use these ports aswell, or the port range for this is standardized so that ISP's can open up this specific range. If not, I'm going to have to look at changing my ISP so that I can play this game
elkdanger
S2 licensed
Quote from franky500 :I will change it to 22100 for you as default now. Its possible its a coincidence but we can only hope

Thank you I shall give it a trial run when I get home tonight.
elkdanger
S2 licensed
Quote from franky500 :it still makes no sense. if you can connect to redline servers ect no problems then i dont see why it should stop you joining your own.

My thoughts exactly. What ports are their servers on?

Indidentally, I changed the port on our server to 22100 as a test and restarted - i'm able to connect to our server OK now, although I'm unable to determine yet whether or not this is coincidence (being 11:30 at night) but it's something.

I also realise that I might have been outside my rights as a customer to change the port number; apologies if I was, i've changed it back now.
elkdanger
S2 licensed
Quote from mr_x :I'm having exactly the same problems as Widdowmaker, it also started happening after the master server move, and I've notcied A LOT more people disconnecting because of time-outs on servers.

I am with Pipex on their 2mb service, I don't have any problems with them at all everything works fine (DoD:S, rFactor, RACE) apart from LFS.

I've read through all this thread and what Widdowmaker is saying is pretty much exactly the same as me, apart from I haven't contacted the ISP yet.

EDIT: I also get alot of 'no reply' on the server list alot of the time... every 1 in 3 (ish) servers comes up as a no reply.

This is the problem I've been having, although I've had it since I changed my ISP to an ADSL provider (a big name company). I've contacted them, but not hopeful of it being resolved.
FGED GREDG RDFGDR GSFDG