Mr Speaker


Warning: count(): Parameter must be an array or an object that implements Countable in /home/mrspeak/public_html/wp-content/themes/stuartspeaker/functions.php on line 24

Warning: count(): Parameter must be an array or an object that implements Countable in /home/mrspeak/public_html/wp-content/themes/stuartspeaker/functions.php on line 27

Warning: count(): Parameter must be an array or an object that implements Countable in /home/mrspeak/public_html/wp-content/themes/stuartspeaker/functions.php on line 29

Line Rider File Format

a dodgy line-rider-readerA while back I tried to "reverse-engineer" the Line Rider shared object - the file that stores your Line Rider Tracks. The idea was to add a much required "erase" function. I mostly figured it out - but owing to my extremely short attention span it quickly entered my immense "1/2 finished projects" repository.

In an effort to get some more posts happening around here I've decided to unleash a few of these 1/2 finished projects. The Line Rider File Format is the first such post. I chose this one because there is supposed to be a new version of Line Rider due out very soon - once this happens this information will be totally useless, instead of just mostly useless.

Line Rider stores its track data using a Flash Shared Object. On Windows, Shared Objects are stored under the \documents and settings\username\Application Data\Macromedia\Flash Player\#SharedObjects directory. It will vary depending from what web site you loaded Line Rider flash file. The directory will contain a file called "undefined.sol".

"undefined.sol" contains all your Line Rider tracks. I opened this file up in a hex editor and started poking around. After changing a few of the values I noticed that I did indeed make a line move, so further investigation would be required. I found this good reference for the .sol file format on SourceForge which helped a lot. The rest was just drawing lines, and seeing the effect it had on the file. Heres what I got:

The header


==== Header =====
00 BF       // Start : 2 bytes
00 00 00 BF // Files size: 4 bytes (from after this byte)
54 43 53 4F // Ascii - 'TCSO' - Filetype : 4 bytes
00 04 00 00 00 00 // Always these 6 bytes

The header is standard to all Shared Object files.


==== Data Block ====
00 09  // Length of Shared object name : 2 bytes
75 6E 64 65 66 69 6E 65 64	
  // 'undefined' - the name of the shared object : 9 bytes
00 00 00 00  // 4 empty bytes

The data block has the file name - in our case "undefined" (nice naming work there :)


==== Items ====
00 09 // Length of the root object name : 2 bytes
74 72 61 63 6B 4C 69 73 74
  // 'trackList' - the root object name : 9 bytes

The list of tracks is called the "trackList". That's better naming work there. All Line Rider files are the same up to this point. Now we move on to the good stuff...

The good stuff

=== Saved Tracks Array ====
08  // Saved Track array: 1 byte
00 00 00 01			
  // Number of tracks you've got saved
  // (just one here in this case): 4 bytes.

00 01 30
  // Track Array index : 3 bytes
  // [increases by 1 each track]

This shows the number of tracks you have got saved. All of the array indexes are written in this format 00 01 30, 00 01 31, 00 01 32 etc... I was confused as to why they started at 30, until I found another great Shared Object reference on SourceForge - which showed that 30 in ascii is "0". Still seems weird, but there you go.

Ok, next we move on to the guts of the file - this is where all the lines for each track are stored.


=== Track Object ===
03 					// Declare object for track : 1 byte
		
  === Track Object Data ===
  00 04				// Object property 1 - name length : 2 bytes
  64 61 74 61			// Ascii for "data" - this is the object name : 4 bytes

      ==== Line Array ====
      08			// Line data array : 1 byte
      00 00 00 01	// Number of lines in this track - just one here! : 4 bytes

      00 01 30 		// Line array index : 3 bytes [increases by 1 each line]

        ==== Line Point Array ===
				
        08			// Line Point array : 1 byte
	00 00 00 05	// Number of points per line : 4 bytes

	/* 
	    Each straight line segment is made up of 5 points 
	    X1, Y1, X2, Y2 and a blank one.					
	*/
				
        00 01 30	// Point index 1 : 3 bytes
	00			// Declare number variable : 1 byte
	3F F0 00 00 00 00 00 00 	// Initial X point position : 8 bytes

	00 01 31 	// Point index 2 : 3 bytes
	00			// Declare number variable : 1 byte
	3F F0 00 00 00 00 00 00 	// Initial Y point position : 8 bytes

	00 01 32	// Point index 3 : 3 bytes
	00			// Declare number variable : 1 byte
	40 28 00 00 00 00 00 00		// Ending X point position : 8 bytes

	00 01 33	// Point index 4 : 3 bytes
	00			// Declare number variable : 1 byte
	3F F0 00 00 00 00 00 00		// Ending X point position : 8 bytes

	00 01 34	// Point index 5 : 3 bytes
	00			// Declare number variable : 1 byte
	00 00 00 00 00 00 00 00		// Empty : 8 bytes

        00 00 09	// End Point Array : 3 bytes
			
      00 00 09		// End Line Array : 3 bytes

