Time available at each frame

18 views
Skip to first unread message

Julien

unread,
Jan 25, 2011, 3:58:14 PM1/25/11
to bwapi
We’d like to use some time-consuming algorithm in BWAPI by splitting
the calculation on many frames but I don’t know how much time is
available.

Is there any way to know how much time can be consumed at each
onFrame() call without slowing down the game?

Thank you for your help,
Julien

Krasimir Krystev

unread,
Jan 25, 2011, 4:14:59 PM1/25/11
to bw...@googlegroups.com
1/24 - 1/18th of a second
--
BR

Julien

unread,
Jan 25, 2011, 5:03:42 PM1/25/11
to bwapi
Thank you for your answer,

I know that on fastest, Starcraft have a frame rate of 24 frames per
second, but If I don't want to slow the game I also need to know how
much time the Starcraft engine consumed.

Estimating the overhead of Starcraft by checking the time between the
end of an onFrame() call and the start of the next one is misleading
because Starcraft will wait some time before showing the next frame to
ensure a constant frame rate.


On Jan 25, 4:14 pm, Krasimir Krystev <krasi...@gmail.com> wrote:
> 1/24 - 1/18th of a second
>

Erez Sh

unread,
Jan 25, 2011, 5:09:52 PM1/25/11
to bw...@googlegroups.com
You can purposely starve starcraft, and then measure the time between frames. You can do it just once.

gabriel synnaeve

unread,
Jan 25, 2011, 5:10:28 PM1/25/11
to bw...@googlegroups.com
On Tue, Jan 25, 2011 at 11:03 PM, Julien <filion...@gmail.com> wrote:
Thank you for your answer,

I know that on fastest, Starcraft have a frame rate of 24 frames per
second, but If I don't want to slow the game I also need to know how
much time the Starcraft engine consumed.

Estimating the overhead of Starcraft by checking the time between the
end of an onFrame() call and the start of the next one is misleading
because Starcraft will wait some time before showing the next frame to
ensure a constant frame rate.
Disable CPU throttling and your estimation should be fine. 

Julien

unread,
Jan 26, 2011, 11:36:33 AM1/26/11
to bwapi
The time used by the Starcraft engine change from frame to frame so
taking only one measure is not good enough.

Disabling the CPU throttling doesn't seems to help, the engine will
still take time to before showing a frame.

I'm not sure in wich order computation are done, but if the onFrame()
is the last thing done before waiting and showing the frame, having
access to the time at which the frame was showed would be perfect. Is
there a way to get this time ?

On Jan 25, 5:10 pm, gabriel synnaeve <gabriel.synna...@gmail.com>
wrote:

Heinermann

unread,
Jan 29, 2011, 1:14:12 AM1/29/11
to bwapi
int frameTimeInMilliseconds = Broodwar->getLatencyTime() / Broodwar-
>getLatencyFrames();

That should retrieve Starcraft's "expected" frame time. You probably
shouldn't spend more time than that on computation.
Also just to let you know that this value is dependant on game speed.
The computation time will be dependant on the computer's processing
power, so you may have different results between your machine and the
one used at the tournament (if you are entering).
Reply all
Reply to author
Forward
0 new messages