Ijatsu Posted February 23, 2014 Share Posted February 23, 2014 Hi everyone, I searched in the API and code and did not found what I wanted, that's why I come here to ask you. ;( Currently, if your game is running at 30 FPS, there's 30 render cycle per second. For each render cycle there's 1 update cycle.What I want is to add more update cycle to a render cycle, this way the game will be speeded up without unecessary render cycle. Why do I need this functionnality?I'm coding small evolutionarry games, when testing or playing it I need to accelerate the process to see any emergence. After a brief look at the game.update function, I can implement it, but I need to know first it isn't already implemented. Thanks Link to comment Share on other sites More sharing options...
rich Posted February 23, 2014 Share Posted February 23, 2014 De-couple the 'game update' from the phaser update - i.e. when the phaser 'update' is called, iterate through your simulation as many times as required to achieve your desired rate. Link to comment Share on other sites More sharing options...
Ijatsu Posted February 24, 2014 Author Share Posted February 24, 2014 De-couple the 'game update' from the phaser update - i.e. when the phaser 'update' is called, iterate through your simulation as many times as required to achieve your desired rate.I don't understand how I am supposed to do that ^^'I tried to call game.update inside the update function I give when creating Phaser.Game object ( with recursion blocking ), but it doesn't work and that's logical because I try to call update while an update isn't event finished. ^^' Link to comment Share on other sites More sharing options...
rich Posted February 24, 2014 Share Posted February 24, 2014 Ok let me put it another way - your simulation obviously isn't tied to the render frequency, which means it must have something that controls it - some kind of simulation manager? that is responsible for managing all of the objects within the simulation, advancing their states, etc. So what I'm saying is call this on whatever timed basis you need and just use the game update to trigger that. Or you could even just start off a setTimeOut (Interval) in the create and have that call your simulation at whatever frequency it needs. Link to comment Share on other sites More sharing options...
Ijatsu Posted February 24, 2014 Author Share Posted February 24, 2014 Well yes maybe reproducing the inner update cycle of Phaser.Game isn't overwhelming, but I don't think it's clean. Anyway if there's no tool to do it natively I know what I have to do :] either modify Phaser.Game, or extend it, or copying update cycle. Thanks :3 Link to comment Share on other sites More sharing options...
rich Posted February 24, 2014 Share Posted February 24, 2014 I'm not sure you'd have to reproduce it at all? I mean you wouldn't want to call the input handler, sound manager or physics systems more than happen already. The only part that would need updating more often it sounds like is the simulation itself. Link to comment Share on other sites More sharing options...
Ijatsu Posted March 2, 2014 Author Share Posted March 2, 2014 Well you're basically telling me that in order to accelerate my simulation I shouldn't update the tool I use...?If I don't update the physics systems, how am I supposed to catch the collisions? Link to comment Share on other sites More sharing options...
Recommended Posts