#rogue-like #libtcod #gamedev #game-engine

doryen-extra

Doryen-extra aims to be a loose re-implementation of the utility features from the popular roguelike library named libtcod

3 unstable releases

0.2.1 Mar 14, 2021
0.2.0 Mar 14, 2021
0.1.0 May 23, 2020

#801 in Game dev

BSD-3-Clause

295KB
5K SLoC

Crates.io Docs.rs CI MacOS License Code coverage

Doryen-extra

Doryen-extra aims to be a loose re-implementation of the utility features from the popular roguelike library named libtcod, which is also known as the Doryen Library. The doryen-rs crate fulfills the re-implementation of the game engine part of the library, but is otherwise (at the time of writing) missing a lot of the features that were present in libtcod.

After finding myself frustrated with the various limitations and hassles that are involved when wrapping a C library in rust, which is what the tcod crate has done, I decided to just go all-in and re-code the library in Rust.

While I could've just copied and pasted the code as it was, and turned it into Rust with minimal modifications, I wanted to make it a proper Rust library, so it has been coded with retaining functionality in mind, but not with retaining form. By that, I mean that all the functionality you're used to from libtcod should be present, but how it's accessed or used may vary greatly from the original.

Features

doryen

While this library is called doryen-extra, I didn't actually want to force it to be tied to the doryen-rs library, so functionality that pertains to it is behind the feature doryen. If you want to use this library without bringing in doryen-rs as a dependency, just put

[dependencies]
doryen-extra = { version = "...", default-features = false }

in your Cargo.toml file, which removes the default doryen feature.

libtcod-compat

This feature restores (on a best-effort basis) the functionality of the original libtcod library, where it has been modified. At the time of writing, the only change that will happen is to the floating point number generation of the RNG algorithms.

rng_support

With this feature enabled, the Random struct implements rand_core::RngCore and rand_core::SeedableRng, which lets it be used in any place that accepts the rand crate RNGs.

serialization

With this feature enabled, all types for which it makes sense to serialize will implement serde::ser::Serialize and serde::de::Deserialize. NOTE: More types may get implementations for this in the future.

Missing Features / Toolkits

The following toolkits from libtcod have not yet been converted, with possible reason given in parenthesis:

  • bsp toolkit: 2D Binary Space Partition
  • fov toolkit: Easily calculate the potential visible set of map cells from the player position
  • image toolkit: Some image manipulation utilities (undecided on whether to convert this one; other crates may already serve this purpose)
  • list toolkit: A fast, lightweight and generic container, that provides array, list and stack paradigms (use Vec instead)
  • namegen toolkit: Allows one to generate random names out of custom made syllable sets (parts requires parse toolkit)
  • parse toolkit: An easy way to parse complex text configuration files

Dependencies

~2–17MB
~168K SLoC