Diablo II Resurrected Library
A Diablo II Resurrected library for core and simple client functionality, written in Rust for performance, safety and re-usability.
This effort is very much WIP, so it is not available on crates.io yet.
If you are interested in Diablo II and/or Rust, this might be fun!
Goals
- cross platform without runtime/VM requirement
- provide game internal data structures and utility functions
- savegame load/save support (for e.g. character editors, armory-style webpages)
- implement the network protocol as fully supported as possible (i.e. however much is known publically)
- reproduce game state as accurately as possible/needed
Milestones
- network protocol support
- D2GS (plain)
- D2GS (compressed)
- BNCS (It if is used in D2R at all)
- MCP Realm Logon
- Game State Data Structures.
- Items and Buffers (Ground, Inventory, Stash, Cube, Belt)
- Players (WIP)
- Players Quest Progression
- NPCs (WIP)
- Party/Hostile
- Game Quest Progression
- Maps (generate from game seed, take from d2bs)
- Pathing(?)
- Client object
- shadow client (packet listener w/ game update loop WIP)
- active client / protocol state machine
How to Build
Linux
cargo build --release
Mac Os
cargo build --release
(not tested yet)
Windows
You will need to install npcap and additionally download the WinPcap Developers Pack as per the libpnet build instructions for Windows. Then point your user environment variable LIB
(create if nonexistent) to the folder where to find Packet.lib i.e. WpdPack/Lib/x64/
from the WinPcap Developers Pack you just downloaded. Then cargo build --release
This should get the project building but the executable crashes while querying the available network interfaces on my machine (maybe need to adapt code for windows).
At this early stage i haven't created any bindings, but Python/JS would be useful to many people I guess.
Usage
One simple use case that is supported now is launching a listening client/connection to sniff d2gs packets:
use libd2r::Client;
fn main() {
let mut client = Client::new();
client.start()
}
Plase note that it does not fill any internal game data structures as of now (state update handling is still WIP). It will just filter, decode and print packets.
Contributing
This is quite the challenge so any help is appreciated!
There is quite a bit of awesome code out there, but scattered across various sources.
Maybe you want to help translating this d2r savegame utility from go?
Or help with the map generation from game seed? It exists in several projects (d2bs, opendiablo, opend2, ...) and shouldn't have changed for D2R.
Disclaimer
Little of this works yet and most probably never will. Unless you feel like contributing, which is welcome, it is mostly an exercise.
Here are some great resources on the original game:
- client-less C# bot by dkuwahara
- a blog post by Eric Carmichael
- and, of course, D2BS
- Another good resource is the diablo 2 protocol js library.