46
General discussions / Re: SFML Game Development by Example - 4th SFML book
« on: October 10, 2016, 05:13:11 pm »
Hello, BonBons! Thank you for your kind words. I'm really glad you're enjoying the book so far.
By tiled, do you mean the Tiled Map Editor? (http://www.mapeditor.org/) If you do, I'm afraid I have no experience with it and wouldn't know if they even use the same type of elevation principles, not to mention other parameters necessary for their own format. I'm sure you could build a tool that somehow parses their format and writes it out however you want, but I can't say too much without looking at it.
If you simply mean how a map file like that can be saved, there's a big hint at the top of the file. As you can see, it's all saved as plain-text, making it easy to read and understand should you want to make revisions. All the lines that begin with the pipe symbol "|" are ignored by the code and treated as comments. Just above each new type of map file entry, there's a comment that explains exactly what parameters are stored in that line. For example, entities are stored by writing in the name of the entity type first, then the X and Y coordinates of the entity, and finally the elevation. Tiles store an additional value for their solidity, which can be either 0 or 1. That's pretty much all there is to it. If you can do basic file I/O, you know enough to save your entities and tiles in this format.
Hopefully this answers your question. I'm currently working on something that I can't say too much about, but let's just say that a portion of it deals with creating software that helps you build your own maps really easily. It should be out soon, so stay tuned.
By tiled, do you mean the Tiled Map Editor? (http://www.mapeditor.org/) If you do, I'm afraid I have no experience with it and wouldn't know if they even use the same type of elevation principles, not to mention other parameters necessary for their own format. I'm sure you could build a tool that somehow parses their format and writes it out however you want, but I can't say too much without looking at it.
If you simply mean how a map file like that can be saved, there's a big hint at the top of the file. As you can see, it's all saved as plain-text, making it easy to read and understand should you want to make revisions. All the lines that begin with the pipe symbol "|" are ignored by the code and treated as comments. Just above each new type of map file entry, there's a comment that explains exactly what parameters are stored in that line. For example, entities are stored by writing in the name of the entity type first, then the X and Y coordinates of the entity, and finally the elevation. Tiles store an additional value for their solidity, which can be either 0 or 1. That's pretty much all there is to it. If you can do basic file I/O, you know enough to save your entities and tiles in this format.
Hopefully this answers your question. I'm currently working on something that I can't say too much about, but let's just say that a portion of it deals with creating software that helps you build your own maps really easily. It should be out soon, so stay tuned.