stuttering/sticking

Blitz3D Forums/Blitz3D Programming/stuttering/sticking

ryan scott(Posted 2004) [#1]
i am working on a game and right now it's very basic. you have a tank driving around, there are walls in your way, enemies come out and attack and you can kill them and the buildings they come from. on screen at any one time are possibly 100 objects. i don't think any of them are multi-thousand triangle objects.

what's happening is that periodically the game stutters/freezes for a second before continuing. it seems to happen at certain times - the first time it displays an enemy building, when enemies first start emerging, etc.

it does also happen at apparently random times.

i am totally unclear why this would be happening. i don't think i have too many objects on screen.

i'm wondering if it is my setup or something. i'm running a 2.4ghz machine, matrox parhelia graphics card with 3 monitors, although the game plays in 800x600 on just one monitor. it also stutters (runs even worse actually) on my laptop.

i am wondering what i should look for to make this thing run reasonably.

if anyone has a spare 15 minutes would you be interested in trying it?

http://download.runinteractive.com/zdistro.zip

drive around with arrow keys, use mouse to aim and fire. driving over those red squares triggers things to happen.

(obviously all placeholder graphics at this point)

i would love any feedback on this problem. :(

thanks!


Mo(Posted 2004) [#2]
I don't think it's your system, cause I experienced the same behavior as you(Athlon 1.2 gHz, G4-Ti4200,512MB).
First I thought of too many surfaces, but that's unlikely, cause it would hurt framerate in general, and not explain the stuttering.
How do you create multiple instances from the objects? Do you use Copyentity on an existing object, or do you reload it from harddisk? If you reload from harddisk every time, that might cause the stuttering.
Also, you maybe could disable single features for testing, like particles, sound etc.


ryan scott(Posted 2004) [#3]
yes i've been trying the disabling of various features, not really zeroing in on a particular thing that makes sense.

i am using copyentity.

i precreate objects too, if possible, for example for particles i have a pool of already created ones i fetch one from.

is it possible that the first time you use copyentity it could be slower than subsequent calls to copyentity for the same entity?


ryan scott(Posted 2004) [#4]
what would be a lot of poly's for my objects?

enemy building: 300 polys
enemy 1: 1040 polys, 3 textures
enemy 2: unknown 781k 3ds file
enemy 3: unknown 500k 3ds file
enemy 4: unknown 125k 3ds file
enemy 5: unknown 17 k file.

hmm i am getting better response with the smaller enemies.

i don't have anything to read these 3ds files, so i'm unsure on poly count. i'm guessing here that 700K worth of 3d data is a little too much to use in a 3d game for one of the many objects, is that sensible?


karmacomposer(Posted 2004) [#5]
Since it happened to me as well, I will rule out video card drivers as the source - which is what I WAS going to say it probably was.

I did notice that everytime I rotated with the mouse and THEN fired a shot, that was when the delay happened - but not EVERY time.

Must be in the code somewhere dude.

Mike


Andy(Posted 2004) [#6]
>i don't have anything to read these 3ds files, so i'm
>unsure on poly count. i'm guessing here that 700K worth of
>3d data is a little too much to use in a 3d game for one
>of the many objects, is that sensible?

B3D has a built-in object viewer, just use the open dialogue, set the filetype to 'all files' and double click on the 3ds file you want to load... It displays the tris and vertices...

Andy


IPete2(Posted 2004) [#7]
Ryan,

Do me a favour and rem out all the sounds and sound effects. See if the stuttering is resolved.

Let us know plz.

IPete2.


ryan scott(Posted 2004) [#8]
i removed all the sounds, and i made sure every object was simpler than before.

http://download.runinteractive.com/zdistro.zip

it is still stuttering, seems to be related to spinning around.

could it be something to do with blitz's terrain rendering? i notice while traversing the hills around the maze area, the terrain triangles move around strangely. a LOD thing, i'm guessing.

i gotta tell you, my code is really pretty simple, and i write efficiently. what i'm not sure of though is the speed certain blitz commands might take. then again i am doing things like creating all meshes at startup, and then just doing PositionEntity,ShowEntity when I want to use them, which seems like it would be the fastest method.

in the software you can use q and z to change the altitude of the camera.

the sounds were mostly mp3s, is this bad? i would think converting to wav would be a Good Thing.

so yes, i'm still getting stuttering, and i'm unsure what to look for. i'm still working on it though.

if anyone can try it, thanks very much.


BODYPRINT(Posted 2004) [#9]
Hi Ryan,

I ran it on my P4 3.2Ghz - 1 Gig RAM - Radeon 9800 and had no stutters :-P

Here's some stats for you that might explain things.

martian.3ds = 26000 poly
pod.3ds = 31000 poly
maverick.3ds = 3200 poly
alienapc.3ds = 13000 poly
t80.3ds = 12500 poly
yoyo.3ds (in game?) = 20000 poly

I'm not sure about the directx models. But they don't look too big in file size.

I will reduce them for you tomorrow when I get time if you like. I think this will speed things up :-)


ryan scott(Posted 2004) [#10]
that would be very nice of you, but don't bother, because they are only temporary images. i really need consistent images, so i'll need to hire that out or collaborate with someone. i've switched over to using the simpler images, and i still get the problem.

in fact i get it before any images have appeared except my car. i am not going to bother trying to simplify further, you can't make it simpler than just the car on the terrain!

it's somewhat gratifying you are getting no stutters. I notice that sometimes i hear my harddrive make a head-movement sound, and that definitely has some correspondence to it.

my harddrive is always making random movement noise every once in awhile, even if i try to stop everything I can think of.


ryan scott(Posted 2004) [#11]
i just read what i think is my solution

http://www.blitzbasic.com/Community/posts.php?topic=37168

its possibly caused by the fact that every time i display a new object it is not in the video ram. i have to display it all to the video card as a kind of pre-caching.

this makes sense based on what i'm seeing. i know stuttering seems to happen when a showentity happens.

i will try and report back in case anyone else is interested.