Config files, FOCS, Python & Co

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Message
Author
User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: Config files, FOCS, Python & Co

#16 Post by Vezzra »

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.

defaultuser
Juggernaut
Posts: 854
Joined: Wed Aug 26, 2015 6:15 pm

Re: Config files, FOCS, Python & Co

#17 Post by defaultuser »

Vezzra wrote:
defaultuser wrote:I see, thanks. If it were straight configuration, I would suggest XML.
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.
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.

xlightwavex
Space Kraken
Posts: 111
Joined: Mon Nov 16, 2015 5:57 am

Re: Config files, FOCS, Python & Co

#18 Post by xlightwavex »

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.

User avatar
adrian_broher
Programmer
Posts: 1156
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

Re: Config files, FOCS, Python & Co

#19 Post by adrian_broher »

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.
Read the code, compare with your suggestion. Sorry, I won't invest more time to reply in depth to this.
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz

Post Reply