AstroX is a 2D space-themed game built using ClojureScript and the Pixi.js library. It features a dynamic game environment with various interactive elements, including player ships, meteors, and more. The project is designed to be modular and extendable, allowing for easy addition of new features and game mechanics.
- Install Calva (VS Code extension)
- Run
npm install - Enable binaryage's DevTools custom formatters in Chrome settings (see https://github.com/binaryage/cljs-devtools/blob/master/docs/faq.md#why-some-custom-formatters-were-not-rendered)
-
watch:
npm run watch -
release:
npm run release -
start server:
npm run server -
build report:
npm run report -
REPL (node):
npx shadow-cljs node-repl
- Calva jack-in
CTRL+ALT+C+J - Project type select
shadow-cljs - Builds to start
:astrox, :test - Alias to launch
watch - Select
:astroxor:testas server to connect the REPL to.
NOTE that REPL will work only after the application was run (e.g. app server URL was hit).
- pick control server's URL of the shadow-cljs and select application server
- OR select first URL displayed by shadow.cljs in the log.
It's a server that is defined via:astroxbuild target
- Got to the unit test server URL.
It's a server that is defined via:testbuild target
- Use TexturePacker
-
Reactions: consider to use WeakRef for downstream references (see https://tonsky.me/blog/humble-signals/) Only makes sense to do if reactions are not always disposed by the framework, e.g. when the the user is responsible to do it.
-
Reaction: consider to align with ideas in https://tonsky.me/blog/humble-signals/ and https://dev.to/modderme123/super-charging-fine-grained-reactive-performance-47ph
- Culling
- look at culling lib: https://github.com/davidfig/pixi-cull
- 40k objects render - pixijs/pixijs#6350
- The SPECS instrumentation will not always pick new specs definition on hot-reload.
Save core_dev.cljs file in order to refresh SPECS instrumentation
-
getting following WARNING from PIXI on hot reload: "createTexture.js:10 [Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture."
-
scene in game_screen.cljs has to be reset when exiting game_screen and and then starting game again. Currently it's crashing.
-
resizing game window (making smaller horizontally) on the Level1 will "jump" game objects to bottom of the screen or even below the screen lower bound
- make dedicated game stage container:
-
make it and all children non-interactive -> (set! (.-interactiveChildren xxx) false)
-
disable mouse cursor for game screen (set! (.-cursor screen) "none") (set! (.-eventMode screen) "static")
-
Touch is not working for buttons?
-
Fix Pixi error in sprite tweening on hot reload -> still after recent "fix" with re-creation of shared ticker