# A few queries about my Map Data (& ideas of improvement, seconded opinion required)

so like the title says i'm trying to think of ways that i can basically improve my level/map data. Currently it's "alright" but i don't feel it's great. There's certain things that i'd like to-do to improve on it, but i have concerns on things that i have in mind. So i guess i'm looking for seconded opinions. For some more basic info, the game is written in C# using XNA.

So i'll begin by showing you guys a example of a level i currently have; http://pastebin.com/dnYQfMYV

So currently the files are in a .txt format, i'm 100% sure that i'm going to change this into XML. I think purely because i can hopefully add in extra data with ease, without having to worry about the reading of that data as much. Especially since using the new XElement API, it makes things so much easier :).

But onto my concerns:

1. Currently, you'll see my collision layer containing a variety of numbers, currently these numbers represent items to load, or collision objects i.e 1 references a normal collision, 2 is a right slope object, 3 is a left slope etc. But my idea is separate the object items from the collision data, to give them there individual data section. What i mean is saving them directly into the level data file, underneath the layers. Instead of how i'm doing it now which really is taking the numbers and creating them just after the collision layer has been read. My concern; Lots more data will most be saved, especially in bigger areas were there might be a-lot of enemies, maximum enemy count for a big stage, will likely be around <=20. So should i be worried in terms of having to load that data? And also with saving data, i guess both go hand-in-hand.
2. My next idea i had was perhaps on concerning a way of improving the level flow of the game, currently again you'll see in the Collision Layer the Number "50" at the far edge of the screen, this here means that we've hit a level exit. Sort of a trigger to say ok, were should we go next. At the top of the file, you see the map exits, currently showing that if the player leaves the map via those edges, what level should we open up next. Right now i guess i don't necessarily like the system, i have the idea of having the level exit data also be it's own entity in the map data, that way hopefully i can customize it and i guess it's restrictive in that i would only be able to have 1 exit per edge, were i might like to change things up with multiple exits to levels on the edges. But i'm curious to if this is a good way of going about it? Or if there is perhaps a better alternative?
3. Third & finally, its all good talking about these ideas, and mainly they really are concerned with placing things into there own unique structures in the level data, and there pros/cons of doing that. But in terms of placing these items, i'm going to need a form of library in which i can then use to select what objects i want to place. Whether these be some form of animation tile, or enemy. I've been looking around at a few examples of this, i think what i'd like to-do is somewhat similar to this video: http://www.youtube.com/watch?v=lbmaVlGXE0A&list=UUlkmq35aIgZCy5KHst78C5g&index=5&feature=plcp If you skip to 5:15 mark you'll see his approach. He manages all his objects, animated files etc. via the menu interface he has, which i think should work quite well for what i'm thinking of doing. My concern, will that be suitable to fit the purpose of what i have in mind? In terms of a few coding questions here, i myself will be using .net like he has, so i'm wondering what toolbox object he uses to show the hierarchy of his folders> *You see this at the 5:20 mark. I'm also wondering when he right clicks on his animated tile template, he has his own little "edit/delete" menu pop-up, i think something like that would be a nice addition to my editor, and am curious on how to achieve this myself.

And there's my concerns, ideas and questions i have. Quite a bit to read, sorry about that. But really I've been looking back at my progress on my game over the last few weeks, to notice how annoying certain things are, and i guess i just really want to improve things. Make things easier on myself, and perhaps learn something while i'm at it :). So thanks in advance for any help :D.

• This is really three separate questions and should be posted as such. – user1430 Jan 16 '12 at 17:08

Firstly, your pastebin is hard to read. I took the liberty of doing a simple search and replace, to make it Tab-delimited instead of space: http://pastebin.com/YiSUiEmJ

Hope you don't mind. Don't forget to toggle off line wrap!

1. I don't entirely understand your question, but I'll do my best.

• Text files are not big. Your text file is tiny. If you are really concerned about space in this age of cheap 1 TB hard drives, you should think about saving the files in some binary format (and including a level editor if you want people to make their own levels).
• Do separate the collision map and the enemy placement map! An extra map is not that much space in the grand scheme of thing, but it will make things a lot more sane and organized for you or any other level designer.
• For placing a small number of enemies on a large map, consider using a list instead of an explicit matrix. Your file's enemies section would have 20 lines like "56: 12, 24" which your game would interpret as "place an enemy of type 56 at coordinates 12, 24".
2. Again, you can use a list for exits. It would be a separate list for exits only, and go like "7: 64, 2" which means there is an exit at 64, 2 which goes to level 7. You can easily come up with a system for defining whole rectangles as exits if you need to mark large exit areas.

3. Again, I don't understand.

• Do you have trouble remembering what the numbers mean? For inside the program, check out Enum. Besides that, you can use letters (and even words) instead of numbers. Currently, I use colors, which has the added benefit of making my levels look nice in Paint.
• Do you want a level editor? Then make one. It's a fairly trivial application. Even Excel is a pretty powerful tool (Ctrl for selecting multiple cells, don't forget about conditional formatting) for making such files.
• Do you want a program you can use that someone else wrote? Simply find a game similar to yours which does have a level editor, and make your game's file format compatible with that game's level editor.
• Well a bit of an old question but needless to say, everything you have suggested i did indeed do. I did have an older map editor i created, after i created this question i started working on a newer one. I also realized that yes, my files are tiny in comparison to other games, i guess i was over-worrying about the details rather than just doing it. – dan369 Feb 9 '12 at 4:33