Strange Slowdown

Blitz3D Forums/Blitz3D Programming/Strange Slowdown

Gabriel(Posted 2003) [#1]
All I have is a few entities on screen. They're running at refresh rate normally, but if I zoom the camera in ( zoom is on the right mouse button ) then things get real slow real fast ( if you see what I mean. )

I mean.. seriously slow, and the mouse cursor is moving waaaaay behind where I'm moving it. If I zoom back out again, it will come back to normal speed again. There's no alpha transparency, so I wouldn't have thought fillrate would have been such a problem.

The thing is, if I ClearTextureFilters() for a cleaner look, it's even worse. And even if I zoom out, it never gets up to full speed again. The problem doesn't exist in fullscreen mode at all. I mean, it will slow down, but just a normal drop of speed. The mouse doesn't start lagging everything speeds back up again as soon as I zoom back a bit.

So...

Is the problem :

1) ClearTextureFilters()?

2) Zooming?

3) Fill Rate?

4) Windowed Mode?

5) Something else?


Anyone hazard a guess?


semar(Posted 2003) [#2]
Anyone hazard a guess?

Without an example of your code, is hard to guess.

- Do you have some Load... command in the main loop (ex loadfont, loadmesh, loadsound...) ?

- How many triangles are made the models with ?

- How the main loop looks like ?

- what else happen when you zoom in ? Are there other function calls invoked ?

- seems to me that your gfx card does not really like windowed mode

- if you set the zooming in at the very beginning of the prog, I mean, without using the mouse, does it slow down in the same way ?

- do you use a waittimer command ? If not, try with it, to force the frame rate at a certain fps

- your pc specs ?

Sergio.


CyBeRGoth(Posted 2003) [#3]
I'd take a wild guess and say Fillrate

post some shots of what your zooming in to?


Gabriel(Posted 2003) [#4]
Sorry, I should have been more explicit in the first post. It's definitely something weird, not the usual suspects.

- Do you have some Load... command in the main loop (ex loadfont, loadmesh, loadsound...) ?


No. Nothing like that.


How many triangles are made the models with ?


Total number of polys on screen must be around 250. And no more than 20 surfaces. Definitely not a problem.

How the main loop looks like ?


Erm.. practically nothing in there yet.

Repeat
   docameracontrol()
   UpdateWorld
   RenderWorld
   Rect MouseX()-2,MouseY()-2,4,4
   dofps()
   Flip
Until KeyHit(1)>0


camera control is just a zoom on the rmb, and do fps just counts the fps and displays them.

what else happen when you zoom in ? Are there other function calls invoked ?


No. Nothing but zooming.

seems to me that your gfx card does not really like windowed mode


Well Blitz seems to prefer fullscreen ( probably a DirectX thing ) but I can run other games in Windowed mode with no problems.

if you set the zooming in at the very beginning of the prog, I mean, without using the mouse, does it slow down in the same way ?


Good Question. I'll try that, and post back.


do you use a waittimer command ? If not, try with it, to force the frame rate at a certain fps


No, but I never do, and I have another game I'm working on with many more polies and much more going on that doesn't have this problem. I'll take a look at waittimer, but I'm 99% sure this isn't the issue.

- your pc specs ?


1200 Athlon, 256Mb Ram, Gf2Mx, XP.. no problems running other games I've written in Blitz.


Gabriel(Posted 2003) [#5]
Yeah, John, Fillrate is all that springs to mind to me too. Maybe I'll just stick a limit on the zoom. I'm not sure if the screenshots would help. It's literally just cubes on a plane at the moment. All textured, but small textures (64x64 on each cube and 512x512 on the plane. It doesn't happen until I'm zoomed in so far that the plane fills the screen, but I'm still surprised fillrate is an issue already.


Difference(Posted 2003) [#6]
I just had this problem.
My guess is it's your/blitz's mousehandling.


Try putting these lines after Flip:

For n=1 to 10 ; or 20
Delay 1 ;or 2
Next

Delay It?
Well, just to test if it is indeed mouseevents queing up.
That loop lets Blitz get rid of a few of the queed mouse events.

In my latest app, I fixed it by waiting for mouse/keyboard events in a loop after Flip statement. Not a good soulution for a game, but in this case it worked ok.

I'm still looking for a better workaround, maybe a dll with a mouse hook will work...


GNS(Posted 2003) [#7]
Maybe FlushMouse every x number of ticks?


CyBeRGoth(Posted 2003) [#8]
In my harmony blocks game (like your game its cubes on a terrain (mesh in my case) with anim texturing applied to them, I get slowdown like you described when I am zoomed right in, but only on some 3d cards thats why I suspect its fillrate.

stick a limit on the zoom :) I did


Gabriel(Posted 2003) [#9]
Excellent, Peter. That's fixed it. My game isn't too frame rate dependent, so it't not going to matter than I'm losing a few milliseconds. It is important to have smooth mouse movement, though, and now I've got that.

Thanks again.


(tu) ENAY(Posted 2003) [#10]
Yep. It's fill rate alright. Just make sure nothing gets really close to the camera.