Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/leinnan/bevy_tiled_blueprints

Ability to read values from Tiled maps straight into Bevy Engine
https://github.com/leinnan/bevy_tiled_blueprints

bevy rust tiled

Last synced: about 2 months ago
JSON representation

Ability to read values from Tiled maps straight into Bevy Engine

Awesome Lists containing this project

README

        

# Bevy Tiled Blueprints

[![Crates.io](https://img.shields.io/crates/v/bevy_tiled_blueprints)](https://crates.io/crates/bevy_tiled_blueprints)
[![Documentation](https://docs.rs/bevy_tiled_blueprints/badge.svg)](https://docs.rs/bevy_tiled_blueprints)
[![MIT/Apache 2.0](https://img.shields.io/badge/license-MIT%2FApache-blue.svg)](https://github.com/bevy_tiled_blueprints/bevy_tiled_blueprints#license)

Ability to read properties from Tiled maps objects straight into Bevy Engine.

## Install

```
cargo add bevy_tiled_blueprints --git "https://github.com/Leinnan/bevy_tiled_blueprints"
```

![simple example](simple_example.png)

![Tiled example](simple_example_tiled.png)

## Usage

| Tiled | Bevy |
|-----|----|
| Object | Entity |
| object.name | Name component |
| Custom property | Component |
| Custom property name | Component struct name |
| Custom property value | Component serialized in ron format |

Supported custom property values:
- empty for unit-like structs without any fields
- int/bool/float for tuple structs with one unnamed fields
- [ron](https://github.com/ron-rs/ron) strings for regular structs
- string properties for enum components
- string properties with names with prefixes `remove:` like `remove:{NameOfComponent}` for removing components.

Custom properties added to the layer or the map itself would be added in the same way to the corresponding entities.

## Examples

Debug rendering of Objects placement can be enabled by adding `TiledBlueprintsDebugDisplayPlugin` plugin to the application.
There is example in `examples/simple.rs`.

## ToDo

- parse different object shapes, for now it just takes `x` and `y` pos and turns that into `Tranform` components
- make example with support for collisions from `bevy_rapier` for example
- create workflow for using [Custom enums and classes](https://doc.mapeditor.org/en/stable/manual/custom-properties/#custom-classes) from Tiled.
Best case scenario- with provided relative path to Tiled project file on game build bevy feeds data about custom properties to project file. It would also require [improvements](https://github.com/mapeditor/rs-tiled/issues/274) in tiled crate
- support for object and file property values.

---

Big thanks to the authors of [bevy_ecs_tilemap](https://github.com/StarArawn/bevy_ecs_tilemap), this whole thing is based on expanding the tiled example from there.
Same thanks to the authors of [Blender_bevy_components_workflow](https://github.com/kaosat-dev/Blender_bevy_components_workflow).

---

Web example has issues with rendering but if you look into console you can see it works.

## Contributing

Got some idea, feedback, question or found any bug? Feel free to open an issue at any time!

## License

`bevy_ehttp` is dual-licensed under MIT and Apache 2.0 at your option.