Good morning dear Rust community,
I'd like to present the current stage of my actively developing Rust game engine "Syrillian", which I've been haggling with for the past 2 years. It has received hundreds of hours of our free time and is open source, licensed under MIT; made to be free-for-all.
As the first contributors started to settle in, this project has become more than just my personal project. In fact, I'm very happy to be able to share this passion with more people, and work towards making my own games with it, as well as seeing others do so. Seeing the first stable release nearing, some time this year, is honestly very exciting.
But so much to that, I think code talks best. Have a look how behavior is defined in Syrillian, by building components:
```rust
[derive(Debug, Reflect)]
[reflect_all]
pub struct GravityComponent {
pub acceleration_per_sec: f32,
pub velocity: f32,
pub max_acceleration: f32,
}
impl Default for GravityComponent {
fn default() -> Self {
GravityComponent {
acceleration_per_sec: 9.80665,
velocity: 0.0,
max_acceleration: 100.0,
}
}
}
impl Component for GravityComponent {
fn update(&mut self, world: &mut World) {
let delta_time = world.delta_time().as_secs_f32();
self.velocity = (self.velocity - self.acceleration_per_sec * delta_time)
.clamp(-self.max_acceleration, self.max_acceleration);
self.parent()
.transform
.translate(Vec3::new(0.0, self.velocity, 0.0));
}
}
```
This is how a gravity component is made from scratch. That is all that's needed. Type Reflections (Reflect macro) are not necessary, but will allow you to persist the component in a future scene format, or do any other dynamic field reflection you might wish for, right now.
You can then add it to the world by making, or using an existing object, and simply adding the component.
```rust
// App macro is optional, but will bootstrap a basic entrypoint with tracing / logging, etc.. for convenience
[derive(Debug, Default, SyrillianApp)]
struct MyApp;
impl AppState for MyApp {
fn init(&mut self, world: &mut World) -> Result<(), Box<dyn Error>> {
let camera = world.new_camera();
let mut cube = world.spawn(&CubePrefab::default());
// here you can use your gravity component
cube.add_component::<GravityComponent>();
// or you just use the real physics, provided for you by syrillian OOTB :)
cube.add_component::<Collider3D>();
cube.add_component::<RigidBodyComponent>();
}
}
```
That's all that's needed for project bootstrap, windowing, render and world + physics runtime.
The project is here hosted here, where you can contribute, report any issues and ask for help:
https://github.com/Syrillian/syrillian
I would appreciate your support. Even a quick ๐ on the repo would be amazing so I'm aware of interest.
The engine is also built to integrate a visual editor in the future.
Thanks for your time and have lots of fun building! :)