| | |
Answer About Maps into one file?
![]() |
•
•
Join Date: Apr 2009
Posts: 6
Reputation:
Solved Threads: 0
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
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.
•
•
Join Date: Mar 2009
Posts: 24
Reputation:
Solved Threads: 0
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.
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.
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:
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.
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
"Two good old boys in a fire-apple red convertible. Stoned. Ripped. Twisted. Good people."
- Hunter S. Thompson
my photography
- Hunter S. Thompson
my photography
•
•
Join Date: Mar 2009
Posts: 24
Reputation:
Solved Threads: 0
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
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
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
- Hunter S. Thompson
my photography
•
•
Join Date: Mar 2009
Posts: 24
Reputation:
Solved Threads: 0
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?
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?
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:
You can see that the list contains the objects so that you can directly modify them or access their properties.
python Syntax (Toggle Plain Text)
# my ship class class Ship(object): def __init__(self, name): self.name = name # test ships a = Ship("Galleon") b = Ship("Skiff") c = Ship("Rowboat") myships = [a, b, c] # list of ship objects # access ships print myships[0].name # result is "Galleon" myships[1].name = "Wreckage" print myships[1].name # result is "Wreckage"
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
- Hunter S. Thompson
my photography
![]() |
Similar Threads
- input from file into class (C++)
- highjackthis log file... do help me (Viruses, Spyware and other Nasties)
- Can get IExplorer to open, but not through main exe file (Viruses, Spyware and other Nasties)
- Help with hijackthis log file (Viruses, Spyware and other Nasties)
- Error 317, Stealth.Hjack Virus (Viruses, Spyware and other Nasties)
- Getting blank pages with IE @ W-Update and hotmail with HJT file log (Viruses, Spyware and other Nasties)
- May have Virus/Spyware/Aliens? or IE Hijacked (Viruses, Spyware and other Nasties)
Other Threads in the Game Development Forum
- Previous Thread: Help- desiging game
- Next Thread: Python Universe Builder
| Thread Tools | Search this Thread |
3d advertising ai algorithm ban c++ cambridge camera censorship china competition console development engine fov fpx game gamer games gaming gauntanamo government idaho in-gameadvertisement intellectualproperty laracroft live manhunt math mathematics matrix mercenaries microsoft mmorpg msn naked news nintendo obama palin physics pirate playstation politics projection ps3 rpg search software sony stephenhawking stocks studio technology terrorism tombraider uk videogame web wii world-of-warcraft xbox xbox360





