Built game plays differently than with editors? (1.1.3)
by Jacob Wagner · in Torque Game Builder · 10/14/2007 (10:54 pm) · 1 replies
I am coding a game that calculates game logic in onUpdateScene, then adjusts velocities etc. in TGB 1.1.3.
I had some AI enemy ships in the game and when I spawned about 10 of them the game started slowing down. I figured since I was calling onUpdateScene with all this logic that was the problem. So I set a counter that would only call onUpdateScene every 25 ticks instead of 0 ticks. It seemed to improve the AI delay problem, and I planned to try an even larger counter for better performance.
However, when I built a release version of the game using the package utility in the editor, the built game plays differently than the game does in the editor! For instance the ships move faster, etc. The framerate of the game seems to be the same.
Since it would be annoying to hold 2 different versions of the constants used in the game for ship speed etc, is there anything I can do to fix this problem? By the way I am using the same type of game structure as this:
http://www.garagegames.com/mg/forums/result.thread.php?qt=54831
game, which has source code available. If there is a better way to structure my game, please let me know. Perhaps I should not be using an onUpdateScene call at all, and instead use schedules for the AI logic and etc.?
I had some AI enemy ships in the game and when I spawned about 10 of them the game started slowing down. I figured since I was calling onUpdateScene with all this logic that was the problem. So I set a counter that would only call onUpdateScene every 25 ticks instead of 0 ticks. It seemed to improve the AI delay problem, and I planned to try an even larger counter for better performance.
However, when I built a release version of the game using the package utility in the editor, the built game plays differently than the game does in the editor! For instance the ships move faster, etc. The framerate of the game seems to be the same.
Since it would be annoying to hold 2 different versions of the constants used in the game for ship speed etc, is there anything I can do to fix this problem? By the way I am using the same type of game structure as this:
http://www.garagegames.com/mg/forums/result.thread.php?qt=54831
game, which has source code available. If there is a better way to structure my game, please let me know. Perhaps I should not be using an onUpdateScene call at all, and instead use schedules for the AI logic and etc.?
Torque Owner Ehrlich
onUpdate works 60 times per second, while a timer works as many times per second as you want, like for instance, if you put a 300ms timer for certain thing, it will work 3 times per second and a forth time every 3 seconds... i use that approach everytime i need certain critical calculations that CANNOT go on an onUpdate callback, because when that callback gets bloated, it will kill your game in no time.