The online racing simulator
Thanks for the response, it helped a bit.

I did manage to get this running at least, though I needed a few more steps than were in your readme - if others are going to try this in my situation, then it may be worth mentioning them:

I am running this on Windows, and have no experience of node.js or nmp.
I had to run 'nmp link' in the xi4n folder.
I also had to run 'npm install <module>' as I had several error messages reporting missing modules. I imagine this was due to a fresh install of node.js, though I'm not at all sure.

I haven't looked at the code yet. I don't know a great deal about JS either, but it looks interesting.
Quote from misiek08 :The TV plugins looks nice. I didn't tried the livemap yet, but it can be best thing for 16h race this year. I'm going to host it if organizers will approve it!

There are 2 versions at the moment and they both work in very different ways.

The first version, which I videoed is very, very dumb. The second version I've been working with on and off is in the tv.js-priority branch on github and works by scoring - https://github.com/theangryang ... s-priority/plugins/tv2.js

If you're interested the current revision will/is using something like this to score:
https://docs.google.com/spread ... JNWFN2clZXRUtvUXRFX05BaXc

A lot of stuff isn't in there yet, like distances.

Quote from misiek08 :TV plugin doesn't know what VIEW_CAM and VIEW_DRIVER is. I don't know why, but it don't read exports.VIEW_ variables.

You using this.insim.VIEW_CAM? Because of how the whole nodejs require stuff works, it's all namespaced and not really like a header definition like you'd get in C/PHP/whatever.

Quote from Kiyoshi :I had to run 'nmp link' in the xi4n folder.

Interesting, what version of node are you on? You can it by running node --version.

Quote from Kiyoshi :I also had to run 'npm install <module>' as I had several error messages reporting missing modules. I imagine this was due to a fresh install of node.js, though I'm not at all sure.

More likely me missing some dependencies in the package.json Don't suppose you remember what you needed to install?

Quote from Kiyoshi :I haven't looked at the code yet. I don't know a great deal about JS either, but it looks interesting.

Patches, etc. welcome There are a couple of places where it really needs a tidy - but they all focus around https://github.com/theangryangel/XI4N/issues/9 and https://github.com/theangryangel/XI4N/issues/8 so I've not done the tidying yet Specifically the bits that are really nasty is the config handling and plugin loading Patches welcome if you wanna come and play though

As an FYI to anyone following, I've just rejigged how the plugins can sit in the plugins directory, so if you pull a new revision and it's all busted, that'll be why I've tried to make it so that the new style doesn't break the old style though
I had a closer look at the dependancy issues I had. It does seem to be a Windows nodejs/npm issue, similar to this one here:
http://stackoverflow.com/quest ... d-when-installed-with-npm

'npm link' doesn't work on Windows, apparently, and I don't think the npm install can install any dependancies into nodejs, which might just be the problem.
When trying to run XI4N, the missing modules nodejs reported were:
express; kdtree.js; socket.io; underscore

I originally got it working by 'npm installing' these in my xi4n folder, but that wasn't the right way to do it. I have now managed to install them to nodejs, though it was fiddly & I had to move their actual folders from node_modules into the nodejs root to get it to actually work.

So, don't let this distract you - I don't think it's any problem with the XI4N package, but a nodejs on Windows issue. nodejs version is 0.6.17 incidentally.
I had to type npm install <packet> for 3 packets and it works good, without any problems. I'm on W7 64bit.
Quote from Kiyoshi :So, don't let this distract you - I don't think it's any problem with the XI4N package, but a nodejs on Windows issue. nodejs version is 0.6.17 incidentally.

Unfortunately this is all my fault Doh - sorry about that

All those packages are depended on by plugins, rather than the xi4n core - but at the moment they don't load from their own directories - it's something I'm going to be putting in a fix for soon
So tickets from me:
- add admin password to config
- add possibility to run from LFS Master (not directly from server)

Other things are made very good and if someone knows basic of programming - they can do everything.


My next question is: will this work with nginx (is live stream of packets, so I'm asking), how many resources does this need to run on Linux (Windows eats too much and I wonna prepare PRISM and node.js hosting for applications like this one).
I've added issues to github for your 2 things, that way I don't forget like I did at the weekend I got distracted by shiny things :o

When you say it's using too much memory/cpu/disk, how much and specifically what? If you're running it on windows a perfmon log (with % Processor time, Working and Private Set of the nodejs instance), + xi4n log as a pair would be awesome If you're running Linux then can you run top in batch mode (top -b) and also output xi4n to a log file and send those over please? If I can figure out what part of it is eating memory or CPU time, that can hopefully be fixed. I suspect it's probably to do with how packets are thrown about, at a guess.

Only reason I'm asking is because I'm seeing xi4n top out at about 20MB before the GC kicks in...

As for using it with nginx, or any other web server, the easiest way is to reverse proxy from your frontend server to nodejs. As it is out of the box, it may need a little content re-writing by the HTTP server. For nginx you want to be looking at the proxy_* directives, and subs_filter_* for the rewriting.
I mean, Windows is taking too much resources

I know how to make reverse proxy, but I just don't know how will it behave while getting data live.
Quote from misiek08 :I know how to make reverse proxy, but I just don't know how will it behave while getting data live.

ningx added HTTP 1.1 support for proxy_* directives in 1.1, so as long as you're on that or newer it should just work out of the box. If it's older than 1.1 I believe you need to look at just using a raw tcp proxy, which can be done with one of the nginx modules - I've not tried socket.io reverse proxying with older versions tbh.

Quote from misiek08 :I heard about PHP path problems, but here too? The track is wrong oriented. Look here: http://misiek08.mydevil.net:8082/

Meh, I supposed the cheats way would be to use css to rotate the SVG element
Maybe it's possible to reverse values for each node and it will work?

Maybe there was mistake when you saved pth files to .json versions. Can you provide me files to parse .pth to .json? Was it clean PTH File Parser from Dygear and json_encode?
@Dygear - is it possible you to make version that exports good coordinates? It doesn't look like basic mirroring points...
Quote from the_angry_angel :Source is in the repo, but yes it is Dygear's PTH parser.
https://github.com/theangryang ... r/build/gen-json-pths.php

I've never seen the glob function before, cool trick, I'll have to remember that from now on.
I should also mention, that the version you're using of the pth parser was last updated by Victor, most of that code is his.

Quote from misiek08 :@Dygear - is it possible you to make version that exports good coordinates? It doesn't look like basic mirroring points...

It's just a flipped Y axis.

So an update to TAA's foreach within the pth2json function would look like this:

<?php 
    
foreach ($pth->Node as $n)
    {
        if (
$i == $pth->FinishLine)
            
$data['startfinish'] = array('x' => $n->Center->X'y' => -$n->Center->Y'z' => $n->Center->Z);

        if (
$i $resolution)
            
$data['nodes'][] = array('x' => $n->Center->X'y' => -$n->Center->Y'z' => $n->Center->Z);
        
$i++;
    }
?>

Edit: It was my experiments. It's working.
http://misiek08.mydevil.net:8082/

Edit2: Path is good, but cars are going on old path (like with wrong y's).
livemap2.js, line 32:
Quote :'y': -p.y,

The only issue I have with changing the converted PTH files is that then you realistically need to alter the data in the MCI other packets that contain positions as well. That then leads to confusion when or if you ever port to something else. Or have to interoperate with another addon - you don't want users to be surprised when they get different data from xi4n in constrast to another library.

I'd personally much rather put this fix directly into the livemap plugin - which I'll try and make time for before the end of the month.

Edit: As 2 people have now asked, please feel free to fork on github.com and submit pull requests. If you do submit a pull request feel free to add yourself to the package.json as a contributor (see http://package.json.nodejitsu.com/ if you're the first or not familiar with package.json format). I can't guarantee when I'll be able to do much work on xi4n for a few weeks, but I'll try and merge pull requests as often as possible.
@up - Post @up@up is fix only for livemap plugin (as you see, filename is livemap2.js)
So it's fixed only for 1 plugin and other plugins got normal data
Quote from misiek08 :So it's fixed only for 1 plugin and other plugins got normal data

The converted pth files aren't just used by livemap2.js, so if you've changed the pth converter script then you've also affected anything else that also uses them. If you've not changed the converted pth files then I'm not seeing how your fix works tbh...
I said about fixing player display. You can double pth files (1 copy with raw data, 2nd with real dimensions)
I've fixed the livemap2 y coords issue in Pull Request #23 without changing service code or double pth files.
Merged into master, thanks for the patch dude

Feel free to add yourself to the contributors key in package.json, if you wish paXton Recognition where recognition is due - you've been putting in more work than me the last few weeks
FYI anyone not watching the repo I've pushed in a bunch of changes into the master branch, including support for admin password and other ISI options. I'm done these changes on my laptop and I've not got LFS to hand to test, so it may be a little bit broken, however I don't believe it is. I'll test as soon as I can.

The npm-plugins branch needs merging, and adds support for NPM install-able and update-able plugins This means that each plugin can be installed from a URL and each plugin can be installed with it's own dependencies - so it should address the npm link fun you guys had. This is again untested, and isn't merged because it's a reasonably large change.

If both of these things survive testing that only leaves https://github.com/theangryangel/XI4N/issues/18 before I bump to 0.0.4 and start working on the stuff I've marked for 0.0.5 - so outgauge, etc. https://github.com/theangryang ... rt=created&state=open

I fully intend on working on this quite a lot during the up coming long weekend in the UK, so hopefully by Tuesday there should be lots of changes checked in and lots of fixed things

FGED GREDG RDFGDR GSFDG