🔒 Locked
Please try this
Advertisement
Original Post
This is my first game attemp with VC++ and directx 8.1 by this time is only a terrain engine for a top-down racing game.Try this if you can and tell me your fps.Thank you
url:
http://www.geocities.com/nafpsoft/TerrainEngine.zip
note:
put all the files in the same folder.
[edited by - lone_ranger on February 21, 2003 8:06:11 AM]
[edited by - lone_ranger on February 21, 2003 10:33:35 AM]
I can't understand why so low fps!!! even on these PCs! In on my pc P4 2.4, 512mb DDR, Geforce 4 Ti 4600 i get only 41 fps! here is my render function:
void GameEngine::Render()
{
int x,y,i=0;
for (x=0;x<=39;x++)
{
for(y=0;y<=29;y++)
{
p.x = (x <<4)+(x<<2);
p[i].y = (y << 4)+(y<<2);
r[i].top = 0;
r[i].left = (track.arrea[x][y]<<4)+(track.arrea[x][y]<<2);
r[i].bottom = 20;
r[i].right = (track.arrea[x][y]+1<<4)+(track.arrea[x][y]+1<<2);
i++;
}
}
gen_Graph.GetDevice()->Clear(0,0,D3DCLEAR_TARGET,D3DCOLOR_XRGB(0,0,255),0,0);
gen_Graph.GetDevice()->CopyRects(gen_Graph.GetTileSet(),r,1200,gen_Graph.GetBackBuffer(),p);
gen_Graph.GetDevice()->Present(NULL,NULL,NULL,NULL);
}
[edited by - lone_ranger on February 21, 2003 9:01:29 AM]
void GameEngine::Render()
{
int x,y,i=0;
for (x=0;x<=39;x++)
{
for(y=0;y<=29;y++)
{
p.x = (x <<4)+(x<<2);
p[i].y = (y << 4)+(y<<2);
r[i].top = 0;
r[i].left = (track.arrea[x][y]<<4)+(track.arrea[x][y]<<2);
r[i].bottom = 20;
r[i].right = (track.arrea[x][y]+1<<4)+(track.arrea[x][y]+1<<2);
i++;
}
}
gen_Graph.GetDevice()->Clear(0,0,D3DCLEAR_TARGET,D3DCOLOR_XRGB(0,0,255),0,0);
gen_Graph.GetDevice()->CopyRects(gen_Graph.GetTileSet(),r,1200,gen_Graph.GetBackBuffer(),p);
gen_Graph.GetDevice()->Present(NULL,NULL,NULL,NULL);
}
[edited by - lone_ranger on February 21, 2003 9:01:29 AM]
Have you tried profiling your app? If not, enable it in MSVC++ to see what''s most time-consuming.
If it''s in the render loop, I think in has something to do with the << you use a lot. I don''t know what it does, I don''t know it, but the rest is not really cpu-intensive if you ask me. So maybe the << is really slow? If so try to find a way around using it. But you should really try profiling...
| Panorama 3D Engine | Contact me |
| MSDN | Google | SourceForge |
If it''s in the render loop, I think in has something to do with the << you use a lot. I don''t know what it does, I don''t know it, but the rest is not really cpu-intensive if you ask me. So maybe the << is really slow? If so try to find a way around using it. But you should really try profiling...
| Panorama 3D Engine | Contact me |
| MSDN | Google | SourceForge |
The << is just a bit shift opperator that should not be the problem. This is a very fast operation on any pc. I think it is the CopyRects Function. It copy a large amount of memory from main memory to grahpic card memory EACH frame. That is not a very good method of doing this. Maybe you try to set up a camera which you just "translate" through your world instead of filling it each frame with new data.
----------------------------
By CommanderXXL
Commander@bloomm.de
----------------------------
----------------------------
By CommanderXXL
Commander@bloomm.de
----------------------------
Thanks CommanderXXL, i thought and something else.What if each frame finding on which tiles are the cars and rendering only this tiles?
Thanks guys!
hi, i no wat the prob is, i made pacman and used the same style, someone mentions it up, u only reblit the tiles that have been overwritten with an image. If you do this u sometimes get nasty trails so u also blit the surrounding tiles, thats wat i did on pacman (http://www.xtremegaming.filetap.com)
10 fps
PIII 550
GForce 4 MX 440
Windows 2000 - 352 MB RAM
"- To begin with, said the Cat, a dog''s not mad. You grant that?
- I suppose so, said Alice.
- Well, then, - the Cat went on - you see, a dog growls when it''s angry, and wags its tail when it''s pleased. Now I growl when I''m pleased, and wag my tail when I''m angry. Therefore I''m mad."
PIII 550
GForce 4 MX 440
Windows 2000 - 352 MB RAM
"- To begin with, said the Cat, a dog''s not mad. You grant that?
- I suppose so, said Alice.
- Well, then, - the Cat went on - you see, a dog growls when it''s angry, and wags its tail when it''s pleased. Now I growl when I''m pleased, and wag my tail when I''m angry. Therefore I''m mad."
I remade my engine and now i am getting 90 fps!The problems was in the swap effect in present parametres it was
D3DSWAPEFFECT_DISCARD i made it DSWAPEFFECT_COPY_VSYNC and now i am remaking my engine with dirty rectangles.Whe n i uses the present function with DISCARD the non-changing tiles where flashing because as Microsoft says in the docs
D3DSWAPEFFECT_DISCARD will be enforced in the debug run time by filling any buffer with noise after it is presented.
Can you try the new version?
link:
www.geocities.com/nafpsoft/TerrainEngine.zip
D3DSWAPEFFECT_DISCARD i made it DSWAPEFFECT_COPY_VSYNC and now i am remaking my engine with dirty rectangles.Whe n i uses the present function with DISCARD the non-changing tiles where flashing because as Microsoft says in the docs
D3DSWAPEFFECT_DISCARD will be enforced in the debug run time by filling any buffer with noise after it is presented.
Can you try the new version?
link:
www.geocities.com/nafpsoft/TerrainEngine.zip
Do what aker_jus suggests.
CopyRects copies from system memory directly to the frame buffer. AKA, its not using 3d hardware rastering! Please setup XYZ_RHW vertexes and make them 2d polygons. Or use the SpriteClass, I believe thats the same thing but with a nice wrapper. That will use 3d hardware.
With a 2.4ghz 9700 Pro, you should be getting about 1000 FPS, not 62.
CopyRects copies from system memory directly to the frame buffer. AKA, its not using 3d hardware rastering! Please setup XYZ_RHW vertexes and make them 2d polygons. Or use the SpriteClass, I believe thats the same thing but with a nice wrapper. That will use 3d hardware.
With a 2.4ghz 9700 Pro, you should be getting about 1000 FPS, not 62.
Thanks JoeyBlow2, i''ll try XYZ_RHW vertex with texturing.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement