Skip to content

Commit

Permalink
Update CHANGELOG.md
Browse files Browse the repository at this point in the history
  • Loading branch information
splashdust committed Mar 15, 2024
1 parent 5e57f6f commit 69a7698
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,72 @@
# Changelog

## 0.5.0

Add support for multiple parallell world instances

**Breaking changes:**

Configuration is now supplied when adding the plugin

```rust
// First declare a config struct. It needs to derive `Resource`, `Clone` and `Default`
#[derive(Resource, Clone, Default)]
struct MyWorld;

// Then implement the `VoxelWorldConfig` trait for it:
impl VoxelWorldConfig for MyWorld {
// All the trait methods have defaults, so you only need to add the ones you want to alter
fn spawning_distance(&self) -> u32 {
15
}
}
```

Then when adding the plugin:

```rust
.add_plugins(VoxelWorldPlugin::with_config(MyWorld))
```

If you don't want to change any default config, you can simply do this:

```rust
.add_plugins(VoxelWorldPlugin::default())
```

Adding multiple worlds follows the same pattern. Just create different configuration structs and add a `VoxelWorldPlugin` for each.

```rust
.add_plugins(VoxelWorldPlugin::with_config(MyOtherWorld))
```

Each world instance can have it's own configuration and will keep track of it's own set of voxel data and chunks.

### The `VoxelWorld` system param now needs a type parameter to specify which world instance you want to select

The configuration struct adds the config values and its type also acts as a marker for the world instance.

```rust
fn my_system(
my_voxel_world: VoxelWorld<MyWorld>,
my_other_voxel_world: VoxelWorld<MyOtherWorld>
) {
// Set a voxel in `my_voxel_world`
my_voxel_world.set_voxel(pos, WorldVoxel::Solid(voxel_type))

// Set a voxel in `my_other_voxel_world`
my_other_voxel_world.set_voxel(pos, WorldVoxel::Solid(voxel_type))
}
```

If you initialized the plugin with `::default()`, you still need to explicitly specify the instance as `DefaultWorld`:

```rust
fn my_system(voxel_world: VoxelWorld<DefaultWorld>) { ... }
```

The `VoxelWorldRaycast` system param now also requires the same config type paramter as described above.

## 0.4.0

- Update to Bevy 0.13
Expand Down

0 comments on commit 69a7698

Please sign in to comment.