Skip to content

Create build scripts#42

Merged
xem merged 1 commit intoxem:sukus21from
sukus21:build-scripts
Feb 23, 2026
Merged

Create build scripts#42
xem merged 1 commit intoxem:sukus21from
sukus21:build-scripts

Conversation

@sukus21
Copy link
Collaborator

@sukus21 sukus21 commented Feb 13, 2026

Hi there 👋

First of all, super cool little engine you got here, I'm very impressed! I fell down the js13k rabbit hole the other day, and found this engine thanks to the "resources" section on the website.

Snooping around the repository for a bit, I noticed the lack of build instructions. It is also not clear which parts of the source are stripped out of the lite version, or how the minification (of JS and/or GLSL) or zipping is done. I did some guesswork, and arrived at some results that are close enough.

So what we have here is a build script, that runs the code through terser, and then manually minifies the shader code using a series of regular expressions.

I have a few ideas for how to decrease the byte size of the engine even further, but in order to properly test if they save space when zipped or not, I needed a base to work from.

I'm looking forward to hearing your feedback :)

Notes:

  • The zipped files are larger than the old ones, since they were a couple revisions out of date
  • The logic to check for plugins gets evaluated at compile time thanks to terser, so those checks are completely free in terms of byte cost

@sukus21 sukus21 force-pushed the build-scripts branch 2 times, most recently from e6054ab to 3ce7058 Compare February 13, 2026 23:15
@xem
Copy link
Owner

xem commented Feb 14, 2026

Hi and thank you for your message!
Glad that you enjoyed js13kgames. Have you seen the entries made with W.js ?
As you can see, a previous PR also attempts to automate the build but the person stopped responding.
Regarding the difference between normal and lite, the homepage (https://xem.github.io/W/) explains that the lite version doesn't have built-in shapes such as cubes and spheres, nor the smooth shading function (which is quite verbose).
There's also MicroW (https://xem.github.io/microW/), even smaller.
As for my own process, as I'm totally not at ease with build scripts, I minify the code manually with terser (https://xem.github.io/terser-online/) and zip it with zopfli (https://xem.github.io/zipzop/).
The repo is now quite old so I don't remember all the little manual adjustments I may have added, though your build script seems to be already very good.
I'm not able to test it currently, but I can accept your PR in a new branch and add a link to it (+ your name) in the readme and the homepage, if that's ok for you?

@sukus21
Copy link
Collaborator Author

sukus21 commented Feb 14, 2026

That would be OK with me.

Looking at #29, there are a few changes from there I would like to incorporate into this branch, so give me another couple hours to get that done :)

* Added NPM build scripts
* Improved plugin workflow a little
* In-sourced shader minifier
* Removed ect binary from source tree (replaced with dev dependency)
@sukus21
Copy link
Collaborator Author

sukus21 commented Feb 14, 2026

Ok, I updated a few things:

All of this combined makes it possible to build the minified and zipped versions on Windows, MacOS and Linux.

I am ready to merge now 👍

@sukus21
Copy link
Collaborator Author

sukus21 commented Feb 22, 2026

...but I can accept your PR in a new branch and add a link to it...

In order to merge into a separate branch, I need you to create a branch for me to merge into, so I can update the MR to point to that branch

@xem
Copy link
Owner

xem commented Feb 23, 2026

Sure, I created a branch sukus21. After the merge, I'll advertize it in the readme and homepage. Thank you!

@sukus21 sukus21 changed the base branch from gh-pages to sukus21 February 23, 2026 19:27
@sukus21
Copy link
Collaborator Author

sukus21 commented Feb 23, 2026

Ok, I have updated the PR to target the sukus21 branch. Ready for merge 👍

@xem xem merged commit f5d28ac into xem:sukus21 Feb 23, 2026
@sukus21 sukus21 deleted the build-scripts branch February 23, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants