Sign in to follow this  

huge world - memory management

This topic is 3773 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi i have a very large desert-world. Its a topdown 2d rpg with vehicles. Anyway... I plan on having several maps/world linked together and load between them but i still want each map to be pretty vast. Even though you drive through a world in a couple of minutes the objects in it quickly multiply... For now a map consists of 60K regions each of 400*400 pixels, around 150K trees/rocks and maybe 80K units such as civilians and pirates. This eats around 130MB and i havent started adding graphics, sounds and a lot of other shit that needs to be loaded. The map will require more also. Problem is that even if the vast majority of this objects are passive unless a player is close i still wanna keep them around so that they do not get randomized every time a player visits an area: this would remove the impact the player makes on an area as soon as he leaves and make the world pretty lifeless. 1. How is this handled in spacegames like freelancer? Or in diablo? I know they respawn and are not that many but anyway... 2. Is it wise to have some kind of "primitiveUnit-class" that the unit becomes when becoming passive? It only holds important data like position, direction etc and looses the deadweight of all those physics-variables... Any ideas? Thanks Erik

Share this post


Link to post
Share on other sites
Quote:
For now a map consists of 60K regions each of 400*400 pixels, around 150K trees/rocks and maybe 80K units such as civilians and pirates.


And all this data is stored in memory all the time? If the answer is yes, then you'll need to implement some sort of streaming system. Basically, only the regions that are somewhat close to the player are in memory. Whenever the player gets closer to other regions, those are loaded into memory and far regions are unloaded. Of course, you can't do this each frame because the memory traffic and file loading will kill your performance, but doing it "occasionally" should be fine (what "occasionally" means depends on your game).

Share this post


Link to post
Share on other sites
If your world is 2d the easiest solution that provides good results is a grid-based system. There is some detailed discussion with helpful links in this recent thread:

http://www.gamedev.net/community/forums/topic.asp?topic_id=459889

Share this post


Link to post
Share on other sites

This topic is 3773 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this