• Stars
    star
    167
  • Rank 226,635 (Top 5 %)
  • Language
    JavaScript
  • License
    GNU General Publi...
  • Created over 9 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Real Time Strategy

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

More Repositories

1

PixelArtSearch

Pixel art search engine for opengameart
Python
93
star
2

js-to-reasonml-transpiler

JavaScript to ReasonML transpiler for small code examples
JavaScript
56
star
3

rts-reasonml

Experimental ReasonML implementation of rts game
OCaml
47
star
4

glsl-graph

WebGL GPGPU Graph Layout
Clojure
21
star
5

rts-blog

A blog about creating an RTS in WebGL
CSS
11
star
6

rts-models

Contains free models and textures for rts game
9
star
7

bookmarks

Bookmarks and resources
7
star
8

opengameart

Categorizing OpenGameArt
JavaScript
5
star
9

chatgpt-coding

A repository about general ChatGPT coding
5
star
10

majaho

Make JavaScript HomoIconic
JavaScript
4
star
11

glsl-planets

GLSL implementation of planets (N-body simulation)
JavaScript
4
star
12

boolwidth

Boolean width
Java
3
star
13

js-canvas-points-in-the-plane

Happy New Year Procedural Art Generator
JavaScript
2
star
14

tda-wasm

Tower Defense: Analysis - Webassembly Version
C++
2
star
15

roguelikes

Rogue Likes
JavaScript
2
star
16

pixel-tower-defense

PixelTD: Pixel Tower Defense
JavaScript
2
star
17

rpg_art

AI Generated RPG Art using Stable Diffusion 1.4 and 1.5
2
star
18

test

Various JS/Web development
JavaScript
2
star
19

rentmap

Python
1
star
20

c2js-compiler

Simple C to JavaScript compiler built on Python+Clang
JavaScript
1
star
21

VB6ToCSharpCompiler

A VB6 to C# compiler
C#
1
star
22

pcat

pcat: fast threaded data flow statistics generator for piped data
C
1
star
23

pixel-scaling

Pixel scaling using hqx filters in GLSL
JavaScript
1
star
24

card-meta-game

An MTG / HS inspired card game with automatic meta game balancing
OCaml
1
star
25

homedir

Configuration files like .bashrc and .vimrc
Vim Script
1
star
26

recursio

A recursive sandbox factory simulation game
JavaScript
1
star
27

generative

Generative Algorithms, see http://inconvergent.net/generative/
JavaScript
1
star
28

conveyor-layer

Conveyor Layer: A GPU based game
JavaScript
1
star