Publish non-minified JavaScript game sources

DeletedUser16928

This idea might seem quite abstract for the ordinary player, but you'll have to trust me on this one if you don't understand. :) Fellow script developers certainly know what I'm talking about.

Proposal
Make the non-minified game JavaScript sources available for script developers, in order for easier understanding of client-side game code. This means enabling access with a listing to all client-side JavaScript files with original commentary, local variable names and formatting.

Details
When creating any more complicated script for The West (like ClothCalc, TW Collections and other), the script developer needs to understand the game JavaScript structures and methods in order to make proper use of them and efficiently create scripts that won't cause game errors with future changes. The reasonable way to do that is to read the JavaScript source code, which is currently quite difficult (see below).

I suggest the release scripts are slightly modified so that they create a copy of the JavaScript source file structure somewhere accessible for script developers. It is also important that the files are easy to discover for which I suggest enabling nginx's directory listing for that folder, this won't introduce any risks as long as the directory only contains files to be made available to public. If this is not desired, a non-minified merged JavaScript file is also an option, although less preferred.

The desired attributes of the published code are:
  • original formatting - for better readability; the formatting gained by JS beautification might not express everything a developer would
  • original local variable names - for better understanding of semantics - my mistake, local variable names are actually preserved in the minification!
  • commentary - semantics, also the commentary will likely include information like TODOs, change notes and warnings, that will help script developers better react to past/future code changes and avoid creating code that could cause unpredictable bugs in the next versions.

Current Workaround
The only available JavaScript source known to me is the minified code at http://www.the-west.net/cache/tw2game.js (or another world/market version of the file). Since this code is being sent to the client, it is well justified that the code is minified. The code found there can be formatted using online tools for better reading, however some semantics is lost even in that, let alone original variable names and commentaries.
As far as I remember, in the past (before 2.0) some non-minified sources were present in locations like http://www.the-west.net/js/ (without any file listing making it difficult to discover them).

Abuse Prevention
Publishing source code can always be kind of a security issue, but we are only talking JavaScript here. The minified merged script file is of course available already, so the only new things that would be exposed are the original local variable names and formatting (both not an issue, can only help understanding the semantics) and the source code commentary. It's only the latter that could potentially be misused if and only if the commentary contains extra developer notes that reveals sensitive information about the code running in the backend. I suggest the idea should be briefly discussed by developers involved in producing JavaScript code to evaluate if such sensitive information could potentially be present. If so, it should be removed as no such stuff should be in client-side sources anyway. :)

Visual Aids - N/A

Summary
One great thing about browser games is their inherent modability. At least over half a hundred thousand of The West players, mainly the most active ones and premium users, enjoy scripts like ClothCalc and acting upon this little idea would make the development of such scripts a whole lot easier. Thus, it would allow for even more enhanced game experience because it will be easier to add features, also it would reduce the amount of errors such scripts can cause.

This idea requires little effort - a brief discussion whether publishing the non-minified code is safe, creating a directory with listing and a little change to the release scripts.

Administration
Does this idea meet the Ideas Guidelines & Criteria? Yes
Does this idea appear on any of the Previously Suggested Ideas List? No


// I would like to ask a moderator to change the title to "Publish non-minified JavaScript game sources", I changed the word order by mistake
 
Last edited by a moderator:

DeletedUser34315

Sounds incredibly useful to me- tw-db is an invaluable resource to the game, and anything that makes it more effective/easier to add on to without compromising the game's hidden code is a great idea.
 

DeletedUser33342

Count me in for this idea, I have spend already some time on this issue :p
 

DeletedUser22493

Imagine this game without TW-DB and it's brilliant scripts. No-can-do.. Got my vote.
 

Slygoxx

Well-Known Member
I like this idea. I've made a few scripts and some of them required interaction with the game's functions, this'd make it easier to browse through the code, instead of having to go through a minified mess.
 

Ripwise

Well-Known Member
I aint really into scripting but if Sly says it would help im all for it. You got my vote :)
 

1Big Chief

Well-Known Member
Even though I know (little of) other type of software coding... you almost hurt my brain :eek:
And cause I use and recommend TW-DB to every friend/players... Petee will get my vote

Frankly... I thought you had the source codes already.. with all you have done for the west enhancement
If not made public... at least Petee should have access ... ;)
 

DeletedUser16928

Frankly... I thought you had the source codes already.. with all you have done for the west enhancement
If not made public... at least Petee should have access ... ;)
Funny you would say that - it actually turns out I had access to those sources for some time already, since I'm an elite tester on the beta world Amchitka. Took me quite a while to notice, but this world uses non-minified sources for better debugging possibilities, so any player there can easily study the original code, with commentary, original directory structure and formatting.

Inno does not allow us to give others access to any content on that server, however. In order for script creators that are not present on Amchitka to have access to the sources, the suggestion still stands. Maybe Inno could even make a periodically updated git repository that only contains the JavaScript code?
 
Top