Forums

OverviewV-Play 1 SupportEvaluating Game Entities Per Frame › Reply To: Evaluating Game Entities Per Frame

OverviewV-Play 1 SupportEvaluating Game Entities Per Frame › Reply To: Evaluating Game Entities Per Frame
#6855

Christian
V-Play Team

Hi Matt,

you are completely right – if you want to have a check every frame, you would need to set the interval to 16.

 

However, I recommend not doing so, because per-frame checks are really bad for performance, especially if you do calculations there per-entity and per-frame. It really is a compromise between perceived “fluidness” and performance here – try to set the interval as high as possible to still achieve the visual results you would like to have. Because note that especially on mobiles, which have less CPU power, heavy JS calculations per frame are bad for performance.

 

Usually it is best to try to think in terms of event-based logic, e.g. use the Physics system (which is implemented in C++ internally and pretty fast), to detect collisions and work with colliders to get notified of collisions. In case of a collision, you can then execute your JS code. If this is possible though, depends on your exact use case of course.

 

I hope that helped,

Chris

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support