7e3aff557b
* improve AssetManager implementation Notable changes are: * removed the individual managers inside of d2asset, only one asset manager * AssetManager now has caches for the types of files it loads * created a type for TextDictionary (the txt file structs) * fixed a file path bug in d2loader Source * fixed a asset stream bug in d2loader Asset * d2loader.Loader now needs a d2config.Config on creation (for resolving locale files) * updated the mpq file in d2asset test data, added test case for "sub-directory" * added a Data method to d2asset.Asset. The data is cached on first full read. * renamed ArchiveDataStream to DataStream in d2interface * moved palette utility func out of d2asset and into d2util * bugfix for MacOS mpq loader issue * lint fixes, added data caching to filesystem asset * adding comment for mpq asset close * Decouple d2asset from d2render Notable changes in d2common: * d2dcc.Load now fully decodes the dcc and stores the directions/frames in the dcc struct * un-exported dcc.decodeDirection, it is only used in d2dcc * removed font interface from d2interface, we only have one font implementation * added `Renderer` method to d2interface.Surface, animations use this to bind to a renderer and create surfaces as they need * added `BindRenderer` method to animation interface Notable changes in d2common/d2asset: * **d2asset.NewAssetManager only needs to be passed a d2config.Config**, it is decoupled from d2render * exported Animation * Animation implementation binds to the renderer to create surfaces only on the first time it is rendered * font, dcc, dc6 initialization logic moved out of asset_manager.go * for dc6 and dcc animations, the process of decoding and creating render surfaces has been broken into different methods * the d2asset.Font struct now stores font table data for initialization purposes Notable changes in d2core/d2render: * Surfaces store a renderer reference, this allows animations to bind to the renderer and create a surface just-in-time **These last changes should have been a separate PR, sorry.** Notable changes in d2core/d2ui: * ui.NewSprite now handles creating an animation internally, only needs image and palette path as arguments Notable Changes in d2game: Because of the change in d2ui, all instances of this code pattern... ```golang animation, err := screen.asset.LoadAnimation(imgPath, palettePath) sprite, err := screen.ui.NewSprite(animation) ``` ... becomes this ... ```golang sprite, err := screen.ui.NewSprite(imgPath, palettePath) ``` |
||
---|---|---|
.circleci | ||
.github | ||
.vscode | ||
d2app | ||
d2common | ||
d2core | ||
d2game | ||
d2networking | ||
d2script | ||
docs | ||
scripts | ||
.editorconfig | ||
.gitignore | ||
.golangci.yml | ||
.travis.yml | ||
build.sh | ||
CODE_OF_CONDUCT.md | ||
CONTRIBUTORS | ||
d2discord.png | ||
d2logo.ico | ||
d2logo.png | ||
go.mod | ||
go.sum | ||
LICENSE | ||
main.go | ||
README.md | ||
rh.exe | ||
tagdev.bat |
OpenDiablo2
Join us on Discord!
Development Live stream
Support us on Patreon
We are also working on a toolset:
https://github.com/OpenDiablo2/HellSpawner
Please consider helping out with this project as well!
About this project
OpenDiablo2 is an ARPG game engine in the same vein of the 2000's games, and supports playing Diablo 2. The engine is written in golang and is cross platform. However, please note that this project does not ship with the assets or content required to play Diablo 2. You must have a legally purchased copy of Diablo 2 and its expansion Lord of Destruction installed on your computer in order to run that game on this engine. If you have an original copy of the disks, those files should work fine as well.
We are currently working on features necessary to play Diablo 2 in its entirety. After this is completed, we will work on expanding the project to include tools and plugin support for modding, as well as writing completely new games with the engine.
Please note that this game is neither developed by, nor endorsed by Blizzard or its parent company Activision.
Diablo 2 and its content is ©2000 Blizzard Entertainment, Inc. All rights reserved. Diablo and Blizzard Entertainment are trademarks or registered trademarks of Blizzard Entertainment, Inc. in the U.S. and/or other countries.
ALL OTHER TRADEMARKS ARE THE PROPERTY OF THEIR RESPECTIVE OWNERS.
Building
To pull the project down, run go get github.com/OpenDiablo2/OpenDiablo2
On windows this folder will most likely be in C:\users\(you)\go\src\github.com\OpenDiablo2\OpenDiablo2
In the root folder, run go get -d
to pull down all dependencies.
To run the project, run go run .
from the root folder.
You can also open the root folder in VSCode. Make sure you have the ms-vscode.go
plugin installed.
Linux
There are several dependencies which need to be installed additionally.
To install them you can use ./build.sh
in the project root folder - this script takes care of the installation for you.
Contributing
The imports for this project utilize github.com/OpenDiablo2/OpenDiablo2
. This means that even if you clone the repo, changes will not be taken as it will
still pull from the main repo's files. In order to use your local version, add the following to go.mod
in the base folder:
replace github.com/OpenDiablo2/OpenDiablo2 => /your/forked/import/path
This will tell go to use your local path instead of the official repo. Be sure to exclude this change from your pull requests!
If you find something you'd like to fix thats obviously broken, create a branch, commit your code, and submit a pull request. If it's a new or missing feature you'd like to see, add an issue, and be descriptive!
If you'd like to help out and are not quite sure how, you can look through any open issues and tasks, or ask for tasks on our discord server.
VS Code Extensions
The following extensions are recommended for working with this project:
- ms-vscode.go
- defaltd.go-coverage-viewer
When you open the workspace for the first time, Visual Studio Code will automatically suggest these extensions for installation.
Alternatively you can get to it by going to settings Ctrl+,, expanding Extensions
and selecting Go configuration
,
then clicking on Edit in settings.json
. Just paste that section where appropriate.
Configuration
The engine is configured via the config.json
file. By default, the configuration assumes that you have installed Diablo 2 and the
expansion via the official Blizzard Diablo2 installers using the default file paths. If you are not on Windows, or have installed
the game in a different location, the base path may have to be adjusted.
Profiling
There are many profiler options to debug performance issues. These can be enabled by suppling the following command-line option and are saved in the pprof
directory:
go run . --profile=cpu
Available profilers:
cpu
mem
block
goroutine
trace
thread
mutex
You can export the profiler output with the following command:
go tool pprof --pdf ./OpenDiablo2 pprof/profiler.pprof > file.pdf
Ingame you can create a heap dump by pressing ~
and typing dumpheap
. A heap.pprof is written to the pprof
directory.
You may need to install Graphviz in order to convert the profiler output.
Roadmap
There is an in-progress project roadmap, which will be updated over time with new requirements.
Screenshots
Additional Credits
- Diablo2 Logo
- Jose Pardilla (th3-prophetman)
- DT1 File Specifications
- Paul SIRAMY (http://paul.siramy.free.fr/_divers/dt1_doc/)
- Other Specifications and general info
- Various users on Phrozen Keep