Answer About Maps into one file?

Reply

Join Date: Apr 2009
Posts: 6
Reputation: jaypaul is an unknown quantity at this point 
Solved Threads: 0
jaypaul jaypaul is offline Offline
Newbie Poster

Answer About Maps into one file?

 
0
  #1
Jun 1st, 2009
Hello,

I've started work on building a 2d tile based platform game, and have just been wondering about how to store/distribute the games levels.

this game allows you to load a 'World' which is made up of potentially up to 10000 map files (A 100x100 grid, though most of
the time this grid won't be filled). The map files are just more grids of tiles.Anyways, I't seems like having up to 10000 small files in a folder seems like a inefficient way to do this.

I tried to find any useful help but unable to find anything extremely helpful.

I figure that the best thing to do would be to compile all the maps into one world file, and just load that file into memory.

I have thought about just creating one xml file to store everything, but I'm not too sure about it.

Your Answers will be helpful

Thanks
Jay
Last edited by jaypaul; Jun 1st, 2009 at 7:33 am.
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 24
Reputation: Cardboard Box is an unknown quantity at this point 
Solved Threads: 0
Cardboard Box Cardboard Box is offline Offline
Newbie Poster

Re: Answer About Maps into one file?

 
0
  #2
Jun 10th, 2009
Hi

I was considering the same question myself. I looked at a couple of good tutorials at vbprogramming8k, which taught me how to store data in a notepad text file. If you use a loop and a 2D array to store all the data, you can access numbers from the text file and convert them to images. What language are you coding this in?

Please tell me if anyone knows another way.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 489
Reputation: shadwickman will become famous soon enough shadwickman will become famous soon enough 
Solved Threads: 76
shadwickman's Avatar
shadwickman shadwickman is offline Offline
Posting Pro in Training

Re: Answer About Maps into one file?

 
0
  #3
Jun 24th, 2009
Just store your data in one file for each map, simple solution. Each row is a row in the map, and each value between commas in a column:
1,5,6,3,5
4,8,9,6,4
2,4,6,7,6
0,0,1,3,2
5,7,4,2,1
That could be a 5 x 5 map. Then just read the file and split data into a 2D array or a list, depending on your programming language.
"Two good old boys in a fire-apple red convertible. Stoned. Ripped. Twisted. Good people."
- Hunter S. Thompson

my photography
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 24
Reputation: Cardboard Box is an unknown quantity at this point 
Solved Threads: 0
Cardboard Box Cardboard Box is offline Offline
Newbie Poster

Re: Answer About Maps into one file?

 
0
  #4
Jun 24th, 2009
Hi

I was coding a strategy game with ships the other day, and I was wondering how to draw the ships in. I figured maybe a notepad file like shadwickman said . However, if I want to give a ship an individual identity, how does it work? Cause if each ship is identified by say a 1, and there are 4 of these, how do I specify an action to occur to an individual ship?

Thanks
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 489
Reputation: shadwickman will become famous soon enough shadwickman will become famous soon enough 
Solved Threads: 76
shadwickman's Avatar
shadwickman shadwickman is offline Offline
Posting Pro in Training

Re: Answer About Maps into one file?

 
0
  #5
Jun 24th, 2009
Ohhh boy. It looks like you need to actually learn a programming language still. What are you currently making this game in? It sounds like you don't know the basics of what an object is, or about classes and inheritance, etc... Are you using VisualBasic or something?
"Two good old boys in a fire-apple red convertible. Stoned. Ripped. Twisted. Good people."
- Hunter S. Thompson

my photography
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 24
Reputation: Cardboard Box is an unknown quantity at this point 
Solved Threads: 0
Cardboard Box Cardboard Box is offline Offline
Newbie Poster

Re: Answer About Maps into one file?

 
0
  #6
Jun 24th, 2009
Hi

I am coding in Visual Basic.NET, and yes, I do understand how classes and the other stuff works. At the moment I have got a notepad file and my program takes the numbers from there to convert to data. Maybe I didn't express my problem clearly. The only problem at the moment is how to access the individual data for each ship. I have a piece of an array for each ship, so in that sense I know what the name of each ship is. But the name isn't the whole identity of each of the objects, is it?
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 489
Reputation: shadwickman will become famous soon enough shadwickman will become famous soon enough 
Solved Threads: 76
shadwickman's Avatar
shadwickman shadwickman is offline Offline
Posting Pro in Training

Re: Answer About Maps into one file?

 
0
  #7
Jun 24th, 2009
I never have used VB, but what you'd need is to track the pointers to the ships in an array (or objects in the array, however VB does it). That way you can directly access the ship instances through the array. In Python it would be like this:
  1. # my ship class
  2. class Ship(object):
  3. def __init__(self, name):
  4. self.name = name
  5.  
  6. # test ships
  7. a = Ship("Galleon")
  8. b = Ship("Skiff")
  9. c = Ship("Rowboat")
  10. myships = [a, b, c] # list of ship objects
  11.  
  12. # access ships
  13. print myships[0].name # result is "Galleon"
  14. myships[1].name = "Wreckage"
  15. print myships[1].name # result is "Wreckage"
You can see that the list contains the objects so that you can directly modify them or access their properties.
Last edited by shadwickman; Jun 24th, 2009 at 7:42 am.
"Two good old boys in a fire-apple red convertible. Stoned. Ripped. Twisted. Good people."
- Hunter S. Thompson

my photography
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 24
Reputation: Cardboard Box is an unknown quantity at this point 
Solved Threads: 0
Cardboard Box Cardboard Box is offline Offline
Newbie Poster

Re: Answer About Maps into one file?

 
0
  #8
Jun 24th, 2009
Hi

Thanks, Shadwickman. I'll try out your solution ASAP.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Game Development Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC