On 2/4/2014 3:37 AM, Alexander Clouter wrote:
I recommend you write the simpliest and dumbest solution you can to
get it working. Only after that, and with the rest of your game
componments in place, will you start to understand the problem and
maybe wish to revisit the backing store for your map data works.
mmap()ing a huge file will let you write simple seperate debug tools,
you could even use a hex-editor to tell if things are correct or not.
Good luck and I hope you have fun!
I don't believe mmap will be much of a help to me. I have no problem
getting these maps into memory. I've already implemented lazy map
loading. It will only load the sections of the map that are close by and
of those sections it loads it only renders the ones that can currently
be seen. So the map structure for my game is already fairly complete and
working. This was the part where I was trying to make it better.
Compressed, private encrypted sections, delta-encoding, sharable via
P2P, etc.
On 2/4/2014 2:39 PM, Lasse Collin wrote:
Once you have that working, you could try a multi-file approach and
write for example 16x16 tiles per file, again each tile taking a fixed
amount of space. Naturally you need to name each file so that you know
which file contains which tiles. A new empty map can consist of no
files: any missing file is considered to be full of empty tiles. That
way small maps don't take much space. Later you can add compression
easily by compressing each file separately.
Don't worry about a single-file compressed map format for now.
I suppose the multi-file approach would be a better alternative. I liked
the idea of a massive single-file map but I don't suppose that's going
to work too well. I figured pushing down data would be an easy solution
and that I could then ship those map changes using delta-encoding for
really small updates.
A lot of the data in the map file is repetitive though so I think I'll
just go about extracting that data and putting it into another file and
have the map point there.
Thanks for the help guys. Sorry it didn't seem to have much to do with
compression but rather me not knowing how file systems work.
--
*Brandon J. Fergerson*