Question about massive arrays and memory

C

Cyhawk

Hello. Im working on a game, (mud actually) (socketmud for anyone who
cares ;) and ive decided on a very large array to hold my world data.
(Nethack style, every cord == number == represents a charater/sector).
Im using gzread/gzsave to store/load the array from file, which is
nice, im using about 230k disk space when the world is filled. However,
in memory its roughly 35megs ([1000][750][11]). Ive googled around, and
asked people, and theres no answer thsus far. My question is, is there
some sort of way, to easily compress, or reduce my memory requirements
for this?
Im planning on adding another 8 maps of this size to the world, and
8x35megs is not good. Appreciate any help =)
 
R

robertwessel2

Cyhawk said:
Hello. Im working on a game, (mud actually) (socketmud for anyone who
cares ;) and ive decided on a very large array to hold my world data.
(Nethack style, every cord == number == represents a charater/sector).
Im using gzread/gzsave to store/load the array from file, which is
nice, im using about 230k disk space when the world is filled. However,
in memory its roughly 35megs ([1000][750][11]). Ive googled around, and
asked people, and theres no answer thsus far. My question is, is there
some sort of way, to easily compress, or reduce my memory requirements
for this?
Im planning on adding another 8 maps of this size to the world, and
8x35megs is not good. Appreciate any help =)


This is OT for c.l.c. Try comp.programming.

OT: You'll probably want some sort of tree or sparse array structure.
 
M

Malcolm

Cyhawk said:
Hello. Im working on a game, (mud actually) (socketmud for anyone who
cares ;) and ive decided on a very large array to hold my world data.
(Nethack style, every cord == number == represents a charater/sector).
Im using gzread/gzsave to store/load the array from file, which is
nice, im using about 230k disk space when the world is filled. However,
in memory its roughly 35megs ([1000][750][11]). Ive googled around, and
asked people, and theres no answer thsus far. My question is, is there
some sort of way, to easily compress, or reduce my memory requirements
for this?
Im planning on adding another 8 maps of this size to the world, and
8x35megs is not good. Appreciate any help =)
There are all sorts of things you can do.

Is it really necessary to index every character by world square? Instead of
the 1000 * 750 (750K min) array, you could have a 100 * 75 array. The
mainain a linked list in each 10*10 square, into which you put the
characters.
Finding a character is rather slower, but is still O(N). At most you can
have 100 characters to search before you find the right one.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top