- python 3.x
- npm
- webpack-cli
- OSX:
- install homebrew: http://brew.sh
- install python + npm:
brew install npm python3
- Linux:
- install python + npm:
sudo apt update && sudo apt install npm python3.7 python3-pip
- install python + npm:
- Windows:
- install WSL + follow the linux instructions
- or, get some kind of *nix environment, and install npm + python3 on windows
- if you're using gitbash, you will need to follow these instructions, but with your latest python install (ideally python 3.8/3.7/3.6): https://stackoverflow.com/a/35471370
Lastly, install webpack-cli: npm install -g webpack-cli
git clone https://github.com/seijiemery/dungeon-generator
cd dungeon-generator
pip3 install -r requirements.txt
npm install
./run.sh isometric_render_test
Procedural dungeon generator implemented for CMPM 147 over ~2 weeks. Uses a very simple phaser renderer and these asset packs from kenney.nl:
- https://www.kenney.nl/assets/isometric-dungeon-tiles
- https://www.kenney.nl/assets/isometric-library-tiles
Javascript generator code in src
:
src/tests/
: code entrypoints + regression tests. Each.js
file here generates a corresponding.html
file (and webpack.js
file) inbuild/
. To run these tests use./run.sh <filename-without-the-js-extension>
from the root directory.src/generators
: room generators, etcsrc/core/
: utils, incl a 2d array implementation and code to draw and work with isometric tiles in the specific format that we're using, ie. 256x512 images containing individual 256x128 tiles centered at (128, 64). No, we did not use http://rotates.org/phaser/iso/ at all b/c we're stupid (and writing this from scratch was more fun) ¯_(ツ)_/¯src/astar/
: A* pathfinding implsrc/generated/
: code generated bytools/
:assets.js
(generated code to load all.png
assets based off asset manifests inbuild/assets/
andassets/asset_config.js
), andconfig.json
(just contains the values inconfig/config.yaml
, but in a way that can be imported into the webpack build and w/out adding additional libraries for.yaml
loading)
Assets + asset configuration file in assets
:
- zipped kenney.nl asset packs (unzipped to
build/assets/
) assets/asset_config.yaml
:- tells which kind of asset perspective to use (values: {
Isometric
,Angled
}) - defines asset categories (eg. walls, floors, objects, stairs) along w/ a list of assets. Each asset (eg.
stoneWall
) corresponds to all facings / orientations of that asset (eg.stoneWall_N
,stoneWall_E
, etc)
- tells which kind of asset perspective to use (values: {
Python backend, server, and tools in tools
:
tools/extract_assets.py
: extracts, summarizes, and can preprocess (TBD) isometric kenney.nl asset packs stored inassets/
. Notably, this generates asset info (as yaml files) inbuild/assets.yaml
andbuild/assets/<asset-pack>.yaml
for isometric oriented tiles (note: sprites for N, S, E, W directions), and sprite animations (TBD). These.yaml
files can be used by...tools/rebuild_phaser_renderer.py
: assembles a phaser game from an html template with jinja2 markup (templates/phaser_template.html
), javascript files (TBD), and generated javascript (TBD); the latter of which should handle asset loading from data inbuild/assets.yaml
, etc. The output of this isbuild/example.html
.tools/simple_server.py
: runs a small http server to serve / display html + js files (generated byrebuild_phaser_renderer.py
+webpack
), and assets (unpacked.pngs
fromextract_assets.py
). Useswatchdog
to detect file changes + re-run the python + webpack pipeline, andwebbrowser
(builtin) to rebuild + reopen / browse to an observed js file (note: corresponds to the single optional argument to./run.sh [<file>]
, eg../run.sh barrel
). The server will by default run atlocalhost:5000
(or whateverPORT
is set to insimple_server.py
), and will attempt to reconnect at consecutive addresses (ie.localhost:5001
,localhost:5002
, etc), for up to N (default10-20
) tries, iff the port is blocked. As the port isn't necessarily constant, the currently active server URL is currently written tobuild/server.yaml
, for ease of development.- note that everything in
build/
is explicitely not tracked by git + will be built from code, raw assets, and config files using python scripts intools/
. Do NOT attempt to modify or commit anything inbuild/
, as everything in that directory is machine generated from other sources.
To install anaconda within sublime:
- press shift+ctrl/cmd+p => type "install" => press enter on "Package Control: install package".
- type "anaconda", select, and press enter to install the anaconda python plugin.
Python code must be:
- space delimited, at 4 spaces / indent
- follow PEP8: https://www.python.org/dev/peps/pep-0008/
Note that with the anaconda package, invalid code formatting will be shown in sublime using white boxes. You can fix most formatting errors by typing <shift+ctrl/cmd+p> => "autof" => press enter on "Anaconda: Autoformat PEP8 Errors". This will also show the keybinding for this command, if you want to use that instead.