-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for multiple new features #164
Conversation
Merge upstream
Add support for command line parameters when running via electron or the browser. All of the options originally configurable via passing a `Config` object can be configured via a command line option. The only major differences are the addition of a new command line only `--help` option which prints the usage information to the command line without showing the GUI and the helpful change to the `matchFileURL` parameter (aka --match) to expect a relative or absolute file path instead of a file protocol URL (though note that the --match parameter and the matchFileURL variable itself both remain unusable via the browser due to the standard Javascript security policies regarding local filesystem access from within a browser). Run the previously mentioned '--help' option to find more details on the available parameters, though be sure to separate the parameters of the electron executable from our parameters with a '--'. For example: 'npm run electron -- --help' or 'Battlecode Client.exe -- --help'. Additionally add support for managing the display during match renders: the display will no longer enter sleep mode or otherwise suspend during the rendering of a match. This matches what users expect from playing dynamic content like the match render (for example: playing videos in the browser has the same behavior). Finally, some minor fixes and modifications were made: to enable UTF-8 support both within the HTML of the `index.html` file and within the electron `BrowserWindow`; to prevent the `BrowserWindow` from being displayed to the user until after it finishes the initial render (this eliminates the flicker and tearing that would previously occur on some startups); to eliminate small code smells and reduce duplication of ternary conditionals within `app.ts`. Signed-off-by: Emily Mabrey <[email protected]>
Merge the changes of origin/master while integrating my upgrades to the electron application. Signed-off-by: Emily Mabrey <[email protected]>
Merge upstream
Add imagemin minimization support to the webpack loaders via adding the 'img-loader'. Fix the git line endings support to match the editorconfig configuration- git will no longer modify local line endings on Windows platforms. Additionally, some minor improvements were made to the project, including: adding support for git to generate exif based diffs on binary image files to increase the ease of merging image files; the addition of a 'format-in-place' task to `package.json` which replaces the content of Javascript, Typescript, HTML and CSS stylesheets with formatted text matching the rules configured within the new `.jsbeautifyrc` file and the pre-existing `tsconfig.json` and `tslint.json` files (these formatting rules also respect editorconfig settings); adding the `dist/` folder to the clean task; cleaning up the `.editorconfig` file so the same rules apply across the entire project. New packages were added to `package.json` to accomplish some of the changes, including 'exif-cli','img-loader', 'minimatch', 'js-beautify' and 'typescript-formatter'. The 'webpack' package was modified to use the `fulls1z3/webpack` repository instead of the standard NPM provided version- the new repository includes support for ES6/Harmony and fixes a bug related to webpack failing to process packages containing ES6 code. Signed-off-by: Emily Mabrey <[email protected]>
Make minor formatting changes to eliminate pointless changes from the upcoming pull request to battlecode/master. Signed-off-by: Emily Mabrey <[email protected]>
The `--mode` option incorrectly contained the same help description as the `--indicators` option; the help message was replaced to contain the correct information describing the `--mode` option. Signed-off-by: Emily Mabrey <[email protected]>
Replace the `fulls1z3/webpack` version of the webpack dependency with version 2.2.0-rc.7 and add the uglify-js depdendency via the `mishoo/UglifyJS2#harmony` repository. This solves the previously solved problem regarding ES6 containing modules while still allowing us to use the official webpack instead of a fork. Additionally make some minor fixes to comments of the `app.ts` and `config.ts` files. Signed-off-by: Emily Mabrey <[email protected]>
Replace the img-loader plugin, which only minimizes images within our project, with the imagemin-webpack-plugin, which minimizes all images within the entire bundle, including images from included modules. Add configuration to the UglifyJS webpack plugin that heavily optimizes and minimizes the bundle's Javascript. Add the OrderOccurancePlugin which organizes the contents of the webpack bundle in order of occurance within the bundle so that the bundle loads and runs with better performance. Additionally modify the devtool configuration so that it uses a much easier to generate source map for dev builds and add the devServer configuration to make it more obvious how we have configured the development server. Signed-off-by: Emily Mabrey <[email protected]>
Fix the previously unaddressed problem caused by the arithmetic encoding done via the imagemin plugin. The arithmetic encoding was making the `tiled_1.jpg` file un-renderable, and the renderer as a result not only failed to render the background, it also failed to render anything correctly due to lacking a clear between frames without the background draw. In addition to fixing that problem, fall-back code was added so future problems with the same background draw won't cause additional visual artifacts. Improve the timeline by extending it to 500 pixels and making it's colors and drawing routines much better. It it now much easier to read and understand the contents of the timeline bar, and it now makes it much more clear it can be selected via usage of a new cursor. Additionally, a minor addition to `renderer.ts` of the browser prefixed versions of the image smoothing configuration. Signed-off-by: Emily Mabrey <[email protected]>
I made some additional changes, including: fixed a bug with the background image rendering caused by the imagemin plugin; improved the style and content of the timeline bar; improved the loading of match files to reduce the skipping and general "glitchy" appearance caused by generating GUI content before the file is finished being read; reduced the size of the generated webpack bundle (from ~850kb to as low as 250kb in some cases!) via aggressively configuring the UglifyJS plugin to heavily optimize the Javascript and other resources. |
Re-add --mac target to `prod-electron` task. It was accidentally removed in the previous commit. Signed-off-by: Emily Mabrey <[email protected]>
Add support for command line configuration, including during development as well as on production builds. For non-electron builds the same options can be passed using URL parameters to the
index.html
page (with the exception of the match parameter which sets thematchFileURL
variable, which is only supported when running outside of the browser due to JavaScript filesystem access restrictions). Adding support for command line parameters makes implementing this battlecode-scaffold feature request doable. Make sure to separate the parameters of the electron executable from our command line options with a--
option, for example:npm run electron -- --help
. Without using the--
option the electron executable itself will swallow the parameters you intend for our application to receive.Add a
--help
command line option (unrelated to setting an application variable so not included in the previous paragraphs description) that prints a pretty and formatted explanation of all the available command line options. This command line option functions without showing the GUI window as users would normally expect a--help
option to do. If you want to see an example of the output of this option simply view this Gist containing the output of using the--help
option.Fix for Git line endings for developers using a Windows development environment- Git now respects the usage of LF line endings as configured in the Editorconfig settings. Git also generates human readable exif diffs for image files. The images will still be merged using the binary content, but the diffs will contain human readable text.
Add support to Webpack for image minimization of all the various sprite images. This seems to remove about 100kb from each sprites final size without impacting the image quality of the final GUI output.
Add support to prevent the display from sleeping while a match is playing. For extremely long matches you won't need to jiggle the mouse anymore just to keep the screen alive, but only if you are running from within the electron executable.
Add a fix for flickering and tearing of the client web content within the electron window upon startup by implementing a series of cascading event listeners that wait to show the GUI to the user until after the HTML and then the GUI itself is fully rendered. This doesn't add any length to the startup time, but it does prevent showing the user an incomplete and in some cases non-interactive window for the first second(s) of the application life-cycle.
Add support for a build task that formats all Javascript, Typescript, HTML, and CSS stylesheet files according to the rules configured within
tslint.json
,tsconfig.json
and the newly added.jsbeautifyrc
files.Cleanup code / fix some minor bugs- a bug with webpack that caused it to fail when some required packages contained ES6/harmony code instead of ES5 code; a bug with the tslint task that had it attempting to lint the source code contained within the node_modules files instead of only linting our source code; upgrade the minimatch package peer-dependency to a newer version so that the various packages requiring it are not subject to this RegExp denial-of-service; replace dozens of duplicate ternary conditionals within
app.ts
with two new methods-getGameIndex()
andgetMatchIndex()
.