XML or INI
- milo christiansen
- Regular
- Posts: 749
- Joined: 02 Jun 2009, 21:23
- Location: Perrinton Michigan
XML or INI
If I were to write programs to convert the current data files to xml or ini format would anyone be interested?
Also, how hard would it be to make the game read a xml or ini file instead of comma delimited like it does now?
And which would be better for modders xml or ini?
Also, how hard would it be to make the game read a xml or ini file instead of comma delimited like it does now?
And which would be better for modders xml or ini?
In general, if you see glowing, pulsating things in the game, you should click on them.
- Demigod Game Ganual
- Demigod Game Ganual
Re: XML or INI
It depends on the data which is more readable. Well, except that most XML is not really human readable. I think much of the data we have in CSV format is best suited in that format, and would be very verbose in any other.
Re: XML or INI
Yeah, the only things we really need to do in that respect is rename the files to .csv (so they'll be opened automatically by spreadsheet programs), and add descriptive headers to the ones we haven't yet. Some of them might be more suited for INI, but CSV is only slightly less readable, easier to parse, and there's no real reason to change.
XML, on the other hand, is way overkill for anything we do in Warzone.
XML, on the other hand, is way overkill for anything we do in Warzone.
- milo christiansen
- Regular
- Posts: 749
- Joined: 02 Jun 2009, 21:23
- Location: Perrinton Michigan
Re: XML or INI
I agree with thatZarel wrote:easier to parse
![Wink :wink:](./images/smilies/icon_wink.gif)
After much consideration, I think that ini or renaming the files to csv would be the way to go.
It might not be that hard to set it to look for .csv files and if missing look for ini files. That way modders could use ether depending on preference and/or skill.
About descriptive headers, is there a way for me to help with that? I already did some research on the various fields for my stats editor and now that I've found the loading routines the rest should be easy to figure out.
And where are the stat files loaded? I know the routines are in stats.c, but where are they used?
In general, if you see glowing, pulsating things in the game, you should click on them.
- Demigod Game Ganual
- Demigod Game Ganual
Re: XML or INI
Short answer: they are used from here when this resource file (for example) is parsed.milo christiansen wrote:And where are the stat files loaded? I know the routines are in stats.c, but where are they used?
Detailed answer: "I'm sorry. My responses are limited. You must ask the right questions." (c)
![Bigger Grin XD](./images/smilies/icon_xd.gif)
- milo christiansen
- Regular
- Posts: 749
- Joined: 02 Jun 2009, 21:23
- Location: Perrinton Michigan
Re: XML or INI
The short answer is fine
, thanks!
![Bigger Grin XD](./images/smilies/icon_xd.gif)
In general, if you see glowing, pulsating things in the game, you should click on them.
- Demigod Game Ganual
- Demigod Game Ganual
Re: XML or INI
I would be inter, I often wish to use XML to make a Flash project, related to WarZone 2100, however I gave up because of the sheer time I would need to make the XMLs (Including all the upgrades for each weapon, and which weapons go with which upgrade). Example:
In the description, the '#NEWLINE#' tells flash to add a new line there.
Damage upgrade is MGDamageUpgrades because there is an XML file called MGDamageUpgrades.xml
ROF upgrade is MGROFUpgrades because there is an XML file called MGROFUpgrades.xml
Accuracy upgrade is -1 because it doesn't exist.
If you could write a program for this, I would be grateful for an eternity![Big Grin :D](./images/smilies/icon_biggrin.gif)
Thanks, Wibble199![Smile :)](./images/smilies/icon_smile.gif)
Code: Select all
<Weapon>
<Name>Machinegun</Name>
<Type>Normal</Type>
<Damage>10</Damage>
<ROF>120</ROF>
<DPS>3</DPS>
<Accuracy_S>75</Accuracy_S>
<Accuracy_L>50</Accuracy_L>
<Range_S>4</Range_S>
<Range_L>6</Range_L>
<HP>75</HP>
<Weight>200</Weight>
<Descript>7.62mm machinegun\nBest Targets: Infantry, base structures, wheeled vehicles\nBody Points: Low</Descript>
<DamageUpgrade>MGDamageUpgrades</DamageUpgrade>
<ROFUpgrade>MGROFUpgrades</ROFUpgrade>
<AccuracyUpgrade>-1</AccuracyUpgrade>
</Weapon>
Damage upgrade is MGDamageUpgrades because there is an XML file called MGDamageUpgrades.xml
ROF upgrade is MGROFUpgrades because there is an XML file called MGROFUpgrades.xml
Accuracy upgrade is -1 because it doesn't exist.
If you could write a program for this, I would be grateful for an eternity
![Big Grin :D](./images/smilies/icon_biggrin.gif)
Thanks, Wibble199
![Smile :)](./images/smilies/icon_smile.gif)
-
- Rookie
- Posts: 17
- Joined: 26 Oct 2010, 17:21
Re: XML or INI
A lua or similar script language is more flexible and readable than both imo.
- milo christiansen
- Regular
- Posts: 749
- Joined: 02 Jun 2009, 21:23
- Location: Perrinton Michigan
Re: XML or INI
Maybe but these are stat lists not scripts. Lua is planed to replace WZScript, this would be a replacement for TXT files.
In any case this won't be done soon.
In any case this won't be done soon.
In general, if you see glowing, pulsating things in the game, you should click on them.
- Demigod Game Ganual
- Demigod Game Ganual
- milo christiansen
- Regular
- Posts: 749
- Joined: 02 Jun 2009, 21:23
- Location: Perrinton Michigan
Re: XML or INI
Challenges use ini don't they? Where can I get the documentation for the lib used?
In general, if you see glowing, pulsating things in the game, you should click on them.
- Demigod Game Ganual
- Demigod Game Ganual
Re: XML or INI
For the current lib:milo christiansen wrote:Challenges use ini don't they? Where can I get the documentation for the lib used?
http://developer.wz2100.net/browser/lib ... ctionary.h
http://developer.wz2100.net/browser/lib ... niparser.h
For the re-written/future interface:
http://developer.wz2100.net/ticket/2012
-
- Greenhorn
- Posts: 15
- Joined: 13 Jun 2011, 11:23
Re: XML or INI
you can use QSettings for ini file or QDocDocument (requires XML module) for xml, since it uses qt
- milo christiansen
- Regular
- Posts: 749
- Joined: 02 Jun 2009, 21:23
- Location: Perrinton Michigan
Re: XML or INI
True... good idea, I sort of put a halt on this until I found time to find/write a good ini parser and now that I have one I need to find time to write a program to convert the existing CSV files.
I'm planing to use a sort of XML/INI hybrid called IML that looks something like this
The values are for special pre-processing and things like returning a list or vector from a read on a DSV key
so far the parser is a little incomplete and most of the value related stuff is unimplemented
but for basic reads of string values everything works.
Only one big problem, the parser was written before I learned how to write "real" parsers so its line based aka it only reads the first two chars on every line to determine the line type
so I will probably end up rewriting it before to long.
Also it heavily relies on QT so it wasn't really possible to use it until lately.
Now I just need to find the time...
I'm planing to use a sort of XML/INI hybrid called IML that looks something like this
Code: Select all
[section]
key:string=string value
; possible values (the part between : and =) are:
; string
; int
; float
; bool
; and DSV
; DSV is a special case. It is structured :DSV|= the char after DSV is the delimiter in this case |
; Delimiter Separated Value
; No value is considered a string
[/section]
so far the parser is a little incomplete and most of the value related stuff is unimplemented
![Sad :(](./images/smilies/icon_sad.gif)
Only one big problem, the parser was written before I learned how to write "real" parsers so its line based aka it only reads the first two chars on every line to determine the line type
![Sad :(](./images/smilies/icon_sad.gif)
Also it heavily relies on QT so it wasn't really possible to use it until lately.
Now I just need to find the time...
In general, if you see glowing, pulsating things in the game, you should click on them.
- Demigod Game Ganual
- Demigod Game Ganual
-
- Greenhorn
- Posts: 15
- Joined: 13 Jun 2011, 11:23
Re: XML or INI
well if i were you i would use QSettings instead and use a class that saves the output and initialises throught it
QSettings support grouping (you can see on the Docs)
ill use an example that i have on my free project
(think BackgroundColor and other variables as a QColor)
and the output will be
and
and the output will be
however
will output
which can take some readability like doing this
will output
note: they can be read like this (for the fist example):
note that is was just an idea...its always wise to have a small code to make it easier to find and fix errors
QSettings support grouping (you can see on the Docs)
ill use an example that i have on my free project
(think BackgroundColor and other variables as a QColor)
Code: Select all
QSettings settings(*initialisation code here*);
settings.beginGroup("Colors");
settings.setValue("Background",BackgroundColor->rgb()); //will outuput QRgb which is a typedef of unsigned int
settings.setValue("Foreground",ForegroundColor->rgb());
settings.setValue("Text",TextColor->rgb());
settings.setValue("Lines",LineColor->rgb());
settings.endGroup();
Code: Select all
[Colors]
Background=4281479730
Foreground=4284769380
Text=4291348680
Lines=4291348680
Code: Select all
QSettings settings(*initialisation code here*);
settings.beginGroup("Colors");
settings.setValue("Background",BackgroundColor->rgb()); //will outuput QRgb which is a typedef of unsigned int
settings.setValue("Foreground",ForegroundColor->rgb());
settings.setValue("Text",TextColor->rgb());
settings.setValue("Lines",LineColor->rgb());
settings.endGroup();
settings.beginGroup("Colors2"); // Same thing for example purposes
settings.setValue("Background",BackgroundColor->rgb()); //will outuput QRgb which is a typedef of unsigned int
settings.setValue("Foreground",ForegroundColor->rgb());
settings.setValue("Text",TextColor->rgb());
settings.setValue("Lines",LineColor->rgb());
settings.endGroup();
Code: Select all
[Colors]
Background=4281479730
Foreground=4284769380
Text=4291348680
Lines=4291348680
[Colors2]
Background=4281479730
Foreground=4284769380
Text=4291348680
Lines=4291348680
Code: Select all
QSettings settings(*initialisation code here*);
settings.beginGroup("Options");
settings.beginGroup("Colors");
settings.setValue("Background",BackgroundColor->rgb());
settings.setValue("Foreground",ForegroundColor->rgb());
settings.setValue("Text",TextColor->rgb());
settings.setValue("Lines",LineColor->rgb());
settings.endGroup();
settings.endGroup();
Code: Select all
[Options]
Colors\Background=4281479730
Colors\Foreground=4284769380
Colors\Text=4291348680
Colors\Lines=4291348680
Code: Select all
QSettings settings(*initialisation code here*);
settings.beginGroup("Options");
settings.beginGroup("Colors");
settings.setValue("Background",BackgroundColor->rgb());
settings.setValue("Foreground",ForegroundColor->rgb());
settings.setValue("Text",TextColor->rgb());
settings.setValue("Lines",LineColor->rgb());
settings.endGroup();
settings.beginGroup("Colors2"); //same thing for example purposes
settings.setValue("Background",BackgroundColor->rgb());
settings.setValue("Foreground",ForegroundColor->rgb());
settings.setValue("Text",TextColor->rgb());
settings.setValue("Lines",LineColor->rgb());
settings.endGroup();
settings.endGroup();
Code: Select all
[Options]
Colors\Background=4281479730
Colors\Foreground=4284769380
Colors\Text=4291348680
Colors\Lines=4291348680
Colors2\Background=4281479730
Colors2\Foreground=4284769380
Colors2\Text=4291348680
Colors2\Lines=4291348680
Code: Select all
QSettings settings(*initialisation code here*);
settings.beginGroup("Options");
settings.beginGroup("Colors");
BackgroundColor->setRgb(settings.value("Background").toUInt());
ForegroundColor->setRgb(settings.value("Foreground").toUInt());
TextColor->setRgb(settings.value("Text").toUInt());
LineColor->setRgb(settings.value("Lines").toUInt());
settings.endGroup();
settings.endGroup();
Re: XML or INI
In master, the challenges are read (and written) using QSettings already.