React? R3F? #2388
Replies: 8 comments 16 replies
-
We could use some JS framework for sure, just not sure about React, usually not keen about using the "go-to" ancient project. I'll have another look at react and R3F as well, as I'm somewhat way more inclined on lesser known frameworks. There are some upcoming issues regarding AB reaching a point to include the website stuff within the game itself, so that when you go to the main domain, you'll find the game straight up and you'll have a menu for documentation/artwork and one for the footer stuff (social links and ways to contribute), so a framework being adoption should nicely facilitate that nicely. |
Beta Was this translation helpful? Give feedback.
-
I've helped a fair number of new programmers get started with React. React went through a transition from the original class-based components to function-based components – both still exist in the API, but function-based components are favored by the community. Imho, function-based components really trip up newcomers. OTOH, there are lots of official and unofficial how-tos for doing common operations "the right way", so once you realize that you need to look things up, it's usually not a problem to find the missing information. Vue is less popular and I haven't helped many people use it, but they still got confused by it, even if the API is arguably more straightforward than React's. Not an argument one way or another. Just passing on what I've seen.
I don't expect that Vue will disappear anytime soon, but Tres is really in the early stages. It's under active development, but the team is small so far. There's no telling if it'll survive. R3F takes up a lot of oxygen in the relatively small market of "I use a reactive library and need reactive 3D components". Tres uses some R3F source off the shelf and wraps it in the Vue API. I guess if we want an absolutely safe bet, it'd be to use WebGL, or possibly just Three.js (without Vue+Tres/React+R3F). Or maybe something in between WebGL and Three.js, like twgl. That has the downside that many new developers find it really hard to approach though.
I'm a longtime Blender noob. If you haven't taken it, you might be interested in Bruno Simon's paid course on three.js. It shows how to get Blender content on the web using Three. It's now got a section on using React + R3F apparently. I took it about a year ago and it helped me finally get my head around Three.js, but it didn't have the R3F section at the time. |
Beta Was this translation helpful? Give feedback.
-
Yeah, figured React might be somewhat "two-faced" like that because of some transition.
Like I was saying, Vue had examples before it in order to figure out some important do's and don'ts, which can make things way cleaner overall.
Understood. Well, I like the "Tres" branding and website and I also think that Vue could become way more popular given time.
I'm not opposed to just using Three.js, but first I have to wrap my head around the needs of this project (AB) when it comes to stuff that's needed down the road and what actually useful stuff do frameworks like React and Vue actually bring to the table in order to facilitate any needs to fulfill the specs at hand, as well as upcoming ones and the overall vision (bigger picture), so I need to somewhat predict how well will some of the things scale or adapt because trends will change along with technologies.
I've looked at some three.js tutorials before; I'm a crappy coder and probably won't end up implementing that sort of stuff myself anytime soon at least, but the tuts where good to view at very least so that I could get a better idea of how the process works and what's under the hood; I usually do that sort of things with all the domains that are involved in game development so that I can have a more realistic expectation of things by being able to understand technical limitations plus it also helps out knowing the vocabulary, that way I can talk and coordinate with others specialized in those fields.
Good to hear. After we'll manage to have online multiplayer in good shape at some point, development focus will shift towards a planned add-on game mode for AB that will be more "MMO" and season based. It will involve economy, town building (units will have their own dwelling structures) and even sieges. Someone just followed me on ArtStation and he's a Blender user with quite a few works posted, many in the direction of those structures and dwellings that will be needed, so I might poke him soon about this. Timing helps because I was constantly thinking about having the towns 3d or at very least the dwellings and structures themselves instead of just doing them the very old fashioned way with pre-rendered 2d sprites, since this way we can implement some animations way nicer if needed and also offer some eye candy if allowing rotations or some limited camera movement. |
Beta Was this translation helpful? Give feedback.
-
@andretchen0 Would R3F also fix our hex grid problem? What's your take on Angular.io and its three.js support? |
Beta Was this translation helpful? Give feedback.
-
I don't have any expectation one way or another that you'd swap the whole codebase for a refactored one written in Vue/Three.js, but I'm enjoying giving it a shot. |
Beta Was this translation helpful? Give feedback.
-
Yeah, it's not that they aren't compatible. It's that there's not a component library for Angular that's got traction, afaik. That's what R3F and Tres are. In order to compose/modify a Three.js scene with Angular (or without any framework at all), you have to write imperative JS. That looks a lot like what we're currently doing with Phaser and it's tough to get right – and continue to get right. Here's a bit of code from the article:
If you have a component library like R3F or Tres and a data store, that looks like this:
That's a pretty neat trick. Want to remove the cube? Just remove But what's really neat here is that the camera comes from the store. Because the store camera is reactive and bound to the But there's more. The store holds the business rules for how its data is mutated. So, if there's a button push in the view, the view just calls a method on the store. The store decides how to update its own data and that update is automatically propagated through the view. So, we cut down on this kind of code mixing, where data, business rules, and presentation are bound together:
... and we make it harder for future contributors to write code like that in the first place. |
Beta Was this translation helpful? Give feedback.
-
From the latest Phaser news letter:
|
Beta Was this translation helpful? Give feedback.
-
Seems there's something new based on React that came out recently and works well with Phaser as well! 🥳 Web framework: https://remix.run |
Beta Was this translation helpful? Give feedback.
-
There was a little talk about using a more modern JS framework some time ago. I wonder if there are any feelings for/against using React and possibly React-Three-Fiber (R3F) for some future release?
In particular:
Just looking for feedback
Beta Was this translation helpful? Give feedback.
All reactions