Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Map editor: Storing tiles as one bitmap or separate
Index -> General Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Aziz




PostPosted: Mon Nov 27, 2006 10:12 am   Post subject: Map editor: Storing tiles as one bitmap or separate

In a 2d tile map editor, after the user wants to save to map and export it, would one want to save all the tiles in one large bitmap, or to save them separately.

I was thinking that using one large bitmap was better, since you would only create on image file during runtime, rather than opening several. Also, in this case, would there be a difference in storing 30 tiles in one long string, or making it a 5x6 rectangle?
Sponsor
Sponsor
Sponsor
sponsor
ZeroPaladn




PostPosted: Mon Nov 27, 2006 10:29 am   Post subject: (No subject)

Saving the whole map as one big bitmap would save memory, but I was wondering on how you would do the colission detection? If you have just one big custom map, how would the program determine which areas of the map would be ok to go on, without hardcoding it?
Tony




PostPosted: Mon Nov 27, 2006 10:31 am   Post subject: Re: Map editor: Storing tiles as one bitmap or separate

Aziz wrote:

I was thinking that using one large bitmap was better, since you would only create on image file during runtime, rather than opening several

On the other hand, you'd need to open and parse this one large bitmap just to get a single tile. I think it would depend on how you access your tile images, and what you do with them once loaded.

I don't think the arrangement (line vs rectangle) is critical, as long as you know what you are doing.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Aziz




PostPosted: Mon Nov 27, 2006 12:41 pm   Post subject: (No subject)

That's a good point, but usually all drawing is done at one time, and each tileset is per map, so you would open image, draw map by referring to image, then close the image?
Tony




PostPosted: Mon Nov 27, 2006 1:54 pm   Post subject: (No subject)

You could just perform a benchmark, and see which way is faster to load a sample map.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
ericfourfour




PostPosted: Mon Nov 27, 2006 3:22 pm   Post subject: (No subject)

I'd recommend having a list of tiles and a reference to each tile in the bitmap. This reference can be a number. A sample file would look like this:

file:
0 (reference number)
pic.bmp (picture file)
(other attributes)
...
...
(repeat for other tiles)
0 0 0 0 0 0 (map)
0 1 1 1 1 0
0 0 0 0 0 0


You should also have a way for the program to tell when to change from parsing tiles to parsing a map.
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: