We can get all players who are married. This is a player relationship now with the player. We got all players who are also frogs, and now we have inheritance. We can say, is the player a frog? And we can get as complicated as we want. All players who are members of the frog guild, sworn enemies of cats, but not descendant of frogs, right? So let your imagination run wild. Once you allow your app to be a living database, the freedom to be able to manipulate data, it becomes enticing.
And so I'm introducing here a very experimental library just to kind of get your head in the space that we're thinking called Sweet ECS. It is declarative ECS with deep integration with React, and what I mean by that is that automatically everything that is committed to the view in React becomes an entity that we can add components to. It is powered by the next evolution of Bit ECS. I've been working with Nate Bit on this. That should be out by the time of this talk. And to the right is an example of the API. I'm not going to go through it in detail, but you can see here that we're scheduling in our body component, and we're adding all of our components that create the body to the entity declaratively.
So let's look at how having composable data with composable updates helps us in a problem we were kind of looking at before. We have our MoveInBox component, and before we did a closure where we just got the ref and then we just moved the box. Here, we're going to pass in a update function that is defined stably, and we're going to query the box based off of position, and we gave it a position component below, and then we're going to pull the position store and move it. This is one function that will run for all instances of MoveInBox. And then on the right, and this is a classically annoying problem to do in React right now, we have a perspective camera. We give it the followCamera component. We query for it to get all follow cameras. We gave the box an isFollowTarget component. We query for that. We just take the first result because we assume there's only one target. We iterate over all follow cameras. We get their objects and then we just call the lookAt, and the three object here, again, an experimental API, automatically all entities, all view items get their objects, instances from the ref, added to an object component so we can pull them out and use them inside of the system. And there we go. We got full composability.
Finally, where this lands us is a React ecosystem where we can bring just enough game engine, and I think this is very unique. It's something that we need as web developers in order to move into game development, and it's something that we need PointMandrius, as a community, in order to build an ecosystem of first class physics libraries, UI libraries, got UIKit, we got Rapier, we got Jolt. There's all sorts of other parts going to this. You need character animations, you need controllers, you need camera controls. Being able to composably create all these things in a data-oriented way will let us build out that ecosystem. And importantly, run our games on a web server, because if you're building games on the web, it needs to be multiplayer.
So as I close up, the future React 3 Fiber, that's where we started. The future will have the scheduler built in for V10, V9, it's compatibility release for React 19, V10, we're going to have an elongated beta release where we roll out these new features. The scheduler will let us integrate with the ecosystem, anywhere, anytime. And then we're going to be looking at enabling data-oriented workflows as we move along. Thank you. Check us out on Discord if you want to learn more, and talk to you soon.
Comments