Leprosy: what JonnyQuest probably means is that you should render all tiles that share a texture, before switching textures.
i.e. if half of the tiles uses texture1 and the the other half uses texture2, then render all the texture1-triangles first and then all the texture2-triangles.
Without this sorting the worst-case scenario is that you switch textures between every triangle you render = big performance loss.
Check out my 3D tile engine please
quote: Original post by Anonymous Poster
Leprosy: what JonnyQuest probably means is that you should render all tiles that share a texture, before switching textures.
i.e. if half of the tiles uses texture1 and the the other half uses texture2, then render all the texture1-triangles first and then all the texture2-triangles.
Without this sorting the worst-case scenario is that you switch textures between every triangle you render = big performance loss.
I dont think you lose any frames.. at tops maybe 1 or 2 fps. I tried it in my code so that it only set the texture once per frame instead of every triangle and saw a 0-1 fps increase. Any gain that you would see in switching textures a few hundred less times would be negated by the cost of having to sort which tiles to to blit first, ie making a list of each texture type, determing their position and then worrying about z order with height maps. I dont think that there is any major solution to get 90 fps at 1024 768 on a crappy video card, if it is going to go that fast it is going to be becuase you have some wicked video card and not becuase you use linked list instead of arrays or some other messy solution.
Lep
Leprosy, your both right and wrong. It will help alot to not switch textures if you have alot of textures, specifically when all of your textures can not fit into video memory. If you program is small like mine is right now and only uses 9KB of video memory for textures then to swith textures even a 1000 times a frame will not make any difference.
However, if your textures start to become larger and larger and then it takes more and more time to switch per texture. And you hit a serious performance drop if not all of your textures arent in video memory. For example, you have a group of textures in video memory and the one you need isnt, then you have to fetch it from system memory (which is very slow) and now that you got that texture in vid memory, you will want to use it while it is there and not switch to another texture. For situations like this you defeanately want to not keep switching textures.
For a tile game, you can probably fit all the tiles into memory at once. I doubt they would take up more a meg or 2. So what you would want to do is load a certain group of textures into vid memory and then render those. Like load all terrains into vid memory and render all tiles with terrain. Then load all unit textures into vid and then render all of your units.
Possibility
However, if your textures start to become larger and larger and then it takes more and more time to switch per texture. And you hit a serious performance drop if not all of your textures arent in video memory. For example, you have a group of textures in video memory and the one you need isnt, then you have to fetch it from system memory (which is very slow) and now that you got that texture in vid memory, you will want to use it while it is there and not switch to another texture. For situations like this you defeanately want to not keep switching textures.
For a tile game, you can probably fit all the tiles into memory at once. I doubt they would take up more a meg or 2. So what you would want to do is load a certain group of textures into vid memory and then render those. Like load all terrains into vid memory and render all tiles with terrain. Then load all unit textures into vid and then render all of your units.
Possibility
When I tried the old version the screen went black and my computer froze.
I have
AMD Atholon 750 mhz and a
Diamond Stealth 3 card
I have
AMD Atholon 750 mhz and a
Diamond Stealth 3 card
Visit http://members.xoom.com/ivanickgames
PIII 450, 256MB RAM, Asus Geforce 32MB,Win98
w/lighting--58-60fps
w/out lighting 85fps
The first time I ran it I got a blank screen, then went back to windows.
The second time it ran fine
Nice cow =)
A little bit of content would be nice though =)
w/lighting--58-60fps
w/out lighting 85fps
The first time I ran it I got a blank screen, then went back to windows.
The second time it ran fine
Nice cow =)
A little bit of content would be nice though =)
---------------------------Hello, and Welcome to some arbitrary temporal location in the space-time continuum.
quote: Original post by Possibility
Leprosy, your both right and wrong. It will help alot to not switch textures if you have alot of textures, specifically when all of your textures can not fit into video memory. If you program is small like mine is right now and only uses 9KB of video memory for textures then to swith textures even a 1000 times a frame will not make any difference.
However, if your textures start to become larger and larger and then it takes more and more time to switch per texture. And you hit a serious performance drop if not all of your textures arent in video memory. For example, you have a group of textures in video memory and the one you need isnt, then you have to fetch it from system memory (which is very slow) and now that you got that texture in vid memory, you will want to use it while it is there and not switch to another texture. For situations like this you defeanately want to not keep switching textures.
For a tile game, you can probably fit all the tiles into memory at once. I doubt they would take up more a meg or 2. So what you would want to do is load a certain group of textures into vid memory and then render those. Like load all terrains into vid memory and render all tiles with terrain. Then load all unit textures into vid and then render all of your units.
Possibility
D3D uses a texture managment routine for you in that it will store textures more often used in video memory and i think it also has ways of compressing the data... Im not sure though how it works exactly so it might not be optimally effective and of course you dont have to use the texture manager. I know for my code I dont specificy textures as being in video or system i just use DDSCAPS2_TEXTUREMANAGE... maybe an article on exactly what calls determine how the textures are managed and if there are ways to specify would help. Another problem you run into is getting the z order right (if your objects span multiple tiles) it might be fairly complicated.
Lep
40FPS with Papa Roach playing and IE open.
Celeron 333 64MB ram and TNT1 card.
The lighting is hot man...
Celeron 333 64MB ram and TNT1 card.
The lighting is hot man...
Well, running DrawPrimitive once per tile is damn slow. I use triangle lists (soon to be changed to indexed triangle lists) and render all tiles with one texture at once. I also put multiple tile textures in one DD surface for further optimisation.
I''ll post a screenshot as soon as I''m happy with it
- JQ, PWC Software
"programming is all about wasting time" -me
I''ll post a screenshot as soon as I''m happy with it
- JQ, PWC Software
"programming is all about wasting time" -me
~phil
I tried putting all 3 of my tile images onto a single texture, and then just using the portion of that texture i need for that tile, but there is a problem with that, and that is blurrying you get at the transition like from 1 tile image to the next on your single texture image.
For example if in your texture you have the water tile image next to the grassland tile image, then the green and blue become blurred with each other, so when you draw your grassland tile the edge of it will be slightly blue for the edge of the texture that was next to the water.
Possibility
For example if in your texture you have the water tile image next to the grassland tile image, then the green and blue become blurred with each other, so when you draw your grassland tile the edge of it will be slightly blue for the edge of the texture that was next to the water.
Possibility
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement