943,729 Members | Top Members by Rank

Ad:
Jun 1st, 2009
0

Answer About Maps into one file?

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jaypaul is offline Offline
6 posts
since Apr 2009
Jun 10th, 2009
0

Re: Answer About Maps into one file?

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.
Reputation Points: 10
Solved Threads: 0
Light Poster
Cardboard Box is offline Offline
27 posts
since Mar 2009
Jun 24th, 2009
0

Re: Answer About Maps into one file?

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.
Reputation Points: 186
Solved Threads: 77
Posting Pro in Training
shadwickman is offline Offline
495 posts
since Jul 2007
Jun 24th, 2009
0

Re: Answer About Maps into one file?

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
Reputation Points: 10
Solved Threads: 0
Light Poster
Cardboard Box is offline Offline
27 posts
since Mar 2009
Jun 24th, 2009
0

Re: Answer About Maps into one file?

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?
Reputation Points: 186
Solved Threads: 77
Posting Pro in Training
shadwickman is offline Offline
495 posts
since Jul 2007
Jun 24th, 2009
0

Re: Answer About Maps into one file?

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?
Reputation Points: 10
Solved Threads: 0
Light Poster
Cardboard Box is offline Offline
27 posts
since Mar 2009
Jun 24th, 2009
0

Re: Answer About Maps into one file?

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:
python Syntax (Toggle Plain Text)
  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.
Reputation Points: 186
Solved Threads: 77
Posting Pro in Training
shadwickman is offline Offline
495 posts
since Jul 2007
Jun 24th, 2009
0

Re: Answer About Maps into one file?

Hi

Thanks, Shadwickman. I'll try out your solution ASAP.
Reputation Points: 10
Solved Threads: 0
Light Poster
Cardboard Box is offline Offline
27 posts
since Mar 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Game Development Forum Timeline: Help- desiging game
Next Thread in Game Development Forum Timeline: Python Universe Builder





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC