Frame skipping, how to?


Hi all, i would like to ask if anyone of you could explain to me about these options clearly? Since i am trying to optimize my game, which is fully based on correct timing.

I have tested my music game (as runtime format) on several computers (strong and weak) in my school and see, the animations kinda run well but kinda dodges out the timing, those still have enough 60 frames but it is not what i want to achieve. I want to optimize the game the way, that the timing is always correct, and if animations doesnt have enough time to finish, it still can skip frames and continue running until where it should end.

thanks in advance

As far as I remember, it already does that.

not really, the game runs very differently on different computers. It kinda has a delay with the actions.

if animations doesnt have enough time to finish, it still can skip frames and continue running until where it should end.

You should manually do this, there is no automated way. In Unity there is something called “animation scaling”-scale dynamically the animation to fit the required time with C#(code), but I think there is no such option in BGE Python, so you need to do everything you want, exactly how it should be. As I understand you, these options above in the screenshot is no use for you.
Synchronizing music and animations is a tough task in any engine and in any game.

thanks haidme,
hm i would like to comment this statement.

Well the synchronization is not really absolute working, but it kinda goes like this:

the timing of the game will begin after the song is loaded and played. This is the timer from “import time” , so it kinda synchronize with computer clock. And the timing points of all the elements that have a role in the scene will be preloaded into memory , each time the player clicks on a song. Animations will have the animation speed from [bpm/60fps] and these will start also with the preloaded timing points.

What i just wonder is, if strong computer runs the game, the timing is always perfect. but if an old computer runs it, the elements are still spawned at the preloaded-timing points. but its animation is kinda extended somehow.

you could use a property on an object that is set to the frame it needs to play.
so instead of playAction u use the property to set the correct frame, this way it should always be sync on every pc, and you get an option to manually skip frames.

. but if an old computer runs it, the elements are still spawned at the preloaded-timing points. but its animation is kinda extended somehow.

I have the same problems with the voices and lips animation of npcs. What cotax proposed should work in a way, but it will be very hard to manage a lot of animations and songs.

thanks cotax and haidme

the calculation in the game actually has value that can effect on this, which is called ‘delay’ . each song kinda has its own delay value. the higher the value is, the earlier the notes are spawned. Pohjan inserts that value so i can adjust the timing.

I think its possible to make a small function which can let the player change that value during the game. But ya… then the player has to make it for everytime he plays, which is quite annoying - as haidme said: “it will be very hard to manage a lot of animations and songs.”

I made a demo of what you’re apparently asking for. It should be noted:
Flipper and PingPong aren’t fully implemented. You should add some way of storing the information of the last animation played by the actuator (including the current frame it ended on) if you want to fix that.
anim.blend (519 KB)

thanks agoose
i will experiment somewhat