Anything related in any way to game development as a whole is welcome here. Tell us about your game, grace us with your project, show us your new YouTube video, etc.
I was wondering how to go about doing that. Here is what I came up until now. I was thinking of making about 3 .txt files like: "level.txt", "units.txt", "titles.txt", "objects.txt". In level.txt I would have something like this:
0 0 0 0 0
0 0 0 0 0
1 0 0 0 1 // 1 - being a unit
2 2 2 2 2 // 2 - being a title
Then in titles.txt I was thinking of having: (more details about the type of title)
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
4 4 4 4 4 // 4 - being the 4th title just a random title example could have been 1,2,3...
And in units.txt: (more details about the type of unit)
0 0 0 0 0
0 0 0 0 0
1 0 0 0 2 // 1 - being unit no. 1, 2 - being unit no. 2
0 0 0 0 0
But this just doesn't seem right... And I was looking for some alternative(better) formats for levels.
Don't bother splitting everything into 3 different files, there are two perfectly functional ways (that I can think of off the top of my head) to toss it all into one.
The most obvious way is to throw newlines between each set of info.
0 0 0 0 0
0 0 0 0 0
1 0 0 0 1 // 1 - being a unit
2 2 2 2 2 // 2 - being a title
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
4 4 4 4 4 // 4 - being the 4th title :shock: just a random title example could have been 1,2,3...
0 0 0 0 0
0 0 0 0 0
1 0 0 0 2 // 1 - being unit no. 1, 2 - being unit no. 2
0 0 0 0 0
The first number tells you unit or title, the second goes more specific.
If you need more than 10 of each either use 10-29 for units and 30-49 for titles, or go to three digit numbers (allows up to 100 specifications).
Post back with any questions.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
Thanks that's a pretty good idea! What if I want to make a "custom" collision box? How would that look in the "level.txt" ? By that I mean making a 32x32 sprite or something, and making it's collision box 30x30 or something like that. Or would I have to make a brand new type for that? I'll give more power of thought for that later on though. I'll just go on with the game until then. Thanks!
Edit: I would still love to hear about how people handle level loading, maybe I would get some good ideas
adikid89 wrote:Thanks that's a pretty good idea! What if I want to make a "custom" collision box? How would that look in the "level.txt" ? By that I mean making a 32x32 sprite or something, and making it's collision box 30x30 or something like that. Or would I have to make a brand new type for that? I'll give more power of thought for that later on though. I'll just go on with the game until then. Thanks!
Edit: I would still love to hear about how people handle level loading, maybe I would get some good ideas
Yeah, I never really came up with a concrete system for loading object data. I had started putting each type of object's data into a file with an id, then having a section in the map file for which objects would be loaded where. You could store the bounding boxes in the object data file. I found it difficult to find any information anywhere on how other people had done this, so this method is just something I created on a whim.
The farther you get into game development, the less information you'll be able to find about what you're trying to do, and the more you really just have to invent your own system and better it as needed.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
adikid89 wrote:Thanks that's a pretty good idea! What if I want to make a "custom" collision box? How would that look in the "level.txt" ? By that I mean making a 32x32 sprite or something, and making it's collision box 30x30 or something like that. Or would I have to make a brand new type for that? I'll give more power of thought for that later on though. I'll just go on with the game until then. Thanks!
Edit: I would still love to hear about how people handle level loading, maybe I would get some good ideas
Then I would keep the level data in level.txt and make another file units.xml in units.xml i would do something like this:
<units>
<unit type="2">
<position>23,402</position>
<sprite>sprites/sprite.png</sprite>
<bbox>30,30</bbox>
<otherUnitInfo>info</otherUnitInfo>
[and so on...]
</unit>
[next unit here]
</units>
im no XML wizard and im not completely sure what should be attributes and what should be tags, but something along those lines. You could also use another format like YAML or just text files.