Author Topic: Editing tracks in a browser  (Read 3017 times)

dreadnaut

  • Tunnel Twister
  • ***
  • Posts: 1373
    • View Profile
    • chezDreadnaut
Editing tracks in a browser
« on: September 24, 2012, 10:05:33 PM »
I am working on it ;)

I wrote a track viewer which should work in most recent browser, here: http://dreadnaut.altervista.org/test/stunts/
The idea is to expand it first into a landscape editor, and then into a full track editor.

CTG

  • Having only spam addict friends
  • ********
  • Posts: 21264
    • View Profile
Re: Editing tracks in a browser
« Reply #1 on: September 24, 2012, 11:12:58 PM »
Do a favour and give me a perfect replay editor. ;D
2818,54 km

zaqrack

  • Administrator
  • Makes love with Stunts
  • *****
  • Posts: 4545
    • View Profile
    • ZakStunts
Re: Editing tracks in a browser
« Reply #2 on: September 25, 2012, 04:07:30 AM »
I would so much welcome a web-based track editor. Using TrackBlaster on a laptop is painful and the built-in editor has its limitations we all are familiar with.

CTG

  • Having only spam addict friends
  • ********
  • Posts: 21264
    • View Profile
Re: Editing tracks in a browser
« Reply #3 on: September 25, 2012, 10:05:26 AM »
built-in editor has its limitations

It's a gift, because you can't build on the water. ;D
2818,54 km

dreadnaut

  • Tunnel Twister
  • ***
  • Posts: 1373
    • View Profile
    • chezDreadnaut
Re: Editing tracks in a browser
« Reply #4 on: September 25, 2012, 01:41:32 PM »
Using TrackBlaster on a laptop is painful and the built-in editor has its limitations we all are familiar with.

Suffering with TrackBlaster was also my main reason for starting this, but I haven't used it extensively. Apart from building anything on any terrain, are there any important features?

I have also never found a good explanation for illusion tracks, btw, so I don't know how an editor would allow those.

Duplode

  • Lives on Stunts
  • ******
  • Posts: 4136
  • Rabbit hole goes on forever
    • View Profile
    • The Southern Cross Stunts Trophy
Re: Editing tracks in a browser
« Reply #5 on: September 25, 2012, 04:50:12 PM »
I have also never found a good explanation for illusion tracks, btw, so I don't know how an editor would allow those.

For illusion tracks you need, beyond the ability to place anything anywhere, to be able to break apart multi-tile track elements, placing its component tiles separately. That allows us to mix-and-match track elements (thus creating the illusion effects) and to fool the track continuity checks. Attached to this post is ZCT106, which is a good example of some of these techniques. View it in TrackBlaster to see how the bridge chicane and other sepcial effects were produced.

Edit: A quote from the wiki, which helped to refresh my memory:

Quote from: Stunts Wiki on filler tiles
Code: [Select]

Element     Orientation reference     Orientation
                                      NW  SW  SE  NE
Filler      Tile position             **   FE  FD  FF

Filler tiles are necessary for multi-part track elements to be built correctly. The proper positioning of such tiles will be described using a 2x2 grid of tiles in which the NW tile contains the value of the actual track element. For 2x1 elements (loops and corks l/r), the track element tile is either the top or the left one (depending on orientation), and so the correct fillers are either SW or NE respectively. For 2x2 elements (corks u/d, chicanes and large corners) all three fillers should be used.

Editing track files with external tools such as Track Blaster gives the user liberty to omit filler tiles, either leaving the other tiles blank or filling them with other elements. That is the main trick deployed to build illusion tracks, as the space where the fillers would be will appear to contain the full NW tile track element except at very short viewing distances and yet the physical behaviour will be set by whatever element the designer put in its place.
« Last Edit: September 25, 2012, 05:08:54 PM by Duplode »

dreadnaut

  • Tunnel Twister
  • ***
  • Posts: 1373
    • View Profile
    • chezDreadnaut
Re: Editing tracks in a browser
« Reply #6 on: September 26, 2012, 01:44:51 PM »
Attached to this post is ZCT106, which is a good example of some of these techniques. View it in TrackBlaster to see how the bridge chicane and other sepcial effects were produced.

Quite fun to drive, but now I'm worried there might be demons in my copy of Stunts.

If it's a matter of replacing filler tiles, it should not be a problem to add an option for that!

dreadnaut

  • Tunnel Twister
  • ***
  • Posts: 1373
    • View Profile
    • chezDreadnaut
Re: Editing tracks in a browser
« Reply #7 on: January 24, 2013, 06:53:44 PM »
Status: I'm not going forward with this, it fails on multiple sides.

  • Reading local binary files in javascript is easy, as long as you don't have to deal with IE. It's still possible, but a pain
  • Reading remote binary files in javascript is fine, but with IE is a major double problem with side PITA for everyone. Don't go that way.
  • IE10 will solve all these problems, cure cancer, end famine, etc. Only, it will take years to reach enough users
In short: reading tracks and replays in the browser is possible, but older browsers and current IE will fail. I would avoid it if possible.

A decent workaround is to encode files as text/base64 and read that —it will work decently with all browser, but requires some php on the server, and does not solve the problem with local files.

  • Writing files in javascript is just not possible (sandboxing, security, etc), so you would have to "download" the file every time you want to save it. More pain.
I now think that js is the wrong tool for this. The viewer works though :)


I'd still like a usable editor, so I'll consider other technologies. Java would work everywhere, but I got a bit sick of it, python+qt could also be nice and portable.
« Last Edit: January 24, 2013, 06:58:41 PM by dreadnaut »

zaqrack

  • Administrator
  • Makes love with Stunts
  • *****
  • Posts: 4545
    • View Profile
    • ZakStunts
Re: Editing tracks in a browser
« Reply #8 on: January 25, 2013, 03:17:00 AM »
I don't think you should care about IE compatibility. If anyone wants to edit tracks only, he can launch a proper browser.