Hey all!
Working on a 3d adventure/rpg and am quickly running into performance problems. It runs great on my Core2Duo with x1950 graphics but as soon as I throw a lower-end video card at the game, it's unplayable, even in 640x480.
My goal, however, is to make it accessible and playable, say, 10-20 *steady* fps, on a P4 3.00Ghz with integrated graphics in the lowest detail settings.
I have a 256x256 .dbo file I made in 3DWS to be my terrain. I'm loading it with dbLoadObject and placing it directly in the world that way. It's about 8MB. I have a few images and whatnot, totalling less than 1MB.
While my game is running, I'm eating up over 125MB of memory.
My main concern isn't so much the memory usage but the inconsistant performance of the game. I do have a timer which regulates the code execution speed, drawing the GUI on every loop (preventing flicker) and the game code every 60th of a second.
On my main machine (the Core2Duo), as well as my P4 with a Radeon 9550 pro (256 MB), no matter the FPS I get, the game's speed is consistant. I get 30FPS or so on my P4, which feels like a normal 30 FPS found in a normal game. Not jerky or jumpy, just a nicely-flowing 30 fps. What I don't understand exactly, is when I run the game on any computer with 128MB or less of video RAM (coincidence or not, I don't know yet), the video just isn't consistant. 30FPS feels like a rapid succession of 2Fps and 40Fps, feeling extremely jerky and awkward.
I have another P4 3.00Ghz with integrated video (128 shared) which runs at only 10 fps in 640x480 PLUS it suffers from the "feels like 1fps, 20fps, 1fps, 20fps" inconsistancy.
On my laptop, a Turion 64 x 2 (1.88Ghz) with a GeForce 6150 Go (128MB shared VRAM), I get about 35-40FPS in 800x600 res but I get that exact same awkward jerkiness that my integrated video desktop suffers from. My old 9550 with 256MB of dedicated video RAM doesn't get a great FPS but it's solid and feels perfectly normal.
I'll paste up my timer code which I found elsewhere on the forum, as timers always scared me.
void runMainGame()
{
t=dbGetTime();
//Wait for system timer to change
while (dbGetTime()==t)
{
}
//Record start of our loop
starttime=dbTimer();
now=starttime;
intstep=16;
do
{
//get the current timer, measued in 1000ms = t second =
// (20 * 16ms) + (40 * 17ms)
goal=dbTimer();
//We stay in our 'logic loop' until we catch up with the timer (our goal)
while (now+intstep<=goal)
{
//We catchup one cycle (16,17 or 17)
now=now+intstep;
//We scroll to the next interval for next time
intstepmode++;
if (intstepmode>2)
{
intstepmode=0;
}
if (intstepmode=0)
{
intstep=16;
}
if (intstepmode=1)
{
intstep=17;
}
if (intstepmode=2)
{
intstep=17;
}
timer_ticks++;
//Process a logical tick
if (timer_ticks == 60)
{
timer_ticks_count++;
timer_ticks = 0;
}
//CODE START HERE
gameLoop();
}
handleChatting();
drawGUI();
dbSync();
} while (LoopGDK());
So I have two goals:
1) To eliminate this jerkiness and produce a smooth FPS, no matter the system and no matter how low the FPS.
2) To improve the performance of the terrain, improve FPS and reduce system requirements.
I see there are commands such as dbMakeObjectTerrain() for converting heightmaps into terrains, but I don't understand how you're supposed to get the correct textures on them. I only see a place to plug in one detail texture and I really don't see how I could draw a landscape that has more than 2 different textures on it this way. I have the program working nicely right now but it's just too clunky on machines other than those that have 256MB video cards (or maybe it's just Shared memory GPUs in general).
I'll be happy to post up more information for anyone who's interested. Thank you.