Skip to content

Conversation

@codeman4033
Copy link
Collaborator

Almost completely rewrites the sound system to use the Web Audio API instead Howler.js. Also adds the following features (from #53):

  • Shuffling the tracks
  • When starting the game, play beginning from a random track

Not much but definitely is something

@codeman4033 codeman4033 added the enhancement New feature or request label Jun 16, 2025
codeman4033 and others added 20 commits June 16, 2025 18:14
* Fix tsconfig scopes affecting html.js

Since it's quite hard to use a DOM library type there, remove the type
entirely.

* Remove environment variables check

Nothing is using them anymore. It can be added back if needed later.

* Refactor Texture Packer downloading

Refactor local-config.js tasks file into a generic "environment"
category consisting of checking if Java is installed, downloading the
runnable Texture Packer if it's not yet downloaded and copying the local
configuration template; update README accordingly.

* Prepare environment only at postinstall

Remove environment.prepare task from default build pipelines, add a
postinstall script that calls the task, using environment.js as the
gulpfile to speed it up.

* Remove "docs" tasks and types generation script

Remove tasks from docs.js as they are unlikely to do anything meaningful
nowadays. Also remove the buildTypes script as it doesn't work anymore.
A better solution will be provided in the future.

* Simplify some globs

Use additional gulp.src options instead of specifying more or complex
globs.

* Extract built-temp location to a variable

Add the src/js/built-temp directory as a new variable in config.js,
replace all existing references to built-temp with this variable.
Remove the behavior of automatically opening developer tools when
launched with --dev command line switch. As --hide-devtools switch is
now unused, remove it as well.
Remove the canvas context loss handling as it was incorrect, simplify
the error conditions in makeOffscreenBuffer and remove commented out
code.
These files do not describe existing JS types and instead define their
own. Usage of .d.ts extension prevents these types from being emitted
when using emitDeclarationOnly, which affects generation of typings for
mod development.
Remove the check of URL beginning with data:image. This is an old API,
so leave other quirks as-is.
Remove globalConfig properties that are not used anywhere, simplify
mobile device detection (mostly unused for normal builds) and merge or
inline config constants where it makes sense.
Unlikely to be used and can be replicated with mods in a much better
way.
Remove lastCanvas/lastContext cache for reusing canvas as creating a new
canvas does not cause performance issue. Additionaly, remove smoothing
classes and buffer registration as they are not used anywhere. Finally,
remove redundant stageDestroyed calls in the InGameState.
Remove some unused classes, mixins and variables, then inline ones that
have just a few usages. Also remove a few redundant properties and
replace align-items: center + justify-items: center with place-items:
center.
Replace --ui-scale inline style on the <html> element with font-size set
to UI scale * 10px and modify SCSS D(...) mixin to use the rem unit
instead of multiplying by var(--ui-scale). This makes it possible to get
rid of mixin hell and makes following UI scale in external stylesheets
(mods) much easier.
Replace all instances of D() and S() mixins with rem units. Also,
replace deprecated slash division with math.div as suggested by
dart-sass. Finally, remove the mixins as they are no longer used.
shapez used to have a nice error handler, but later it was removed. To
help debug game in both development and release cases, add a simple
error handler/screen that displays the error stack trace, lists the
installed mods and shows some build information. It also allows copying
this information to the system clipboard.

Having such an error screen should make mod development easier once the
local mod error handling is removed.
Remove try/catch wrappers that just log and/or rethrow the error, use
the cause chain for rethrows with descriptions. Remove inner try/catch
for mod loading to make errors more obvious.
@codeman4033 codeman4033 closed this Jul 3, 2025
@codeman4033 codeman4033 deleted the audio-rework branch July 3, 2025 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

e: renderer enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants