Kusmeroglu / MWOOSK

3 stars 0 forks source link

URL save/load scheme. #11

Closed Kusmeroglu closed 11 years ago

Kusmeroglu commented 11 years ago

I added a urlhandling.js file with functions for getting url params by name and setting them without reloading the page. The scheme that I was thinking, where we assign a letter to each item obviously isn't going to work. Maybe a 3 letter hash? We could just shove the whole item name in there, comma separated. I.E. rtorso=AC/2,AC/2%20Ammo,AC/2%20Ammo,Double%20Heatsink&rarm=Medium%20Laser&armor=23,24,56,24,25,45,etc..

mvrckpa commented 11 years ago

I was trying to give this some thought last night. Is there a specific reason letter designations won't work? Obviously not a single letter per item, but a two character alphanumeric would give us just over 1200 possible items for scalability.

I think the component name plus all the character codes together would be the best bet for keeping the URL from getting too insanely long. To play with your example above:

chasis=ddc&ra=af,ab,ac&rt=bc,bd,be&ct=dd&cp=aa&lt=sr,sr,sr,ab&la=af,ab,am&ll=ac,ac&rl=de,de&armor=68,60,24,90,28,18,60,24,68,57,57&module=ff,cd,fd

The one problem I could see with this is error checking to make sure people don't insert their own item codes to make non-viable mechs.

drewfurgiuele commented 11 years ago

Yeah been thinking about it too. I am starting to lean towards supporting a URL-based load from the backend; sort of what you see from Instagram; I.e:

Mwoosk..com /fgtej42h

Where the gibberish correlates to a database row or query to construct a mech.

Sent from my iPhone

On Oct 30, 2012, at 1:34 PM, mvrckpa notifications@github.com wrote:

I was trying to give this some thought last night. Is there a specific reason letter designations won't work? Obviously not a single letter per item, but a two character alphanumeric would give us just over 1200 possible items for scalability.

I think the component name plus all the character codes together would be the best bet for keeping the URL from getting too insanely long. To play with your example above:

chasis=ddc&ra=af,ab,ac&rt=bc,bd,be&ct=dd&cp=aa&lt=sr,sr,sr,ab&la=af,ab,am&ll=ac,ac&rl=de,de&armor=68,60,24,90,28,18,60,24,68,57,57&camo=basic

The one problem I could see with this is error checking to make sure people don't insert their own item codes to make non-viable mechs.

— Reply to this email directly or view it on GitHub.

Kusmeroglu commented 11 years ago

Agree with Mvrck, two or three letter codes would keep the URL short and give us plenty of room to grow. Using the classes to load the URL data in, we can pretty easily skip sections that might have been corrupted. Dietary- are you saying we should skip the URL only scheme and go straight to backend stuff, or do you mean when we implement backend?

drewfurgiuele commented 11 years ago

Not skip the url thing, I think we just need to "tiny-ize" it. We can generate a unique key for a given build, so we can tack that on the end of the web site url and the system will know to load that build from the database. It requires the back-end stuff, though, since it will have to do a db-read to find the ID. But that would make it easy to share URLs directly to builds and keep the querystring small

Kusmeroglu commented 11 years ago

Yeah, that makes complete sense. Almost like tiny URL services.

Kusmeroglu commented 11 years ago

I got the URL setting done, need to work on the reloading.

Kusmeroglu commented 11 years ago

This works now! We had one awesome moment of sharing an almost Reaper build, and then we broke things again by putting stuff in the new layout.