A unified csv2ini converter
A unified csv2ini converter
Trying to make one.
The conversion of the base game stats from txt (aka csv) to ini is almost finished. Afaik, it was accomplished by several people independently, each using their own automated conversion scripts for every file. What i'm trying to get is a single script to do all the conversion. I'm aiming at converting large stat mods such as Contingency, Ultimate Scavenger AI, or WZMini (the latter will probably require producing diffs as well, which will not be done by this script).
It's written in python3 and currently is capable of producing four ini files: body.ini, bodypropulsionimd.ini, construction.ini, weapons.ini.
If anybody has any useful snippets of code they used for converting, no matter how dirty, no matter in what language, please post it here. If anybody likes to join the github project, i'll provide commit access and/or accept pull requests (:
The conversion of the base game stats from txt (aka csv) to ini is almost finished. Afaik, it was accomplished by several people independently, each using their own automated conversion scripts for every file. What i'm trying to get is a single script to do all the conversion. I'm aiming at converting large stat mods such as Contingency, Ultimate Scavenger AI, or WZMini (the latter will probably require producing diffs as well, which will not be done by this script).
It's written in python3 and currently is capable of producing four ini files: body.ini, bodypropulsionimd.ini, construction.ini, weapons.ini.
If anybody has any useful snippets of code they used for converting, no matter how dirty, no matter in what language, please post it here. If anybody likes to join the github project, i'll provide commit access and/or accept pull requests (:
Last edited by NoQ on 18 May 2013, 04:50, edited 2 times in total.
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam
Re: A unified csv2ini converter
Here is the code I used to convert features.txt... Don't laugh, it got the job done
- Attachments
-
- test.c
- Do not use for teaching purposes
- (1.61 KiB) Downloaded 325 times
Re: A unified csv2ini converter
@Per: Elegant code in many ways, but some of the form is pretty sloppy. I cleaned it up a bit. Please read the comments. It now conforms to the C89 standard. I hope this is helpful.
P.S. I am one of the uninventive people who can write in C. I am dull in coming up with innovative or clever solutions, but good with the language itself.
P.S. I am one of the uninventive people who can write in C. I am dull in coming up with innovative or clever solutions, but good with the language itself.
- Attachments
-
- test.c
- Updated to show Per a few nice tips in coding.
- (2.38 KiB) Downloaded 300 times
Also known as Subsentient.
Re: A unified csv2ini converter
Thanks, features.ini now supported (:
These snippets help me understand what needs to be done. This time it was pretty straightforward, but in other cases some files get merged and sometimes new fields appear and old fields disappear, so i always need to be sure i didn't forget to work around these things.
These snippets help me understand what needs to be done. This time it was pretty straightforward, but in other cases some files get merged and sometimes new fields appear and old fields disappear, so i always need to be sure i didn't forget to work around these things.
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam
Re: A unified csv2ini converter
I just can't get it... Now the stat based mods look 25% bigger to transfer and you worked on program that read .CVS format anyway...
Heretic 2.3 improver and proud of it.
Re: A unified csv2ini converter
I don't see how it is related to the topic.Now the stat based mods look 25% bigger to transfer
I don't see why you would expect that such program will not be needed during the 3.1->3.2 transition period.you worked on program that read .CVS format anyway...
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam
Re: A unified csv2ini converter
I'll try to rephrase my idea again.
Now that you worked on an homemade CVS reader, there was no point in the conversion at all. We could have stayed with the CVS format and use the reader when necessary. And keep the files smaller to transfer.
Now that you worked on an homemade CVS reader, there was no point in the conversion at all. We could have stayed with the CVS format and use the reader when necessary. And keep the files smaller to transfer.
Heretic 2.3 improver and proud of it.
Re: A unified csv2ini converter
Please take the time to read the relevant discussions before voicing strong opinions.Iluvalar wrote:I'll try to rephrase my idea again.
Now that you worked on an homemade CVS reader, there was no point in the conversion at all. We could have stayed with the CVSCSV format and use the reader when necessary. And keep the files smaller to transfer.
You are, again, completely missing all the points.
As for file size, I mean, really. A standard map is bigger than any stats file, uncompressed, and the stats files compress like silly. And nothing is smaller than an ini diff -- if you are worried about a few kb on game startup, give some thanks to NoQ for that patch.
Re: A unified csv2ini converter
I start to make some. Now it is just collection of scripts.NoQ wrote:Trying to make one.
Later I will combine them together to convert mod in one click.
https://github.com/Cjkjvfnby/wz_convertor (python 2.7)
I think we should join.It's written in python3 and currently is capable of producing four ini files: body.ini, bodypropulsionimd.ini, construction.ini, weapons.ini.
http://addons.wz2100.net/ developer
Re: A unified csv2ini converter
I only hosted thousands of self modded games last year. Maybe I was not relevant enough to be part of those discussions. Right... So many other people did the same. I guess it's hard to hear all the voices...Per wrote: Please take the time to read the relevant discussions before voicing strong opinions.
You are, again, completely missing all the points.
As for file size, I mean, really. A standard map is bigger than any stats file, uncompressed, and the stats files compress like silly. And nothing is smaller than an ini diff -- if you are worried about a few kb on game startup, give some thanks to NoQ for that patch.
What is the link with ini diff ?
Heretic 2.3 improver and proud of it.
Re: A unified csv2ini converter
Your reply again does not reflect the topic you are replying to you claim knowledge about the conversion of csv to ini yet all you have input to this thread is "it will make the mod downloads bigger" .Iluvalar wrote: Per wrote:Please take the time to read the relevant discussions before voicing strong opinions.
You are, again, completely missing all the points.
As for file size, I mean, really. A standard map is bigger than any stats file, uncompressed, and the stats files compress like silly. And nothing is smaller than an ini diff -- if you are worried about a few kb on game startup, give some thanks to NoQ for that patch.
I only hosted thousands of self modded games last year. Maybe I was not relevant enough to be part of those discussions. Right... So many other people did the same. I guess it's hard to hear all the voices...
What is the link with ini diff ?
Please stop your campaign to hold warzone advancement back.
Your claim to have hosted thousands of game is total crap going by the stats i have made up out of thin air like you often do your game have total 0.005 of total games played on the net.
Your not helping!
Re: A unified csv2ini converter
We had one many years ago, and it was even built into the game. I still don't see what it changes.Iluvalar wrote:Now that you worked on an homemade CVS reader, there was no point in the conversion at all.
This one, i guess.Iluvalar wrote:What is the link with ini diff ?
Well, one could quite well imagine a "csv diff" of "line,column,value" as inPer wrote:And nothing is smaller than an ini diff
Code: Select all
Ruin1,6,20
Ruin2,7,CHERRY.PIE
Yay. Maybe. You're having nice upgrades conversion!Duha wrote:I start to make some. Now it is just collection of scripts.
Later I will combine them together to convert mod in one click.
https://github.com/Cjkjvfnby/wz_convertor (python 2.7)
...
I think we should join.
What's the plan then? Command me.
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam
Re: A unified csv2ini converter
STOP USING TAB USE 4 SPACESNoQ wrote:What's the plan then? Command me.
Re: A unified csv2ini converter
I need a couple of days to add support for mod convert, think about structure add more scripts.NoQ wrote: Yay. Maybe. You're having nice upgrades conversion!
What's the plan then? Command me.
http://addons.wz2100.net/ developer
Re: A unified csv2ini converter
As for structure, I didn't like the idea of trying to achieve less than one line of code per ini file field, as in some unpredictable places we could really use arbitrary flexibility, such as complicated guessing of new field values depending on multiple other field values from different files.
I don't think we need any zip file support here. Usually the modder will store the mod unpacked for easy tweaking and only pack it for release. So we just need to take the input folder and fill it with ini files.
The thing that bothers me is that some mods will have only a few files inside; they do not need to include dependencies we need. Eg. we need to look at names.txt to convert weapons.txt, but the mod that changes weapons.txt will not necessarily include a copy of names.txt; so we also need a way of specifying a base data directory, with lower priority.
p.s. diffs are not helpful in reducing file size, as they are mostly useful for small tweaks, while file size becomes a problem mostly for large total conversion mods.
I don't think we need any zip file support here. Usually the modder will store the mod unpacked for easy tweaking and only pack it for release. So we just need to take the input folder and fill it with ini files.
The thing that bothers me is that some mods will have only a few files inside; they do not need to include dependencies we need. Eg. we need to look at names.txt to convert weapons.txt, but the mod that changes weapons.txt will not necessarily include a copy of names.txt; so we also need a way of specifying a base data directory, with lower priority.
p.s. diffs are not helpful in reducing file size, as they are mostly useful for small tweaks, while file size becomes a problem mostly for large total conversion mods.
Last edited by NoQ on 05 Oct 2013, 12:37, edited 1 time in total.
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam