简体   繁体   English

我想让我的应用程序运行得更好,将它从浏览器移动到node.js提高性能?

[英]I'd like to make my app run better, will moving it from browser to node.js improve performance?

I am working on a game with my friend, he is drawing animations and other images and I am making code. 我正和我的朋友一起做游戏,他正在绘制动画和其他图像,我正在制作代码。 The way I have been making it so far is through p5js library, but constant screen updating is slowing down the game as I add more and more things to the game. 我到目前为止的方式是通过p5js库,但是随着我在游戏中添加越来越多的东西,不断的屏幕更新会减慢游戏速度。 I counteracted it until now by optimizing it like not drawing things that are directly not on the screen or reducing number of collision points on player's sprite, but do all of my problems come from the fact that I am running it through the browser? 直到现在我通过优化它来抵消它,就像没有画出直接不在屏幕上的东西或减少玩家精灵上的碰撞点数一样,但是我所有的问题都来自于我通过浏览器运行它的事实? I've read online that Node.js is an environment to run Javascript in, but I am still unclear how exactly this will work. 我在网上看到Node.js是一个运行Javascript的环境,但我仍不清楚这究竟是如何工作的。 From looking at apps that run through node.js like spotify it seems that they are able to run without real problems, although this might be bad example as it is not drawing something every frame. 从查看通过node.js运行的应用程序(如spotify)来看,似乎它们能够在没有实际问题的情况下运行,尽管这可能是一个糟糕的例子,因为它不是每帧都绘制一些东西。

tl;dr I want my game to run better, will running it through node.js help with performance as opposed to running it through the browser? tl; dr我想让我的游戏运行得更好,是否会通过node.js运行它来提升性能,而不是通过浏览器运行它?

you need a headless browser to be able to run your game code in nodejs. 你需要一个无头浏览器才能在nodejs中运行你的游戏代码。 But thats kind of silly. 但那有点傻。 You really want a browser to be able to play in. Did you debug your code and tried this performance article on optimizing p5js? 您真的希望浏览器能够播放。您是否调试过代码并尝试过这篇关于优化p5js的性能文章

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM