Help needed - statseditor

For code related discussions and questions
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3777
Joined: 03 Aug 2006, 19:39

Help needed - statseditor

Post by Per » 12 Sep 2012, 18:09

Hello all who can code,

Things are busy for me at the moment, but I am trying to squeeze in some time to make stats a bit more flexible and make more things editable by mods. I have started yet another stats editor, this time in Qt, and it is holed up in tools/statsedit. It is very bare-bones at the moment (just displaying .ini file stats), and I would love for someone to take up this project and take it further. It is a very easy place to start for a new coder wanting to get into Warzone coding.

Let me know if you want to get started, or just start creating patches :D

Reg312
Regular
Regular
Posts: 681
Joined: 25 Mar 2011, 18:36

Re: Help needed - statseditor

Post by Reg312 » 12 Sep 2012, 18:20

Hello, i like stat editors, but i dont like C++ stuff so much
searching nice free controls and other stuff is a bit boring for me

and i dont like when stat files stored in different format
May be i missed something and now all stats stored in ini?

better if plans about stat-files and other stuff will be published in open forum

Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3777
Joined: 03 Aug 2006, 19:39

Re: Help needed - statseditor

Post by Per » 12 Sep 2012, 18:53

It has been discussed in public. See
viewtopic.php?f=32&t=9295
and (much older) viewtopic.php?f=6&t=214

Reg312
Regular
Regular
Posts: 681
Joined: 25 Mar 2011, 18:36

Re: Help needed - statseditor

Post by Reg312 » 12 Sep 2012, 19:15

Per wrote:It has been discussed in public. See
viewtopic.php?f=32&t=9295
and (much older) viewtopic.php?f=6&t=214
reviewed these threads..
seem i had bad english to get answers on my questions:
1) is it right statement "all stats will be turned into ini-format"?
2) IF 1 above is true, when stats will be turned to ini?
3) what rules for ini format will be followed in stat files
- mostly interesting how unfilled fields will be processed in stats loader in warzone

i'm just thinking warzone stats loader/parser also should be improved

Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3777
Joined: 03 Aug 2006, 19:39

Re: Help needed - statseditor

Post by Per » 12 Sep 2012, 19:43

Yes, I am working on turning all csv type stats into ini format. You should know better than to ask 'when' this is finished... Unfilled fields that are not required will be given default values.

User avatar
Emdek
Regular
Regular
Posts: 1329
Joined: 24 Jan 2010, 13:14
Location: Poland
Contact:

Re: Help needed - statseditor

Post by Emdek » 12 Sep 2012, 21:05

I could help with that if I would have more free time...
For sure I can at least help with Qt related questions, if someone will be able to find me on IRC. ;-)
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.


Beware! Mad Qt Evangelist.

User avatar
Shadow Wolf TJC
Regular
Regular
Posts: 1047
Joined: 16 Apr 2011, 05:12
Location: Raleigh, NC

Re: Help needed - statseditor

Post by Shadow Wolf TJC » 13 Sep 2012, 13:54

Personally, whenever I want to edit some stats (including .pie models) or scripts (like I did while developing the Contingency mod), I just use Wordpad. It seemed to display everything nice and clear, though care must be taken to preserve the files' structure while editing.
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100

User avatar
Iluvalar
Regular
Regular
Posts: 1819
Joined: 02 Oct 2010, 18:44

Re: Help needed - statseditor

Post by Iluvalar » 14 Sep 2012, 05:25

If we code a stat editor, why would we care about the .ini format anyway ? It's just multiplying the size of the files and therfore forbid the hosting of mods.

We need a file format that is the smallest possible.
Heretic 2.3 improver and proud of it.

Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3777
Joined: 03 Aug 2006, 19:39

Re: Help needed - statseditor

Post by Per » 14 Sep 2012, 07:32

Iluvalar wrote:If we code a stat editor, why would we care about the .ini format anyway ?
I do not see the connection between having a stats editor and caring about the format. In case you missed the reasons for changing, go read the discussion threads on the issue.
Iluvalar wrote: It's just multiplying the size of the files and therfore forbid the hosting of mods.

We need a file format that is the smallest possible.
Dude, it is zipped. Duplicate data like ini keys are easily compressed. And even if it weren't, these files are still tiny compared to, say, tilesets and maps :roll:

User avatar
Duha
Trained
Trained
Posts: 287
Joined: 25 Mar 2012, 20:05
Location: SPb, Russia

Re: Help needed - statseditor

Post by Duha » 14 Sep 2012, 12:36

Per wrote:Hello all who can code,

Things are busy for me at the moment, but I am trying to squeeze in some time to make stats a bit more flexible and make more things editable by mods. I have started yet another stats editor, this time in Qt, and it is holed up in tools/statsedit. It is very bare-bones at the moment (just displaying .ini file stats), and I would love for someone to take up this project and take it further. It is a very easy place to start for a new coder wanting to get into Warzone coding.

Let me know if you want to get started, or just start creating patches :D
Once apon a time I have started develop my editor. (wz 2.9)

It was local server (python-django).

It loads files to database (sqlite)
Allow edit it in you browser
And dump back it to game format.

I will check it how it lives and send you demo if you wish.


PS. WTF?

Code: Select all

                model.setData(model.index(i, 1, QModelIndex()), ini.value("buildPower").toString(), Qt::DisplayRole);
		model.setData(model.index(i, 2, QModelIndex()), ini.value("buildPoints").toString(), Qt::DisplayRole);
		model.setData(model.index(i, 3, QModelIndex()), ini.value("weight").toString(), Qt::DisplayRole);
		model.setData(model.index(i, 4, QModelIndex()), ini.value("hitpoints").toString(), Qt::DisplayRole);
		model.setData(model.index(i, 5, QModelIndex()), ini.value("model").toString(), Qt::DisplayRole);
		model.setData(model.index(i, 6, QModelIndex()), ini.value("type").toString(), Qt::DisplayRole);
		model.setData(model.index(i, 7, QModelIndex()), ini.value("speed").toString(), Qt::DisplayRole);
		model.setData(model.index(i, 8, QModelIndex()), ini.value("designable", false).toString(), Qt::DisplayRole);
		model.setData(model.index(i, 9, QModelIndex()), ini.value("skidDeceleration", 600).toString(), Qt::DisplayRole);
		model.setData(model.index(i, 10, QModelIndex()), ini.value("spinSpeed", 8192/45*3/4).toString(), Qt::DisplayRole);
		model.setData(model.index(i, 11, QModelIndex()), ini.value("turnSpeed", 8192/45/3).toString(), Qt::DisplayRole);
		model.setData(model.index(i, 12, QModelIndex()), ini.value("Acceleration", 250).toString(), Qt::DisplayRole);
		model.setData(model.index(i, 13, QModelIndex()), ini.value("Deceleration", 800).toString(), Qt::DisplayRole);
		model.setData(model.index(i, 14, QModelIndex()), ini.value("spinAngle", 180).toString(), Qt::DisplayRole);
Do you here about DRY (Dont repeat youself)?

Why you call almost same function so many times?

IMHO
creating "structure" fields = [(name, default), (name, default), ]
And using cycle over it will add more readability. (+2 lines of code, - 80 chars from 15 lines)

IMHO2 If you create ini scheme to game (just file what describes which fields are used, has it default value or reqired, what max, min or choose values it has) You will generate this views by it. And can use it in game code to load data.

Same for stats.cpp:
most stats function do same thing:
get ini file, make some checks, return filled structure.
My view on it: it must be function that get 2 args:
file with template (field_name, default, required, max, min, [choices])
file with data

At current time you make double work.
You describe in game code each field you use and its default value.
You describe in editor code each field you use and its default value.

You editor does not check if body size is in body_list. But stats check it.
http://addons.wz2100.net/ developer

Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3777
Joined: 03 Aug 2006, 19:39

Re: Help needed - statseditor

Post by Per » 14 Sep 2012, 16:48

Yep. It was a quick hack. I look forward to your cleanup work! :)

User avatar
Iluvalar
Regular
Regular
Posts: 1819
Joined: 02 Oct 2010, 18:44

Re: Help needed - statseditor

Post by Iluvalar » 14 Sep 2012, 17:49

Per wrote:
Iluvalar wrote:If we code a stat editor, why would we care about the .ini format anyway ?
I do not see the connection between having a stats editor and caring about the format. In case you missed the reasons for changing, go read the discussion threads on the issue.
Iluvalar wrote: It's just multiplying the size of the files and therfore forbid the hosting of mods.

We need a file format that is the smallest possible.
Dude, it is zipped. Duplicate data like ini keys are easily compressed. And even if it weren't, these files are still tiny compared to, say, tilesets and maps :roll:
Maps are smaller 100ko vs 250ko for the mod (NRS). And dont be silly, there is no map-mods with tileset files. It is too big to be hosted !
Heretic 2.3 improver and proud of it.

Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3777
Joined: 03 Aug 2006, 19:39

Re: Help needed - statseditor

Post by Per » 14 Sep 2012, 18:27

Iluvalar wrote:Maps are smaller 100ko vs 250ko for the mod (NRS). And dont be silly, there is no map-mods with tileset files. It is too big to be hosted !
weapons data in CSV zipped 6k, weapons data in INI format zipped 7.3k. There are maps with their own tilesets. Even if data were to be increased by a much bigger factor, nobody could care less anyway since we've stopped using 9600 baud modems a long time ago. So stop wasting thread space on this off topic non-issue already.

User avatar
Duha
Trained
Trained
Posts: 287
Joined: 25 Mar 2012, 20:05
Location: SPb, Russia

Re: Help needed - statseditor

Post by Duha » 14 Sep 2012, 18:30

Per wrote:Yep. It was a quick hack. I look forward to your cleanup work! :)
Nope. I don`t like c++ (and don`t know it).

It is too strong tool for making editors :)

I can do it in my way. :)

You can test it (observation and editing (save and other stuff is ruined))
https://bitbucket.org/Cjkjvfnby/wze
It works with current master branch of Warzone2100 on github

just follow instruction in readme. and when open /load/

Models you can inspect:
Feature,
Construction,
ECM,
Sensor,
Repair,
Weapon,
StructureDefence,
Body,
PropulsionType,
Function,
BodyDefence,
Research_Cam1,
Research_Cam2,
Research_Cam3,

Scrinshoots:
http://imageshack.us/g/703/selection009b.png
http://imageshack.us/f/89/selection010f.png
http://addons.wz2100.net/ developer

User avatar
Duha
Trained
Trained
Posts: 287
Joined: 25 Mar 2012, 20:05
Location: SPb, Russia

Re: Help needed - statseditor

Post by Duha » 10 Oct 2012, 01:37

Per wrote:Hello all who can code,

Things are busy for me at the moment, but I am trying to squeeze in some time to make stats a bit more flexible and make more things editable by mods. I have started yet another stats editor, this time in Qt, and it is holed up in tools/statsedit. It is very bare-bones at the moment (just displaying .ini file stats), and I would love for someone to take up this project and take it further. It is a very easy place to start for a new coder wanting to get into Warzone coding.

Let me know if you want to get started, or just start creating patches :D

just for fun:
Desctop app that shows body.ini written on html+css+javascript
It needs node-webkit to launch (https://github.com/rogerwang/node-webkit)
http://narod.ru/disk/62265724001.53fa63 ... er.nw.html
http://addons.wz2100.net/ developer

Post Reply