Game is slow at the beginning

Blitz3D Forums/Blitz3D Programming/Game is slow at the beginning

slenkar(Posted 2004) [#1]
When I start my game (and some commercial 3D games) THe frame rate is normal but as soon as you move the camera it accesses the hard drive and slows down to a crawl for about 3 seconds.

Why is this? In my game I pre-load all the media so why does it access the hard drive and slow down after the game starts?

I am not using much videomemory but I do only have 64MB of RAM .
It says I have a lot of videomemory left over -about 26MB- and I am using an onboard graphics card.

The slow down effect happens even if I have very few entities at the beggining, but I always load all the media.


wedoe(Posted 2004) [#2]
I have experienced a temporary slowdown when I access the collition routines
for the first time using large images. I guess they are not loaded before needed.
I solve this by acessing the collition routine once between the startupscreen and the game itself.


slenkar(Posted 2004) [#3]
oh I forgot to say my game is also 3D, I dont think the collision is as CPU intensive in 3D


eBusiness(Posted 2004) [#4]
Inserting a delay after loading will often help. I think the videocard sorta "pretend" it have finished loading. And B3D collisions are, as far as I know, very cpu demanding.


jhocking(Posted 2004) [#5]
I'm not 100% sure of this (hopefully someone else will confirm or refute) but I think the loaded media is initially only in RAM, and only moves into videomemory when it is first rendered. This doesn't matter for anything I've developed so far, but I recall someone mentioning that an easy fix is to quickly spin your camera around and render everything after loading, without using Flip so the player never sees those frames.


slenkar(Posted 2004) [#6]
interesting, that sounds better than letting it happen in-game


Andy(Posted 2004) [#7]
>When I start my game (and some commercial 3D games) THe
>frame rate is normal but as soon as you move the camera it
>accesses the hard drive and slows down to a crawl for
>about 3 seconds.

64MB main memory - 32MB graphics memory(Onboard usually uses main memory) = 32MB for Windows to reside in, which is impossible without paging to hard drive.

Andy


jfk EO-11110(Posted 2004) [#8]
It is a result of windows dynamic Ram management. In the Beginning DirectX is still busy with moving things from A to B etc. after several seconds Windows has removed all unneccessary stuff from Ram (such as other apps you used before you started the game) and loaded all textures to the right memory, as described before. First I have thought this is a weakness of blitz, but then I realized it's a DirectX thing. You have to use some tricks to prevent this. EG: render the first scene to the backbuffer several times while rotating the camera around its axis, but don't Flip the Scene to the visible buffer. Or, when you're in Windowed Mode, you might need to use an other trick. Then, when DirectX has everything ready on the right place, you can start the game as usual.

I have also seen this effect with the Lithtech Engine: When you run NOLF and press Esc nervously to skip all those Intro Movies, the game jumps exactly in the same way like some hungry blitz apps in the first 5 or ten seconds.