Config files, FOCS, Python & Co
Moderator: Committer
Re: Config files, FOCS, Python & Co
I've split the posts dealing in more detail with the potential replacement of FOCS with Python into a separate thread, so we can keep the more general discussion about how to organize our config/content/scripting files from the discussion dealing with the specific topic of a FOCS to Python migration. Please continue that discussion there.
-
- Juggernaut
- Posts: 854
- Joined: Wed Aug 26, 2015 6:15 pm
Re: Config files, FOCS, Python & Co
Fair enough, it's your project. I've worked on a lot of projects in industry using XML and XML-based configuration files and messages (SOAP etc.). That worked well enough for us. Your experiences are different, and that's ok.Vezzra wrote:Actually, IIRC game content originally had been defined by XML, before the current custom script language replaced that solution. This happened long before I joined the project, so I can only guess, but it's probably a save bet to assume XML proved to be rather unusable for that purpose.defaultuser wrote:I see, thanks. If it were straight configuration, I would suggest XML.
-
- Space Kraken
- Posts: 111
- Joined: Mon Nov 16, 2015 5:57 am
Re: Config files, FOCS, Python & Co
I just wanted to add if your really going to translate focs to py files then to me it seems essentially to be a half step.
Have you guys considered just slowly writing your own .txt file parser that is specific to this game directly from c++ building up its functionality over time. One advantage of this is that as long as you load any of these file from c++ as if it were a .txt file with the proper encoding, the extension can remain the same.
Meaning you could parse a py file or focs ect... as txt, even at runtime, even after its been compiled by python and even edit it (though that's sort of just sauce for consideration to the point im making). Which is that it means you can slowly convert file types, of all the different kinds, over time. You run them as is, until your custom FO parser in c++ has the equivalent functionality and necessary capability's to take over from focs or to replace the py functionality and replace other odd file formats. After which, you rename the extensions or rewrite the files and load them from Free Orion itself. When that is complete you are then free to change the format to a newer version mark the changes translate the files over and bring it all in line uniformly to the desired txt file syntax you feel is the most appropriate for all custom files.
The end result is total control of additional functionality to custom scripting additions error handling and all aspects from the application itself. Extensions as well as directory structure then denote what responsibility files have instead of just how a file gets loaded reducing mangling and increasing the logical structure of the entire system.
I know that sounds like a ludicrous amount of work and it is and it would take a long time, but it is in fact i think proper and that's the whole point of my comment "to answer what is the ideal" that all custom game files, should be custom loaded by the game itself uniformly and that's one possible means. Though in the above manner it could possibly be done piece meal and paced.
Have you guys considered just slowly writing your own .txt file parser that is specific to this game directly from c++ building up its functionality over time. One advantage of this is that as long as you load any of these file from c++ as if it were a .txt file with the proper encoding, the extension can remain the same.
Meaning you could parse a py file or focs ect... as txt, even at runtime, even after its been compiled by python and even edit it (though that's sort of just sauce for consideration to the point im making). Which is that it means you can slowly convert file types, of all the different kinds, over time. You run them as is, until your custom FO parser in c++ has the equivalent functionality and necessary capability's to take over from focs or to replace the py functionality and replace other odd file formats. After which, you rename the extensions or rewrite the files and load them from Free Orion itself. When that is complete you are then free to change the format to a newer version mark the changes translate the files over and bring it all in line uniformly to the desired txt file syntax you feel is the most appropriate for all custom files.
The end result is total control of additional functionality to custom scripting additions error handling and all aspects from the application itself. Extensions as well as directory structure then denote what responsibility files have instead of just how a file gets loaded reducing mangling and increasing the logical structure of the entire system.
I know that sounds like a ludicrous amount of work and it is and it would take a long time, but it is in fact i think proper and that's the whole point of my comment "to answer what is the ideal" that all custom game files, should be custom loaded by the game itself uniformly and that's one possible means. Though in the above manner it could possibly be done piece meal and paced.
- adrian_broher
- Programmer
- Posts: 1156
- Joined: Fri Mar 01, 2013 9:52 am
- Location: Germany
Re: Config files, FOCS, Python & Co
Read the code, compare with your suggestion. Sorry, I won't invest more time to reply in depth to this.xlightwavex wrote:Have you guys considered just slowly writing your own .txt file parser that is specific to this game directly from c++ building up its functionality over time.
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz