-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FPS issues #68
Comments
Hi @gokadi, I've never used the Have you tried using PureComponent or React.memo to optimize your entity rendering? That might help, but probably not to an acceptable level.
Not sure exactly what you meant by this 👆. You can try remove the timers and intervals completely to see what affect it has on your FPS. If there is an improvement, you should be able to refactor-out the timers and intervals because your systems are provided with timing information that you should be able to use to drive spawning etc without the need for timers and callbacks. Also, is the horrible FPS on iOS, Android or both? In my experience, Android performs worse than iOS from my experience. |
Hi @bberak ! Thanks for quick response. Related to
Unfortunately it cannot be very clear experiment, because enemies' shooting is made using interval. So, if I remove this interval, amount of entities on the screen would strongly decrease.
Thanks for the advice, probably this will help. I'll try to modify some parts of code to rely on system's time from args.
Well, actually on both. But some old android simulators start loosing FPS much earlier. For example, on android 6 I see fps loss even in the main menu, where there are about 10 entities only. |
Did you or someone else performed tests to collect any statistics about this? Or probably you know something cloe to this statistics for React Native itself? |
Hey @gokadi, I was playing around with particle systems using React Native and found the FPS dropped horrible when I had about 30-60 basic particles on the screen. This was on older hardware - but your audience might not be running the latest and greatest devices either. If you change the renderer out to something like GLView, you will probably get better performance - but this will require some effort on your part. However, if your project is commercial in nature, I would probably avoid React Native (for the time being) for your "bullet hell" style game. Chances are you will run into some bottlenecks or performance issues due to the large number of entities, particles and effects you will have on the screen at one time. If this is a personal project, then I guess you can afford to live on the edge a bit |
That’s sad 😞 Well, as I got it from expo doc, I can generate native code and work with it,can I? So I can continue develop it using rnge and at some moment split it to 2 native projects for iOS and Android and check/fix performance issues there? |
Hey @gokadi, Yeah, if you create your project with Expo, you should be able to integrate your own native code for iOS and Android as required. However, I'd say that this would be a pretty big cost in terms of effort. You'll have 2 native modules to maintain, plus all the JS logic running on RNGE. And then there's the issue of what to keep in JS/RNGE and what to move over to native code.. For example, if you move the physics over to native, you'll still need to inform the JS side of the collisions etc. Anyway, I don't wish to turn you off React Native (or RNGE for that matter). I love JavaScript and think there is a future in it for native mobile game development and scripting. I just don't want to overstate the capabilities of the platform in its present form. Let me know your thoughts and in which direction you end up going 🙏 |
Hi! UPD: after removing interval for spawning, that threshold increased to 500. Quite good |
Speaking about splitting to native projects - I meant completely split the project. As I understand, anyway it's being compiled to somewhat close to native code - mobile devices cannot execute js code, as I assume. So, this way we can spend less time by developing kind of MVP using rn+rnge and after that split it to independent native projects to fix details like performance, can we? |
Hey @gokadi, Thanks for taking the time to investigate further. Are you saying that you have managed to render 350 dynamic views while still maintaining a reasonable frame rate 🤔? That seems quite high (from experience on my devices), but maybe I have misunderstood your analysis. In regards to React Native, your device will actually execute your app's JS code using an embedded JavaScript engine (JavaScriptCore). Your JS source code is simply transpiled and bundled into a single .js file that will be executed by the engine (not compiled into a native executable or anything). Facebook is developing an alternate JS engine (Hermes) that might be more suitable (and performant) for React Native apps going forward - but this might not necessarily be beneficial for game development. |
Hi!
Currently I’m trying to figure out the reasons of FPS drop in my game, so here I got several questions about it.
In this game sometimes I have about 100 entities on the screen, half of which may be animated either way and FPS becomes 1 :-(.
I tried to investigate this issue, but didn’t succed yet.
The text was updated successfully, but these errors were encountered: