Skip to main content
gamedev.net
🔒 Locked

Isometric Engine help

Started by Witchcraven Oct 24, 2001 at 12:32 AM 4 replies 250+ views
Original Post
Witchcraven
Witchcraven
I am programming an isometric game, and I do not have time to read through tutorials. I have several questions. What is the width to height ration for a diamond? Also, I have a ram managagment problem. All of the units are going to be in 2d, but they need to be about 100x50pixels on average. Now with 8frames of animation per movement, and 8 directions, that is a bunch of memory. There will be about 20-50 units loaded at any given time. Plus all of the background tiles. ANyone have any good ideas of how to manage this?
--------------------------I present for tribute this haiku:Inane Ravings OfThe Haunting JubilationA Mad Engineer©Copyright 2005 ExtrariusAll Rights Reserved
Witchcraven
Witchcraven
Thats a good idea. Do you know how to probe free ram under linux and windows. If I could do that I think I could optimize the number of possible unit types in memory. What is a good width/height ratio for an iso tile?
--------------------------I present for tribute this haiku:Inane Ravings OfThe Haunting JubilationA Mad Engineer©Copyright 2005 ExtrariusAll Rights Reserved
RandomTask
RandomTask
Witchcraven,
You can read data from the /proc file system in linux to look at things like memory usage. Unfortunately in linux''s case this isn''t going to help you much. Linux utilizes on demand memory paging.

Windows98 has a virtual memory management mechanism called "swapping" which achieves the same thing as paging. WindowsNT/2000 uses "paging."

Because linux uses paging, the kernel will keep as much information in memory as possible _until_ it is asked to page it. This will make it look like you have a lot fewer memory resources than you really do if you query linux for available memory.

When system resources are plentiful Linux allows its subsytems to cache data to increase performance. The cached data is usually disk requests. In this case the cached data then would be dirty pages that haven''t been written to disk yet because there is a possibility that they may be changed again.

Windows98 on the other hand spends lots of time freeing up system resources immediately and doesn''t cache. What this means is that basically in linux (and possibly in NT/2000) you can''t use "free available RAM" as an indicator of how much memory is currently in use on the system. I think you may be able to do a little math though with some numbers you get from "top" to determine how much, minus that which is cached, you have available.

As far as your other problem. Is every tile of your map different? If not then there is an easy solution to your memory consumption problem. In your map cells, instead of storing the actual tile image in every single cell, using tile size amounts of memory for every cell, store a pointer to a structure that contains the tile image. Then when you draw a slice of your map the memory requirement footprint for the map is only as large as the number of tiles you actually display (tilesize)*(tiles) + (mapsize*int32);

Now, when you have duplicate tiles you are only storing the tile in one place until you actually display it.

What I''m doing is actually drawing my tiles on 3D polygons as textures. This allows me to make openGL texture objects out of my tile images. I actually store the openGL texture ID in my map cells. My "map screen" is the window that shows the the map that one can see and is defined as a 20 by 20 array of polygons.

The map screen array holds an index to the main map so each map screen array cell holds an index to a cooresponding main map array cell. The main map moves under the map screen so the map screen array cells will hold different main map cells frequently.

So when I draw a cell I just tell openGL to bind the textureID in the map cell to the polygon that is the map screen cell. OpenGL will put all the tile images in video texture memory. This way my map tiles take up very little, if any system memory.

Probably much to complicated a technique for its own good.

RandomTask
Witchcraven
Witchcraven
I already do that without the 3d stuff. I do not hold duplicates of image data. I just use pointers and draw as necesary. but there are about 10 megs of different tiles, which I can load similtaneously in to memoery. But I already use a prioritization algorithm to keep that to about 1meg of memory. Its the huge amount of memory that units take up. I cant use a priotiziation for algorithm for unit data, because all of the units will be visible in a very short period of time. What might work is a methos of loading the unit data based on what is needed at the moment, and loading it off the harddrive, but that is slow. I just got an idea, is there a very fast for of decopressing data into memory. I might be able to load data off the harddrie fast enough. Remember, I dont use 3d for this game(I like the raytraced units animated in 2d look), also I already store the data for units and tiles in arrays, and use pointers to them so I dont hold duplicate data. There is just so much artwork that I need. I suppose I could store commonly used unit data on the video card, but I dont know how much consumers will have on their cards. Any insights on loading quickly unit data in real time off the harddrive would be useful.
--------------------------I present for tribute this haiku:Inane Ravings OfThe Haunting JubilationA Mad Engineer©Copyright 2005 ExtrariusAll Rights Reserved

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.