Grimmys/rpg_tactical_fantasy_game

Question about the Choice of XML for Configuration Files

Closed this issue · 2 comments

Hello,

I'm a beginner in Python programming and I've been learning a lot from studying your game project. I noticed that the game configurations are stored in XML format. As a newcomer to the field, I am curious to know if there was any particular reason for opting for XML instead of JSON. From what I've gathered, JSON seems to be a more lightweight and popular choice for data storage nowadays.

I'm eager to understand more about the technical choices made in this project and would appreciate any insights you could provide.

Thank you!

Hello,

I'm happy to know you learnt a lot from your game project, that's why I'm still trying to actively support it: I want it to be a reference for people wanting to learn about Python, pygame and game dev. 😄

Regarding the choice of XML, that's a really good question, and that's mostly for historical reasons: when I started this project, I wasn't envisioning anything big, and just wanted to have fun. So I chose XML... Mostly because I wanted to apply the knowledge I got about it at university.
You are right that JSON is a lighter and way more standardized solution for this kind of project.

In fact, XML used to be use in this project for game options, save data and game levels data.
Recently, I finished making the transition to TMX format for game levels data. Perhaps one day XML would not be used anymore at all in this project.

So short answer: technical choices in this project are kinda legacy, and were made without any relevant investigation.

As you earn experience in programming, you will likely learn that quite often things are not as good as they should be ; people always make wrong decisions at some point, and you cannot easily change the bad decisions that have been made in the past.
So just keep in mind that if something doesn't make sense to you, it's not always because you don't understand it, it can also be because they are just wrong.

Thanks for the quick and honest response! now I understand the reason behind choosing XML. Thanks for clarifying!

And mistakes or not, your project is super helpful to me. I've learned heaps already.

I'll keep digging into it and maybe even help out down the line. Cheers!