speed curious
Displaying 1-9 of 9 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
geronimo

Would it be faster to draw my entire background with one call to TBlit, or divide it up into parts that are necessary to draw, and do it with like 20 calls to TBlit?

The parts that are necessary to draw are about half the total screen area I'd guess.

Posted on 2004-05-02 02:09:17 (last edited on 2004-05-02 02:19:59)

Zip

Will depend how often you are needing to update the various parts. I'm an advocate of render-on-demand, keeping the amount of things to be re-drawn every game loop to a minimum, and render everything else only when it needs to be.
Depends entirely on how you want your game to work.

Zip

Posted on 2004-05-02 02:19:43

geronimo

i'll be redrawing the whole thing every frame.

Posted on 2004-05-02 02:20:58 (last edited on 2004-05-02 08:17:10)

el_desconocido

To smooth things out a bit, you might try something like the code below. This lets you set the wait time, do slow stuff like drawing, and not have it added to the time you want to wait. If it took longer to draw than you had told it to wait, it will not wait at all.
int wt_waituntiltime = 0; // global


void SetWaitUntillTime(int waittime)
{
wt_waituntiltime = systemtime + waittime;
}

void WaitUntillThen()
{
while(wt_waituntiltime > systemtime) UpdateControls();
}

// an example:

SetWaitUntillTime(30);
PrintStringS(fsdx, 130, screen, v3font, "%2F%8o%1n%bt %6S%3u%2b%8s%1e%bt %6D");
ShowPage();
WaitUntillThen();

Hope this helps,
El

Posted on 2004-05-02 18:20:41

Zip

Alternativley, it also easy to run some operations less often than once per game loop.

void autoexec()

{
if (gl_last_time + gl_time_delay < timer)
{
// Stuff to do less often than every game loop
gl_last_time = timer;
}
// Stuff to do every game loop
}


Zip

[Edit: His code is better. Has a simpler if statement.]

Posted on 2004-05-02 23:05:15 (last edited on 2004-05-03 23:34:18)

el_desconocido

Very good point as well. Especially when waiting for user input I'll do something like:
  if(draw_time < systemtime)

{
draw_time = systemtime + 10;
DrawStuff();
ShowPage();
}


El

Posted on 2004-05-02 23:38:01

geronimo

no really, i'll be redrawing it every frame.

kthx, i'll just try different things to see what's faster :]

Posted on 2004-05-03 00:36:57

Zip

In which case, TBlit in as big as chuncks as possible without unnessersary overwriting.

Zip

Posted on 2004-05-03 02:28:38

geronimo

thanks! :]

Posted on 2004-05-03 03:33:58


Displaying 1-9 of 9 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.