Sign in to follow this  
luke88

My Engines First Screens

Recommended Posts

luke88    160
Here are some screenshots from my current WIP FPS engine. I started the project a while ago, but it's hard for me to find the time to work on it. Not much to show really (I'm always coding the engine, and only spending little time on level design), but I would like to know what you think anyway :) Image Hosted by ImageShack.us Stacking Test Image Hosted by ImageShack.us Lighting Test Image Hosted by ImageShack.us Fog Test Image Hosted by ImageShack.us Misc Image Hosted by ImageShack.us Misc

Share this post


Link to post
Share on other sites
SirLuthor    364
It's further then most people will ever get, and for that, you get major kudos [grin] That fog looks really nice!

However, going on the FPS shown in the title bars, there is a lot of room for improvement. You should easily be getting 70-80+ FPS with such simple scenes, unless there is a load going on in the background. Any particular reasons you aren't?

Share this post


Link to post
Share on other sites
Quote:
Original post by SirLuthor
However, going on the FPS shown in the title bars, there is a lot of room for improvement. You should easily be getting 70-80+ FPS with such simple scenes, unless there is a load going on in the background. Any particular reasons you aren't?

Well, setting the framerate in the titlebar is definitely a no-no. It is very slow, and SetWindowText() is a blocking call. luke88 could probably speed up his engine just by writing the fps with the rest of the text.
Anyway, good work, luke88. As you know by yourself, there is still some room for improvement, but you are on the right way :)

Regards,

Share this post


Link to post
Share on other sites
dbh    166
Agreed, looks really nice! The trees you have going on look good too. I particularly liked the color interpolation you have on the second shot (volumetric lighting). Very nicely done :)

I'm noticing you are running it in windowed mode; have you tried it in full-screen? It's a stupid question, but some video cards/drivers have trouble with windowed mode, which can cause a FPS problem.

I'd also suggest losing the titlebar for the FPS, I've also noticed that can cause unnecessary slowdown.

One thing you can do to check where your slowdown is, is to set what I call time wrappers around chunks of code.

So let's say everything you have going on in one iteration can be divided into two categories:

1) Render
2) Update

I'd throw a time wrapper around each one of those and then print that time every update.

So in other words, get the current time when you start rendering, then get the end time when you are done with that iteration's render. Take the difference, and blit that to our output (next to the other stats you are tracking). Then do the same thing for your Update code, but keep the end time seperate so you can display it as well. Of course, the time will change so quickly it may be difficult to discern what it is-- you can calculate an average if you want to make it more readable. I'd also keep track of it in terms of percent-- are you spending 75% of your time rendering, and 25% updating, or vice versa? This will, at the very least, help you track where your slowdown is.

If you REALLY want to know exactly where your trouble is, do some research into various profilers (Purify Plus is one, for example). These plugins can do everything I described above but in MUCH FURTHER DETAIL.

Goodluck!
-dbh

Share this post


Link to post
Share on other sites
mikedoty    186
For me, the biggest problem in 3d was culling occluded surfaces, the ones that you can't see. That always ended up destroying my frame rate. You're supposed to sort them into a tree or something, and then you can do line-of-sight tests. I never quite figured that one out, though. I'll just wait a few years until computers are so ultra-powerful that you don't need to do those tests. :p (Ok, I'll wait until I have the ambition to try it again, lol)

Share this post


Link to post
Share on other sites
dbh    166
Yeah, occlusion and culling are key in any FPS-type game (or any game that has the camera freedom that an FPS has).

I'd strongly suggest getting a good graphics book and taking a full weekend to digest how to do this properly; you're right, it does involve trees (oct trees)-- but it is a fairly complex operation if you don't fully understand how it works.

-dbh

Share this post


Link to post
Share on other sites
DrEvil    1148
<sarcasm>
Why do occlusion yourself when you can pay $10,000(per title per platform) for occlusion libraries through the link on the front page!
</sarcasm>

Share this post


Link to post
Share on other sites
luke88    160
Quote:
Original post by dbh
I'm noticing you are running it in windowed mode; have you tried it in full-screen?

Yeah, FPS stays pretty much the same.

Quote:
Original post by dbh
I'd also suggest losing the titlebar for the FPS, I've also noticed that can cause unnecessary slowdown.

Fixed :)

And, I'll try to set up those time wrappers as soon as I can.

Anyway, I'm gonna sound like a right idiot here, but I don't actually know what occlusion is. Anywhere I could read about it? Perhaps even a short description?

Oh, and here are some new screens:

Image Hosted by ImageShack.us

Here's the same place, but at night:
Image Hosted by ImageShack.us

Image Hosted by ImageShack.us

Share this post


Link to post
Share on other sites
dbh    166
Cool new screens, I like the dramatic lighting and the detailed textures :)

What API *ARE* you using? DirectX9? OpenGL? SDL? Something else?

It looks like you aren't filtering your textures at all... is that purposeful?

-dbh

Share this post


Link to post
Share on other sites
luke88    160
I'm using DirectX8 in VB6.
I'm using really low res textures on everything. What do you mean by filtering them? (As far as I know, there are no filters of any kind).

Share this post


Link to post
Share on other sites
dbh    166
I'm not as familiar with DX8 as I am with 9, but I know for a fact there is a SamplerState that you can set that will change how the texture is filtered when it is scaled. Right now, it looks like you are just leaving it at the default (linear). If you want to see what it is doing, just open up Windows Paint, open up any graphic, and resize it to 200%. That is linear scaling. No filtering is applied to the final product, which makes it look very pixelated.

Here is how I set it to use Anistropic filtering with C++ and DirectX9. I'm sure there is a similar equivalent for DX8.


m_pD3DDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_ANISOTROPIC);
m_pD3DDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_ANISOTROPIC);
m_pD3DDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_ANISOTROPIC);
m_pD3DDevice->SetSamplerState(0, D3DSAMP_MAXANISOTROPY, 16);


Look into it. You'll be shocked at the difference.

-dbh

Share this post


Link to post
Share on other sites
luke88    160
I looked around and couldn't find SetSamplerState in DX8. I even searched the object browser, and it's definately not there. Perhaps it's under a different name?
The only thing I could find was that the type CONST_D3DTEXTUREFILTERTYPE has members like D3DTSS_MINFILTER, D3DTSS_MAGFILTER, D3DTSS_MIPFILTER etc. But I have no idea how to use that type.

Share this post


Link to post
Share on other sites
dbh    166
Thanks Evanofsky for clarifying that :)

You might try SetTextureStageState ... I found that in this thread:

http://www.experts-exchange.com/Programming/Game_Development/Game_Graphics/DirectX/Q_20560575.html

See if DX8 uses that instead.

-dbh

Share this post


Link to post
Share on other sites
gregs    364
Yes - for DX8 you use SetTextureStageState.
For bilinear filtering:

d3ddevice->SetTextureStageState(0,D3DTSS_MINFILTER,D3DTEXF_LINEAR)
d3ddevice->SetTextureStageState(0,D3DTSS_MAGFILTER,D3DTEXF_LINEAR)

If you're using mip-mapping, add:

d3ddevice->SetTextureStageState(0,D3DTSS_MIPFILTER,D3DTEXF_LINEAR)

If you want ansiotropic filtering, use:

d3ddevice->SetTextureStageState(0,D3DTSS_MINFILTER,D3DTEXF_ANSIOTROPIC)
d3ddevice->SetTextureStageState(0,D3DTSS_MAGFILTER,D3DTEXF_ANSIOTROPIC)
d3ddevice->SetTextureStageState(0,D3DTSS_MIPFILTER,D3DTEXF_ANSIOTROPIC)

then set the level of ansiotropy

d3ddevice->SetTextureStageState(0,D3DTSS_MAXANSIOTROPY,some_number)

where some number is the maximum levels of ansiotropy available on the card, which can be found in D3DCAPS I believe.

If you're using VB (which it looks like), convert the pointers to the usual member symbol.

Share this post


Link to post
Share on other sites
luke88    160
Ah, thank you so much. It works great. Bilinear filtering makes such a difference. Can't say I can notice any difference with anisotropic filtering. Perhaps I'm not enabling it correctly.

Does anyone have any other ideas to as what could be causing such a low FPS, or what I could do to speed it up? It's really startin' to bug me :-/

Share this post


Link to post
Share on other sites
Sign in to follow this