linked lists

Started by
6 comments, last by Fitore 22 years, 8 months ago
im just wondering if its possible to cycle through a linked list with about 800 nodes every frame at the rate of 30fps, if so, what do you think the max nodes a single frame could handle,
Advertisement
I think you can...it does kinda depend on how you are checking the list though. If you have to use strcmp() and some other comparisons you might have a bit of a problem. You might want to look into Hash Tables though...what is in your lists?
Of course you can, but it does depend on what you need to do with each element in the list and how many times you need to traverse the entire list.

The key to large lists is to be able to skip elements that are not
usefull this frame quickly. Also the ability to fastly add and remove elements in the list, while not allocating memory, is very key.


thanx for the replies,
im working on the tiled based game right now, and im just thinking using a linked list(double) to store all the moving characters'' z coordinates, get them all sorted and just draw the list from head to tail. now the only problem is we can only update a few nodes a time, im just trying to figure out how many exactly and in what order.
i got this idea from the isometric forum a while ago, you are more than welcome to try it out and show me whatu got
Take a look at the STL. The list class gives you a double linked list. But even better for your needs would be multiset. It is automatically sorts for you (internally its a binary tree).

Jack
but it would be hard to balance the tree,
If there are up to 800 objects in your game world, they can''t all be on the screen at once, can they?

What about having a list that just contains objects that are visible. When the camera or an object
moves and it becomes visible, add it to the list. When an object is no longer visible because it or the
camera moved, remove it from the list. Go through this list of Z coords when drawing instead of the
larger one.

Just a thought.
then what if you just moved your camera into a highly populated area with, say 200 units, that would take a few seconds to update the whole screen, but its a good approach, im just thinking maybe i can divide my mud into smaller regions, say 10k by 10k, you still have to cycle through everyone to check if it in the region, maybe ill just create a low priority thread to handle that,
well, thanx for the help guys

This topic is closed to new replies.

Advertisement