THAT is the cool bit! Changing the 8 byte numbers (Stored in Big Endian order - thanks Lee!) will change the start and end points of your lines! Line Rider saves the .sol file in memory until you close, or navigate away from the line rider page. This means that for your changes to take effect you must navigate away from the line rider page, then make your changes, then re-load Line Rider.

Wrapping it up

=== Track Object Names ===
00 05			
  // Object property 2 - name length : 2 bytes
6C 61 62 65 6C	
  // Ascii - 'label' - labels for track names : 5 bytes
02     // Declare string type for track name : 1 byte
00 03  // Track name length : 2 bytes
6F 6E 65		
  // the ascii track name given by user -
  // in this case its creatively called 'one'
		
00 00 09  // End of Track object : 3 bytes
00 00 09  // End of Saved track array : 3 bytes	
00        // Game over. 1 byte.

The tricky bit

The only gotcha left in the file format is that subsequent saved tracks do not store all the lines that are in previous saved tracks - only the new lines. So for example, if you make a track called "one" with 5 lines in it, then you draw 5 more lines and save it as "two", then track "two" does not store all the details of the first 5 lines from track "one".

To save space, the duplicated lines are stored as pointers to the original lines. In the Line Array details above, duplicated lines are stored as a pointer (shared object type 07, instead of the array type 08). The 2 bytes following "point" to the index of the original line.

So there you go! A real saved line rider file will be much bigger that above as this file only had one saved track, with one line in it. However, it's pretty easy to write a parser for it - I made one in dot net that opened a line rider file and printed out your track using GDI. It could even delete lines too! But it is wayyyy to flaky to put up here. It's the kind of code I'd prefer no one know that I'm capable of writing.


Warning: count(): Parameter must be an array or an object that implements Countable in /home/mrspeak/public_html/wp-content/themes/stuartspeaker/functions.php on line 33

23 Comments

  1. i need help i still dont know how to delete the tracks i have made there a mess and every time i make a goood one i save it when i log off then bak on the save is gone

    Friday, November 17, 2006 at 8:55 pm | Permalink
  2. I started inspecting the line rider file format as well a couple weeks ago, and also began working on a program that could edit Line Rider .sol files. If you are interested, since I have no other major projects at the moment, we could help each other out and possibly create a well-designed program that would manipulate line rider files. If you are interested, email me at webmaster@13willows.com with your AIM, Yahoo, or MSN and we can chat more there.

    Saturday, November 18, 2006 at 10:20 am | Permalink
  3. Hey, great post it saved me A LOT of time. I’ve just started fiddeling around with an editor for Line Rider myself. The usability of the Line Rider itself is not great, it takes forever to design a cool track. People out there, with too much time on their hands, managed to create some really cool tracks using Line Rider itself. I figured if I designed a half assed editor and put it out there, imagine the tracks those people could come up with.
    And I could just sit back with a beer and watch them on youtube :

    By the way about the “Weird” indices. Not so weird afterall. The first two byes are the string length for the ASCII representation of the index (not including terminating zero).
    00 01 30 is simply:
    short Len = 1;
    char Index[] = “0”

    Hasta la vista
    /Line Rider addict

    Monday, November 27, 2006 at 3:05 am | Permalink
  4. wheree can i find a program that will let me view this file? i downloaded soledit but its too confusin :S plz w.b.

    Saturday, December 2, 2006 at 4:37 am | Permalink
  5. I released a BETA of a program for editing these sol files a few days ago, you can download it at this address: http://www.fundmyfirstcar.com/lrtools.php

    Wednesday, December 6, 2006 at 6:56 am | Permalink
  6. Hey, I’ve been trying to write a tool as you did. I figured that the first 4 numbers in the line point array would be the x- and y-values for start and end of a line. But there is a 5th number in that array. Sometimes it is zero, but not always. Any idea what it is??
    Thanx by the way for mentioning that the numbers are stored in Big Endian: solves some problems :-)

    Thursday, December 7, 2006 at 8:11 pm | Permalink
  7. Great work done on the editor so far guys.. And your program is pretty cool Lee! Still a few bugs to catch though, with the directory choosing, but apart from that, it works really well. Graphics in .Net are notorious for being dodgy though, I had similar problems creating a graphing app once. If you’re interested, their is a wrapper available for .Net to work with OpenGL… I found it quite effective, I could send you the dll’s if u want.

    Your curve creator is a Brilliant idea! I was thinking you should make it so that, if you want you can create curves atrting anywhere, not just at the last point you left off. Also, what would be cool, is if you could construct the parabolas based on the gradient of the line it starts off being connected to, sort of like quadratic spline interpolation. I’ve messed around with a couple formulas and found some to define a parabola based on just the starting point, an initial gradient, the final gradient and the length of the curve; or the starting point, the initial gradient and the end point.

    I wouldn’t mind making an editor myself, but I dont have much time, and I figured you’ve already got so far.
    Good luck… and well done. Its looking good

    Monday, December 11, 2006 at 4:33 am | Permalink
  8. ps… I think you might have your endianesses muddled ;)
    I’m pretty sure those 8 byte integers are stored in little endian order (least significant byte first)…. otherwise those integers are both really large and amazingly all multiples of 2, 4, 8, 16, 32, 64… I’m sure you get my drift =)

    Saturday, December 16, 2006 at 12:03 pm | Permalink
  9. i simply want to be able to save my line rider “saved” tracks. i want to be able to entirely close line rider and then reopen it and be able to reopen my saved track. can you help me out?

    Wednesday, December 20, 2006 at 7:42 am | Permalink
  10. p.s. i read somewhere else that i can just search for undefined.sol and then save that file to another place… but undefined.sol would not come up in my search.

    Wednesday, December 20, 2006 at 7:45 am | Permalink
  11. yeah, i have a different version but its in the same place. and i already tried doing what the other site told me to try and nothing happens. i make a track, save “undefined.sol” on my desktop, close line rider, reopen line rider, replace the “undefined.sol”, and nothing happens…. i can load the old ones that i had saved last time. how do you do it? be specific please.

    Wednesday, December 20, 2006 at 2:07 pm | Permalink
  12. [steve wrote]:
    On my PC its located at:

    C:\Documents and Settings\Owner\Application Data\Macromedia\Flash Player\#SharedObjects\6NWLDEQD\localhost\steve\games\LineRider_beta.exe\undefined.sol

    Thursday, December 21, 2006 at 11:24 am | Permalink
  13. ok, again, i know where it is, i just dont know what to do with it….

    Saturday, December 23, 2006 at 12:38 pm | Permalink
  14. this is very interesting:). i made the game but had no idea how exactly flash stores all this stuff (thats why the name is undefined-i just used the easiest example from the flash help). thanx for explaining all this:). i would like to correct one thing though, the fifth parameter is NOT always zero. that number tells you if the angle between the lines is bigger than 180 deg. in other words, it tells the program if the angle is ‘sharp’ or not. this is important and its the thing most people who tried to edit it never noticed:).

    Saturday, January 6, 2007 at 11:09 pm | Permalink
  15. Haha! Fsk! Unbelievable! Thanks for the killer game sir, it’s wasted many hours of my life.

    I’ll add in your changes when I get back home – I’m currently lazing about on a beach in Okinawa. So if I spend one more minute on the internet, then I’ll officially be an OTAKU (nerd). I better get back to sippin’ awamori!

    Thanks again!

    Tuesday, January 9, 2007 at 10:59 am | Permalink
  16. I made a really awsome line rider track at home and i want to save it to a floppy so i can show my friends at school how do i locate the file Please help?

    Thursday, January 18, 2007 at 8:50 am | Permalink
  17. I have made a fully functional LineRider Editor thanks to this article. You can find download instructions at my website, http://coppersoft.com/acesoftware/linerider_editor/. It is currently being tested by myself but you can help with suggestions and testing it yourself.

    Thanks,
    Doug

    Sunday, January 21, 2007 at 12:43 pm | Permalink
  18. I put together some info on the Line Rider v2 File Format but am still working on it. http://www.13willows.com/forum/viewtopic.php?t=5

    Saturday, March 3, 2007 at 8:45 am | Permalink
  19. hey could you post a download of it please??im no good at hexing or that kind of stuff.

    Friday, March 9, 2007 at 1:51 pm | Permalink
  20. On my pc it’s not called “undefined.sol” but “savedLines.sol”

    Thursday, November 22, 2007 at 6:50 am | Permalink
  21. i tried to downoad it but my pc said it has encoutered an ‘illegal action’ … please explain.

    Friday, January 18, 2008 at 6:19 am | Permalink
  22. were is the download

    Monday, June 23, 2008 at 3:47 pm | Permalink
  23. why cant you play it?

    Monday, October 12, 2009 at 6:24 am | Permalink

One Trackback/Pingback

  1. 2 beta download line rider on Tuesday, December 14, 2010 at 1:03 am

    […] Line Rider File Format – O! Mr Speaker! 15 Nov 2006. I chose this one because there is supposed to be a new version of.. The 2 bytes following “point” to the index of the original line… Fsk! Unbelievable! Thanks for the killer game sir, it's wasted many hours of my life.. I made a really awsome line rider track at home and i want to save it Line Rider File Format – O! Mr Speaker! […]

Captcha! Please type 'radical' here: *
How did you find this thingo? *