Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
externs add key event externs Apr 29, 2017
gamma @ d637f71 update gamma May 8, 2017
home.rts fix missing comma Apr 29, 2017
js add uv mapping for voxels. inside still missing uv though. May 23, 2016
json update modelSizes Apr 29, 2017
resources/public
scripts switch from figwheel to shadow-devtools May 6, 2017
shaders show team colors on minimap Sep 24, 2015
src.client/game/client make units appear to float in water. parinfer indentation changes. Jan 30, 2018
src.dev.client/game/client fix indentation to work with parinfer Apr 8, 2017
src.dev/game/server fix indentation to work with parinfer Apr 8, 2017
src.scripts/game/scripts rename pack-3d to pack_3d to satisfy compiler Apr 29, 2017
src.shared/game/shared add console timing macro May 7, 2017
src.worker/game/worker add x-vertices and y-vertices Apr 19, 2017
src/game/server switch from figwheel to shadow-devtools May 6, 2017
.gitignore add some ignores Apr 29, 2017
.gitmodules add gamma to project May 7, 2017
Design.md add link Apr 26, 2017
Dockerfile remove/move legacy version Apr 23, 2016
LICENSE
README.md add shadow-devtools link. add TODO in building for production. May 6, 2017
package.json add msgpack-lite May 19, 2016
project.clj add gamma to project May 7, 2017
shadow-cljs.edn switch from figwheel to shadow-devtools May 6, 2017

README.md

Introduction (Legacy version)

My blog about the project is here.

Unfinished project. You can see a demo displaying only free 3D models, not from SC2. The SC2 demo is not working because SC2 file host is not hosting them anymore, but the live code is still up at github pages. If you want to play with the version as seen in demos you should check out the git "legacy" branch. The legacy version is written in JavaScript, while the new version is primarily in ClojureScript.

SC2 files were retrieved from viewer.hiveworkshop.com (not mine) through a heroku CORS proxy.

If the demo doesn't work for you, you can watch videos of it at YouTube:

See also mdx-m3-viewer. All credits to flowtsohg for decoding the M3 format in JavaScript.

Getting started with development environment

  • First
git clone https://github.com/emnh/rts rts
cd rts
git submodule update --init
npm install
./scripts/compile.sh
cp -a home.rts ~/.rts
sed 's/(def standalone false)/(def standalone true)/' -i src.client/game/client/core.cljs

The folder home.rts contains the session-secret for the server and API keys to use social logins. They are all set to "HIDDEN" in home.rts. You will want to customize these for testing social logins or running a production server.

You will need a mongodb instance running on the default port (27017).

Alternative 1: Using shadow-devtools build system

  • Open 2 terminals and run the following:
./scripts/shadow-dev.sh
node node/server.js

I switched to shadow-devtools because the author, Thomas Heller, approached me personally if I wanted to use it. The advantage is that it compiles in parallel and thus is faster than figwheel if you have a system with enough RAM. The setup also needs a lot less configuration than figwheel, having good defaults.

Alternative 2 (deprecated): Using figwheel build system

  • Open 2 terminals and run the following:
./scripts/dev.sh
node js/figwheel.js

You will need to change index.html to comment in the figwheel stuff.

  • Server figwheel runs on port 3450
  • Node (with ClojureScript connected to figwheel on 3450) runs on port 3451
  • Now you can open the dev page

Building for production

TODO: This section is not up to date for shadow-devtools.

lein cljsbuild once prod
lein cljsbuild once prod-client
./scripts/docker-build.sh
./scripts/docker-run.sh

Instead of using docker you can just run js/prod.js.

Source folder layout

Web page layout

Not everything is linked up yet, so overview is here:

  • /: Redirect to /login.
  • /login: Login with auth providers.
  • /logout: Log out.
  • /#lobby: Game lobby for creating/joining games.
  • /#game: Client game testing.

Resources

TODO

  • Bug fix: speed when game (requestAnimationFrame) lags
  • Fix selection for alternative method 1 and 2 (use group position instead of mesh)
  • Enforce limits on new-game and join-game, 1 per user
  • Enforce unique nicknames inside game, make user type one
  • Improvements:
  • Make health bars the same size even if screen boxes change size when rotating view.
  • Register callbacks with on-render instead of direct
  • Add :start and :stop parameters to defcom2 macro instead of positional, expecting more parameters soon.
  • Reuse main renderer for health bars.
  • Performance: Use quads for health bars instead of points.
  • Features:
  • Tri-planar texture mapping for terrain
  • Fix shadows
  • Fog of war
  • FPS hero mode
  • Movement
  • Networking with peer.js
  • Construction
  • Attacking
  • Collisions
  • Minimap controls (click to view area)
  • Health bar occlusion / Z-order
  • Cache minimap terrain and water
  • Reduce MathBox shader compilations (20!)
  • Fix magic stars size
  • Weapons
  • Hide MathBox from minimap
  • Refactor unit spawning and synchronize unit UI elements
  • Fix explosion scaling (voxels do not hit ground anymore)

Component cleanup

  • Pure functions first! The point is to be composable and reusable.
  • Add a prefix to allow multiple components or nest systems (which is recommended against).
  • Pages: What to do? Lifecycle implementation with start-page and stop-page? But this requires keeping the system and calling on it, plus dependencies are not really needed. Perhaps register with router component. Yes. start-page and stop-page must be called from routing component.
  • Would be nice to have these features:
  • Dependencies specified only once at point of usage (can be taken care of via macro)
  • Array of component. Can use name prefix/suffix.
  • Promise based dependency resolution. Hard. May cause terrible error messages.
  • Differentiate between changing page (stop page1; start page2) and reload (stop page; start page).

Authentication

  • Remove authentication for everything except lobby and multiplayer