GithubHelp home page GithubHelp logo

pafizz / d2-mapserver Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hu71e/d2-mapserver

0.0 0.0 0.0 13.58 MB

Needed for d2-mapview to work (banned as of 13/10/2022)

License: GNU General Public License v3.0

Shell 0.36% JavaScript 9.59% AutoHotkey 2.68% TypeScript 85.01% Batchfile 0.86% Dockerfile 1.50%

d2-mapserver's Introduction

D2 Map server

This is a REST API to serve Diablo 2 maps for a given seed, difficulty, and map id.

In Diablo 2 and Diablo 2 Resurrected, the maps are randomly generated based on a seed value. This will take that seed value (and difficulty) and use Diablo 2 (classic)'s map generation to extract collision data.

This data can then be used to render an image of the map.

This repo leverages this package - blacha/diablo2. d2-mapserver uses a modified version of that executable to get map data.

Installation

See INSTALLATION.md

By default it uses port 3002. If you want to use a different port you can set a windows environment variable called PORT.
Or you can open the map server in a batch file, e.g.:

set PORT=3113
START d2-mapserver.exe

Simple instructions for Linux users:

  1. Your system needs to have docker.
  2. Use dockerbuild.sh to compile the docker image.
  3. Start the docker container using dockerstart.sh. You need to prepare a cache directory, and D2-LoD 1.13c game files.

Endpoints

Map image

Returns a PNG of the given map.

http://localhost:3002/v1/map/:seed/:difficulty/:mapid/image

e.g. http://localhost:3002/v1/map/54534535/2/49/image

You can also add query parameters onto the URL to change the generated image

Parameter Default Description
isometric false This will make the map appear in the normal isometric perspective
trim false Trims any whitespace surrounding the map image
edge false Draws the map as an outline instead of grey blocks
wallthickness 1.0 Only applies for edge mode, but is the wall thickness, can be a decimal
serverScale 2 Render scaling of the map image, larger the size the bigger the image
verbose false Will mark ALL objects/NPC map data on the map image, used for debugging
pathFinding true Turn on to draw paths between wps and exits, if you don't specify a start and end it will draw all paths
pathStart <x,y> This value can be 'x,y' e.g 5341,1432 or it can be 'wp' for the waypoint, or just the exit number for a specific exit
pathEnd <x,y> This is the same as start. Note that 'pathFinding=true' needs to be set for pathstart and end to work

e.g. http://localhost:3002/v1/map/54534535/2/49/image?edge=true&wallthickness=2&isometric=true

JSON Data

Same as above URL but without /image. Returns the JSON payload used to create the map image.

http://localhost:3002/v1/map/:seed/:difficulty/:mapid
Parameter Default Description
pathFinding true Turn on to draw return path data between wps and exits, if you don't specify a start and end it will create all paths
pathStart <x,y> This value can be 'x,y' e.g 5341,1432 or it can be 'wp' for the waypoint, or just the exit number for a specific exit
pathEnd <x,y> This is the same as start. Note that 'pathFinding=true' needs to be set for pathstart and end to work

Seed

  • 4 byte value which is written in decimal. Number between 0 and 4294967295

Difficulty

  • 0 - Normal
  • 1 - Nightmare
  • 2 - Hell

MapId

  • Number between 1 and 132, for each level of Diablo 2. Refer to src/static/mapRefData.json for more info.

Map examples

Canyon of the Magi Durance of Hate level 2 Arcane Sanctuary

d2-mapserver's People

Contributors

joffreybesos avatar mengqin1 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.