origami_map 1.8.0
Maps library for Dojo based games.
The Origami Map crate is a library that provides map generation and manipulation functionalities for Dojo-based games. It offers efficient implementations of various map-related algorithms and data structures commonly used in game development.
The Map crate focuses on providing tools for creating, manipulating, and navigating 2D grid-based maps. Its primary scope includes:
The crate is designed to work seamlessly with the Dojo engine and other Origami crates.
Add the Origami Map crate from the scarbs.xyz registry:
scarb add origami_map@1.8.0
Or from git, in the [dependencies] section of your Scarb.toml:
[dependencies]
origami_map = { git = "https://github.com/dojoengine/origami" }
Make sure you have dojo installed and configured in your project.
Here are some examples of how to use the Map crate:
use origami_map::map::MapTrait;
let width = 18;
let height = 14;
let order = 0;
let seed = 'SEED';
let maze_map = MapTrait::new_maze(width, height, order, seed);
use origami_map::map::MapTrait;
let width = 18;
let height = 14;
let order = 3;
let seed = 'SEED';
let cave_map = MapTrait::new_cave(width, height, order, seed);
use origami_map::map::MapTrait;
let width = 18;
let height = 14;
let steps = 500;
let seed = 'SEED';
let random_walk_map = MapTrait::new_random_walk(width, height, steps, seed);
use origami_map::map::MapTrait;
let mut map = MapTrait::new_maze(width, height, order, seed);
let position = 1;
let order = 0;
map.open_with_corridor(position, order);
use origami_map::map::MapTrait;
let mut map = MapTrait::new_maze(width, height, order, seed);
let position = 1;
let order = 0;
map.open_with_maze(position, order);
use origami_map::map::MapTrait;
let map = MapTrait::new_maze(width, height, order, seed);
let path = map.search_path(start_position, end_position);
use origami_map::map::MapTrait;
let map = MapTrait::new_maze(width, height, order, seed);
let distribution = map.compute_distribution(10, seed);
Remember to import the necessary traits and types when using the Map crate in your project.
Version 1.8.0
Uploaded 3 weeks ago
License MIT
Size 19.0 KB
Run the following command in your project dir
scarb add origami_map@1.8.0
Or add the following line to your Scarb.toml
origami_map = "1.8.0"