[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] map format



Ah, thanks for that, I forgot about how python handles leading zeros.
I dont want to place any sort of restriction on the meta information incase
I have to add more stuff later on, this way it will scale and simply work.

On 12/17/06, Farai Aschwanden <fash@xxxxxxxxxx> wrote:
Looks ok to me. One thing to mention: If you use 001 and 002, etc. it
will be turned to 1 and 2 if you read them in (Python treats them as
number). So you can safe space using direct number w/o leading zeros.
About the metafile. If you can define this in one line why not adding
it to the first line of the map? Then you can read first out the
metaline and after this you iterate through the whole map. There is
no perfomance lost on this.

Farai


Am 17.12.2006 um 06:02 schrieb spotter .:

> Hey everybody,
>
> I am in the process of trying to make a file format for maps. I am
> doing this right now with this:
>
>        <Test_Map,the_author,the_date,version_number>
>       <10,5>   # the width and height
>       <1> # layers
>       000,001,002,001,002,002,001,000,001,002,
>       000,001.002,002,002,002,001,000,001,002,
>       000,001.002,002,002,002,001,000,001,002,
>       000,001.002,002,002,002,001,000,001,002,
>       000,001.002,002,002,002,001,000,001,002
>       <1>
>
> Another way that might be easier to read into a file is to Have two
> files. One is called mapname.map and the other file will be called
> mapname.meta
> The meta file will have the info like name, author, date, version, and
> the width and height.
>
> The other file will have the actual map data in it. This method
> will be slower,
> since it involves opening, parsing, and closing two files.
>
> The second method will be easier to read in, but will affect
> performance.
> How do all of you implement maps? Do you use regular expressions or
> simple search a string ?
>
>
> Thanks,
> spot