Texture management...SERIOUSLY
EACamNo...i don't mean the built-in texture manager in DX8. I'm talking about SERIOUS texture management...as in VERY SERIOUS. Okay, in my game there will be TONS of textures for tiles, sprites, this and that, LOTS AND LOTS AND LOTS. I wouldn't be surprised if i had 100 MB of pure PNG and BMP graphics. That's not counting that i do have sounds in memory. As of now (theoretical stage), my game will be 2D, birds-eye-view RPG with a scrolling screen and I will NOT have multiple game screens other than buildings, etc. that the player enters. In other words, considering that nothing is blocking u, when u are outside you could theoretically walk from the ABSOLUTE LEFT to the ABSOLUTE RIGHT of the ENTIRE GAME MAP (extremely humungus) without the screen switching (like, in old Zelda games, where going to left left of the screen wouldn't scroll, but load a different screen map, my game will have NO screens other than when u enter a building, which will have ONE screen itself.) I'm having trouble explaining this, but considering most of u are not only programmers but gamers as well, hopefully u can catch on to what I'm trying to say. What's my problem? 1) Loading the amount of graphics I need for this game is bound to take along time. If i load ALL graphics up at the beginning, i dunno if the users computer will be able to handle a possible 1000 different textures in memory and it would take forever to load them all. There is no way I can find out what parts of the game use which textures, so partitioning wouldn't be helpful...except for the actual map data, but not the textures or sounds. I will probably end up partitioning the map data considering it will be like at least 100000x100000 tiles for the outside world (the buildings won't be as big, most of them anyway) and a BUNCH of sprites in each partition (as well as lighting data, etc.). So here's my dilemma, how am i supposed to handle such a massive amount of graphics (and sounds) and keep my gaming running above 1 FPS (since I'll have to switch textures to render different tiles, sprites, at a potential minimum of 300 times PER FRAME!)? I feel like my program is going to drown in data...but with a sturdy boat, I'm hoping it will work. Any suggestions?
Sr. GuapoHave fun... seriously though, how can you have that many different textures? What are they all? If there are going to be lots of duplicate textures (like tiles) you could consider texture pooling. There is a great tutorial at DirectX4VB and I'm sure there are others.
EACamUm...that's WITH texuture pooling. Consider: *Tiles for every conceivable terrain *Items *Structures *Plants *Doorways, shelves, etc. *Animals *NPCs *Characters That's just scratching the surface dude. Perhaps 1000 is a little over estimating, i'll probably have more like 500, but it COULD get higher. (ok ok, I WAY over estimated...but it got the point accross)
Sr. GuapoSince almost all the images are going to be sprites (32 pixels square?) it won't be THAT bad... the characters will need anywhere from 8 to 32 pics each, for walking and facing different directions, so each would fit into a fairly small file (PNG, 32X1024, ~9.25 KB) times however many characters you plan on having. Plants/items/tiles similar story... Structures could just be composed of tiles as well, so that may save a little space. Assuming you are using a good image format (like PNG, BMP only when absolutely neccessary), you should be okay... Have you begun work yet, or is it still theoretical? Most of my ideas never get past that stage.[:D] Also, you said birds-eye, right, not isometric? Birds-eye would probably be easier, not to mention have fewer and simpler tiles...
masterboodaI would condense my tiles into bigger textures and then use those as the tiles... Repetition is key when you have a map of that size.... for example the largest map I have made in a game as been 1024x1024 made up of 16x16 tiles... what I did was divide that up to 256x256 textures placed the 16x16 tiles on those, and pieced them together... all in all I only started with a tile table that was 256x256 and created 64 256x256 textures... I used the copy region method to make the entire map at runtime... seems like it would be slow, but it really wasn't... And a bigger map wouldn't make that much of a difference... DaBooda out... P.S. With the sprites I put all there movements(or frames) on one texture and just change the tu and tv values according to the animation...
EACamOkay...perhaps it just seems that it will be slower than reality. Thanks. Yes, Sr. Guapo, i'm not using Isometric view, i've never been a big fan of it, birds-eye has always been my preference (not to mention it's easier to program [:D])
Sr. GuapoDon't worry about optimization yet, anyway. Get a very sloppy, inefficient, and memory leaking (maybe not that one) version done, then go through and clean everything up. Optimization should be one of the last things you do, hopefully before release, but after the "rough draft" of the program is created. When you spend time optimizing something as you program, then decide when the game is finished that it really isn't needed, you'll have wasted hours of your life.
EACamYou know...that's a lesson i should have learned years ago...i'll bet NOT doing that is a main factor in why noone ever finishes games (me included). Thanks a ton. A simple lesson, but absolutely necessary. You're totally right...that's what i'll do. Take this HUGE project on without a mind of perfecton...cuase that can come later.
Sr. GuapoYeah, just check your hard drive space/Video Memory, and go at it. If the first version only runs at 5 FPS, it doesn't matter, when all the code is cleaned up, it may run at 100...
2dcoderYou can have 1 or 1000 textures in memory, not a real hit on speed until you start going over what the video card can handle. Just keep everything at one time around 16meg or at the most 32 meg if you want a big compatible user base. Design each "level" or "world" with this 16-32meg limitation. You HAVE to keep this in mind. Or use Direct Draw Dx7 and don't worry about it.
Or use Direct Draw Dx7 and don't worry about it.
No, you'd still have to worry about it. The data goes to the same place, first video memory, then when that's full system memory and finally when that is full virtual memory on the h-disk. A lot of commercial games that have a lot of content to constantly send to the screen use a streaming system, basically they load and unload the resources they need incrementally while the user is playing.
Sr. GuapoThere is a lot to managing textures and sounds. For instance, it is pointless to have all of the indoor tiles loaded when you are walking around outside. It would also be stupid to keep the texture of the boss in the dungeon at the southernmost part of the map (too many prepositions...) in memory when you are at the far north end. It is a similar story with sounds and music. There is no need to keep the sound of running water in memory as you walk through the desert... If you don't mind having a brief loading screen while the user moves between different tilesets or whatever, that is the way to go. It will allow for more (and better) textures, while still being able to run on a computer without 256 MB of video memory...
masterboodaI agree, when I'm designing a game I keep all the levels separate and just load and unload them as the game is being played, just put in a loading please wait, type of thing between areas. Also if one area is using that much, then I would definetely consider downsizing it, because you don't wan't your player to wander around endlessly for hours... just divide it up into areas... of course this is just my opinion... As for DirectX7 being easier on a video card, it probably is, but you still have to consider memory, and to be honest a texture is a texture and a surface is a surface... so memory wise directx7 probably uses the same amount as directX8 the only difference being the program... it is the chip that gets the work out with directx 8, because there are simply more effects you can achieve with 8 and DX8 actually allows the card to do more work.... of course this is also just my opinion.... DaBooda out...
VBBRSee last Sr. Guapo's post, and I would like to add... make something like a hierarqy, for example, world -> south continent -> east portion -> cave -> dungeon -> northern part -> boss texture. So if you aren't even in the sourthern continent of course you will want to make sure the boss texture is unloaded. In turn, if you ARE in this continent you then check which portion of it you are in. If you aren't in the east portion then don't load the texture, and so forth. It's somewhat like BSP trees. (if you do know how they work) In fact... this gives me some ideas... hum... let the loading screens be gone forever!!! mhuahaha... what a creepy idea that is... hum...... let's see if my next game will have any loading screens!
EACamyeah...sweet. I spose my editor could configure a tileset for each partition by looking for all used tiles...hey! that will work fine. And then just load at each partition. Thanks a bunch guys! P.S. masterbooda, don't worry, the player can't actually GET to all the map (cause of lame things like rocks in the way, locked doors, etc.). [;)]
masterboodawhew... sorry about that, I was suffering flash backs to old pc Role Playing games... me and my step brother would wander for hours and accomplish nothing... of course we had nothing better to do... except break it down into code.. that kind of sucks being a game programmer because you really can't enjoy another game, because you are constantly trying to reverse engineer it in your head.... or is that just me? DaBooda out...
VBBROf course it's not just you... ...it includes me, too! [;)]
EACamSame here...it's torcher...unless u play a game u know u couldn't have programmed, then it's not as bad.