Skip to content
/ astrox Public

Experimental 2D space-themed game with ClojureScript and Pixi.js

License

Notifications You must be signed in to change notification settings

uds/astrox

Repository files navigation

Overview

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.

Project Setup

How to setup tools

  1. Install Calva (VS Code extension)
  2. Run npm install
  3. 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)

How to run it from command prompt

  1. watch: npm run watch

  2. release: npm run release

  3. start server: npm run server

  4. build report: npm run report

  5. REPL (node): npx shadow-cljs node-repl

How to run REPL in VS Code (Calva)

  1. Calva jack-in CTRL+ALT+C+J
  2. Project type select shadow-cljs
  3. Builds to start :astrox, :test
  4. Alias to launch watch
  5. Select :astrox or :test as server to connect the REPL to.
    NOTE that REPL will work only after the application was run (e.g. app server URL was hit).

Development

How to run the application

  1. pick control server's URL of the shadow-cljs and select application server
  2. OR select first URL displayed by shadow.cljs in the log.
    It's a server that is defined via :astrox build target

How to run unit tests

  1. Got to the unit test server URL.
    It's a server that is defined via :test build target

How to create images atlas for UI resources

  1. Use TexturePacker

Improvements

  1. 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.

  2. 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

Topics

Issues

  1. The SPECS instrumentation will not always pick new specs definition on hot-reload.
    Save core_dev.cljs file in order to refresh SPECS instrumentation

TODO

  • 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

About

Experimental 2D space-themed game with ClojureScript and Pixi.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages