Skip to content

Phoenix App, game engine, 2d dungeon. Create your own maps with customizable scripted tiles or use many of the readymades to build puzzles.

Notifications You must be signed in to change notification settings

callahat/dungeon_crawl

Repository files navigation

DungeonCrawl

This is a retro style top down multiplayer client/server game engine. The application acts as the server (which can be networked or just run locally) and the gameplay takes place in a web browser. Greatly inspired by ZZT this project is an attempt to recreate some of the simplistic experiences of character driven graphic games.

Running Via Docker (for development)

For those who prefer to not install all sorts of dependencies on their development system Docker may be used.

To start the app server container and postgres container, run:

docker compose up

Additional helpful commands

To launch an interactive iex shell running the app (with the ability to run and hit the application server at some point) run:

docker compose run --rm --service-ports dcrawl

Or to run a bash shell (and allow iex to be started manually) start postgres then run app:

docker compose run --service-ports --use-aliases --rm -d postgres
docker compose run --rm --use-aliases --publish 4000:4000 app bash

(The app service route, for the first time you will need to run docker/init.sh manually to get erlang, elixir, node, etc)

If its your first time, this can be a lengthy process if building the image.

To clear destroy the containers and remove the dcrawl image:

docker compose down --rmi local

To also remove all the volumes (ie, delete all the DB data, downloaded mix deps, etc)

docker volume rm dungeon_crawl_asdf dungeon_crawl_build dungeon_crawl_deps dungeon_crawl_node dungeon_crawl_postgres dungeon_crawl_static dungeon_crawl_tmp

Running

When running docker there are many ways. After setup, simplest is

docker compose up

Or, as mentioned above a docker compose run ... described above may be uesd. This could be convenient if needing to also run tests or troubleshoot npm or debug. The postgres container will need to be running - if running the dcrawl container, this will be started. If going the app service route, be sure to run docker compose run --rm -d postgres to start the postgres container first, otherwise you'll get DBConnection.ConnectionError should postgres not be up.

Now you can visit localhost:4000 from your browser.

Running via Local without Containers

There are several dependencies needed. Many of these can be found in the Dockerfile or init.sh. Depending on your local OS installation may differ.

Other setup

  • Install dependencies with mix deps.get
  • Install Node.js dependencies with npm install in the assets directory

To Start the app:

mix phx.server

or

iex -S mix phx.server

to have an interactive shell running with your server. This ties a console to the running server, and you can also create execute elixir statements without having to start a separate console.

Now you can visit localhost:4000 from your browser.

Setting up the Database

The database will need setup via mix ecto.create && mix ecto.load, or mix ecto.create && mix ecto.migrate if you prefer taking your time. You'll want to iex -S mix and create a super use for yourself, and load the asset seeds.

DungeonCrawl.Account.create_admin(%{name: "Admin", username: "Admin", password: <changeme>, user_id_hash: :base64.encode(:crypto.strong_rand_bytes(24)), is_admin: true})

DungeonCrawl.TileTemplates.TileSeeder.seed_all
DungeonCrawl.Sound.Seeder.seed_all
DungeonCrawl.Equipment.Seeder.seed_all

# You can create a Joinable dungeon with this, or just import one of the json exports in the root path.
DungeonCrawl.Dungeons.generate_dungeon(DungeonCrawl.DungeonGeneration.MapGenerators.ConnectedRooms,
  %{autogenerated: false, active: true, name: "Seeded Joinable Dungeon"},
  %{width: 40, height: 20},
  true)

Learn more

Ready to run in production? Please check our deployment guides.

About

Phoenix App, game engine, 2d dungeon. Create your own maps with customizable scripted tiles or use many of the readymades to build puzzles.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published