• Advertisement
Sign in to follow this  

huge land

This topic is 4487 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 work on 2d strategy game. how can i make huge land where i use f.e. 10 000 objects (it's not big number). where can i save info about all objects? Because, when i save all in variables in my game, it's very hard for ram. When i save all in untype (or type, or text) file my game is too slow. how can i save all these informations? How you make with maps in your 2d engine? Thanks

Share this post


Link to post
Share on other sites
Advertisement
10.000 objects can easily be kept in ram. Assume that you need
128 bytes for each objects, that would make 10k*128 = 1.2MB
Your computer probably has 512mb or even 1gb, so this 1mb really
won't matter.
For comparison, loading a single texture of 1024*1024x32bpp
already take 4 mb.
So unless you are developing for the 80386 with 16 mb, don't
worry about it.

Now if you want to make a _huge_ land with millions of objects,
then you should start thinking about a sector-based approach
(ie one sector is 100x100 meters), only loading objects in the
current sector (and maybe in the 8 surrounding sectors)

Regards

Share this post


Link to post
Share on other sites
Quote:
Original post by Kitt3n
10.000 objects can easily be kept in ram. Assume that you need
128 bytes for each objects, that would make 10k*128 = 1.2MB
Your computer probably has 512mb or even 1gb, so this 1mb really
won't matter.
For comparison, loading a single texture of 1024*1024x32bpp
already take 4 mb.

A common mistake is to reload the same texture for each object, so 10.000 object may be too large to load to RAM.

@blazek: which info do you store for each object?

Share this post


Link to post
Share on other sites
to Kalasjniekof: no, i will save only position, rotation, health, patterns and so.

thanks to Kitt3en & Kalasjniekof :-)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You will see most strategy games feature above 10 000 objects these days if you include static ones like trees etc. Basically, the term "object" is not so good as it rather depends on how advanced an oject is how many you can store and give processing time in total. That is, any kind of combat unit that needs to look for enemes and attack them will take a lot more processing power than a static tree that basically only need to render and cause collisions.

Share this post


Link to post
Share on other sites
Quote:
That is, any kind of combat unit that needs to look for enemes and attack them will take a lot more processing power than a static tree that basically only need to render and cause collisions.


% drive past tree
You notice a tree looking evily at you and crash your car.

I love it when trees cause collisions :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement