How to gradually increase game speed in BB3, is there a dedicated action for this or a method to do this ?
Click on your 3D World in the Mind Map. You will see Time Warp, Sub Steps and Time Step. These are different than BuildBox 2, and I have not tried them, but I think these are the settings that will do what you want to.
I do not know their exact affect on speed, because they are totally different from BB2. There's no doc yet. I tried experimenting and couldn't figure it out. I don't know if I just don't know how they relate to each other, or if they're not working.
I have played with these settings, and in fact in a previous thread was asking the same questions. Placing Time Step to 0 will cause your game to just sit, nothing seems to move or have any control. Placing Time Step at 10 causes really strange behavior after about 1 second, everything is super fast and movement controls freak out. Seems it works best around 1 or 2 setting. Sub Steps, no clue, I really didn't see any behavior change no matter what I set it at. Might have been my specific game, but I don't think so. Time Warp seems to be the only way to control the speed. There is no way to gradually increase speed at this time, there may be some scripting control possibly.
I haven't experimented with the 3 time controls named above. I don't know if they work or partially work or... whatever. So I don't know if this is redundant. But here goes... I experimented with the Float sample. First of all, velocity is controlled with these javascript commands (inside the actor, in the Move component, for example): function init ( ) { _physics = this.entity().physics(); } function update ( dt ) { _physics.setLinearVelocity( vel.x, vel.y, vel.z ); } So.. now the question becomes, how do we gradually change the velocity vector??? Remember that update ( dt ) gets called about 60 times per second. You could do something as simplistic as //This is the simplistic, hardcoded solution. var _vel = _physics.linearVelocity(); function update ( dt ) { _vel.x += 0.0001; _physics.setLinearVelocity( _vel.x, _vel.y, _vel.z ); } // // // //This is the variable speed, variable direction solution. // const FASTER = 1; const SLOWER = -1; var _speed_delta = { x : 0.0001, y : 0, z : 0 }; var _vel = _physics.linearVelocity(); // at first, the game will get faster over time. // change the value in _speed_direction by any method you want. var _speed_direction = FASTER; function init ( ) { } function update ( dt ) { // if speed_direction > 0, then speed_dir is set to 1, else speed_dir is set to -1 // this is javascript's assignment if-then-else shorthand let speed_dir = ( _speed_direction > 0 ) ? 1 : -1; // note: you can change _speed_direction in any number of different ways to // sometimes be slowing and sometimes be speeding up let vel.x += (_speed_delta.x * speed_dir); _physics.setLinearVelocity( vel.x, vel.y, vel.z ); } // update The final construct is one way to change the frequency an action occurs. var _counter = 1; var _times_per_second = 1; update function ( ) { _counter = ( _counter > (60 / times_per_second) ) ? 0 : _counter ; if ( _counter == 0 ) { // do whatever you want, ( as often as you want by changing _times_per_second ) } } // update Good luck ! @DanFarfan
Hi @DanFarfan, I think the example you give would change the speed of the actor, not the game path(still could be useful). Time Warp changes the speed of the game path. In BB2 there was a start speed and max speed, and Time Warp adjusted how fast the speed increased from start speed to max speed. I think that's what @Kanishk Sachdeva is after.
hmmm.. maybe I'm just loopy from working most of the day and night yesterday, but what's the difference? I just played my float game again and when I slow down the actor the scene moves from right to left slower. When I accelerate the actor, the scene zooms by me faster. My actor didn't change relative position to the screen. Maybe that's the difference?
Now you've got me saying hmmm, you're right. The game speed in BB2 is the rate the background moves, which doesn't apply in BB3. If the character is moving at say at exactly -10z(no x component), stationary objects move past the character at +10z. If the character turns around the other direction and goes +10z the stationary objects will move past the character at -10z. If an object is moving, it's speed is relative to the character. If they're both say at -10z they would stay together. So unless, I'm missing something, you're right.....but then what does Time Warp control? I'm out of town so I can't test this right now.
I dunno. Considering we're in beta, it is possible what I built and the lessons I derived from it are all in error... as in it isn't supposed to work this way ;-) I know I'm not going to worry about features I don't need, yet. Got plenty to wrestle with, around, near, over. @DanFarfan
time warp is not working in latest bb3 version, is there any way to increase scene speed through scripting?
-----in the innit---- Settings['gamespeed'] = 26; (or whatever) ------on your signal---- _spd = Settings['gamespeed'] += 1; this.scene().setSpeed(_spd); good luck