PDA

View Full Version : C4 Scenario Info Viewer


Pecunia
04-30-2007, 02:37 PM
Not quite a scenario but I thought this would fit in here. Attached to this post is a small program which will extract information from scenario files. Among others it will show trade partners, requests and scenario goals.

The other file, c4sceninfo-1.1-src.zip, contains the C source code which is more or less a specification of the .scn file format.

UPDATE (2007-05-05)
Version 1.1 released. Improvements include:


Support for building goals
Support for world site goals
Fixes for custom scenarios: custom scenarios should load correctly now (which includes all scenarios from Caesar4.de)
Favor reward and penalties for orders and requests are displayed if they are non-zero.
Map size has been added to the output

ahk-horus
05-01-2007, 08:55 AM
Hi pecunia!

Thanks a lot for this excellent programs. Source code is already clear, works on every scn file, tested on our userscenarios!

Good work!! :D

ahk-horus

Hieronymus
05-01-2007, 02:45 PM
Thanks Pecunia - this is a very useful program, even if it does take some of the mystery out of Lugdunum Revisited ;)

Ran it on the scenario that I'm working on at the moment and straight away it picked up a bug I might not have spotted otherwise :D

Keith
05-01-2007, 07:34 PM
It's a cheat tool. :D

It's like reading the end to a "who done it" detective novel and finding out the ending without reading the entire story first.

It changes the way you play, if you know what is coming.

Pecunia
05-02-2007, 12:06 AM
It's a cheat tool. :D
I knew you were going to say that ;)

My primary aim was to show ahk-horus the .scn file format to improve his C4 Lister program. In addition, it comes in handy for scenario designers when they create the XML file: Goonsquad found out a while ago that empire level cities seem to change their order in the .scn file if you edit one of them.

I know it can be used as a cheat tool for users, yes, but it reveals no more than can be seen if you open the scenario in the editor, or (to lesser extent) by looking at the the XML file associated with the scenario.

As an aside, the "edit scenario" button doesn't show unlocked scenarios but they can be opened nonetheless: just "edit" any scenario, then from within the editor choose "open": every scenario is listed then.

As to your book reference: actually, I've gotten into the habit of reading such books first "normally" and then backwards, chapter by chapter. In many cases I discover links in the plot that I would not have spotted otherwise.

Hieronymus
05-02-2007, 11:58 AM
I know it can be used as a cheat tool for users, yes, but it reveals no more than can be seen if you open the scenario in the editor, or (to lesser extent) by looking at the the XML file associated with the scenario.

...or indeed by reading the excellent walkthroughs at Caesar 4 Heaven ;)

ahk-horus
05-02-2007, 12:32 PM
@pecunia

A little amendment:

- from user .scn files, based directly on an original scenario - map .dds changed, some cities deleted or added, ressources or tradegoods changed and so on) the analyzer gaves everything back.

- from user .scn files, completly new created, the analyzer breaks after he listed the cities with this statement :

Error: String expected (4645)

(Example : Baraketumus, download here (http://www.tiltedmill.com/forums/showthread.php?t=12667) )

or this

Number of orders and requests: 8388608
0: Error: String expected (7286)

(Example : Adosiaus, download here (http://www.tiltedmill.com/forums/showthread.php?t=12628) )


No difference between US/EU versions (of course?)


ahk-horus

Pecunia
05-02-2007, 01:16 PM
from user .scn files, completly new created, the analyzer breaks
I was afraid of that :( I will take a look at those scenarios this weekend and see if I can fix up my program.

ahk-horus
05-03-2007, 11:09 AM
@pecunia

Sorry, next amendment :

Orders/Requests inform about >Favor loss< or >Favor gain<, but never both values, even if both values > 0. :(

ahk-horus

Pecunia
05-03-2007, 04:28 PM
Sorry, next amendment :

Orders/Requests inform about >Favor loss< or >Favor gain<, but never both values, even if both values > 0. :(
Ah right, my mistake: I assumed that one of them would always be zero ("gain" in case of orders, "loss" in case of requests), while that's clearly not the case; thanks for telling me.

Expect an updated version this weekend. I have downloaded both "scenario packs" from your site, and all of the scenarios in there work now, but I still need to test some other changes I had made. Do continue reporting any errors/improvements :)

My ultimate goal is to also be able to parse .c4s files: they have basically the same format as the .scn files. It doesn't work as expected yet: right now I get segmentation faults on .c4s files ;)

ahk-horus
05-04-2007, 01:00 AM
Ok, that's fine, we are waiting for the "patch".

By the way: we use currently only the analyzer.exe, included in our Delphicode. The C4 Lister Downloads (US/EU) cross the 400 downloads line yesterday. Seems to be a usefull tool.:)

Hey, TM: It won't hurt to commend the work of pecunia, goonsquard, keith, hieronymus, all the luminarys and all the other fans of the game! :(


ahk-horus

Pecunia
05-04-2007, 01:58 PM
@ahk-horus: I noticed that your installation program for the scenarios somehow knows where the game is installed. Where do you get that information, from the windows registry? If so, which registry key? I'm asking because it would come in useful for the next release of my c4minimapper (http://www.tiltedmill.com/forums/showthread.php?t=11268) program :)

Hieronymus
05-04-2007, 04:59 PM
Not sure if this is a bug or a "feature"... ;)

I noticed that if a scenario requires a city to be active as a victory condition, the goal is stated as "Goal category not implemented (5)".

ahk-horus
05-04-2007, 11:32 PM
@pecunia

'HKEY_LOCAL_MACHINE'
\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninsta ll\{B7666229-351B-47D9-AA6F-DF777CF04BBF}\InstallLocation

This key is used in US and EU versions, different from CotN.

@hieronymus
No bug, the complete editor of C4 is based on the CotnN editor, a bit modified. Enable/disable a town - (the enemy city for example) is an CotN-feature but "not implemented (5)" in C4...... :(

ahk-horus

Pecunia
05-05-2007, 02:03 AM
@pecunia

'HKEY_LOCAL_MACHINE'
\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninsta ll\{B7666229-351B-47D9-AA6F-DF777CF04BBF}\InstallLocation
Thanks :)

Enable/disable a town - (the enemy city for example) is an CotN-feature but "not implemented (5)" in C4
Actually, it does work in the game, it's just that I hadn't implemented it in my program yet. The version of the program I'm going to release today will include support for world site and building goals, among others.

Pecunia
05-05-2007, 03:30 AM
New files attached to the topic post. Improvements:
* Support for building goals
* Support for world site goals
* Fixes for custom scenarios: custom scenarios should load correctly now (which includes all scenarios from Caesar4.de)
* Favor reward and penalties for orders and requests are displayed if they are non-zero.
* Map size has been added to the output

ahk-horus
05-05-2007, 12:19 PM
@pecunia
Okay, it's fine, works proper. We'll use the analyzer.exe, redirect the result to Delphi, translate and do some "optical work". Furthermore we evaluate the XML (as in CSXML) and include the invasions and requests. And translate back. Puh.

In the end all relevant informations of an scenario will be shown in C4 Lister. Except some special elements of some CS files......... :D

To your c4MiniMapper : to read the dds files we use this : DEVIL DLL (Developers Image Libary) (http://openil.sourceforge.net/tuts/tut_1/index.htm)

ahk-horus

Personal statement : I hope my english is good enough so the main informations reach the audience. :rolleyes: :rolleyes: :rolleyes:

Pecunia
05-05-2007, 12:47 PM
We'll use the analyzer.exe, redirect the result to Delphi, translate and do some "optical work". Furthermore we evaluate the XML (as in CSXML) and include the invasions and requests. And translate back.
Would it be better if my analyzer.exe printed XML instead of the current (human-readable) text output? I suppose it would be somewhat easier to parse for you.

To your c4MiniMapper : to read the dds files we use this : DEVIL DLL (Developers Image Libary) (http://openil.sourceforge.net/tuts/tut_1/index.htm)
Thanks for the link, I'll look into it :) I had started to write my own DDS reader but that's a lot of work since there are so many different compression formats in DDS... (DXT1, DXT3, DXT5, ...)

Hieronymus
05-05-2007, 04:16 PM
Thanks Pecunia! Just tried it out and it works great with the "non-implemented" goals ;) Will be very useful for me in helping to check for errors when designing scenarios - the sorts of niggling errors I tend to make seem (to me anyway) easy to overlook when using the editor, but easy to spot when using your info viewer.

ahk-horus
05-06-2007, 03:28 AM
Would it be better if my analyzer.exe printed XML instead of the current (human-readable) text output? I suppose it would be somewhat easier to parse for you.

That's right, thanks, but we have parse it all now. ;)

ahk-horus

UPS! Little question

To translate the building names to german, italian and french we use the language.xml, starting with line 184

<!--***** C4 Building Names ONE_NAME for signular MANY_NAME for plural ***************-->

This is the easiest way of course. But the analyzer output shows building names like "Patrician home 2", which is not present in the xml. If you use an differnt list.........we need this list!

Pecunia
05-06-2007, 06:39 AM
I've been using mostly the UI_BUILD_* constants from the languagetext.xml file, with some names made up myself.

Attached to this post is a new analyzer.exe just for you to make parsing the output easier. Changes compared to the original analyzer:

(1) Building names (used in the disabled building list and building goals) are now the same as the string IDs in the languagetext.xml file. For example, the output for the disabled building list is now something like this:

Disabled buildings:
ONE_SAND_COLLECTOR_HOUSE
ONE_GOLD_MINER_HOUSE
ONE_FACTORY_WINE
R_SITE_GRAPE
ONE_GRAPE_FARMER_HOUSE

(2) Resource names used in the trade routes, requests, and resource goals use the MANY_(resource) IDs from languagetext.xml

(3) Time values in invasions and orders/requests are now given in weeks instead of "X year(s), Y month(s), Z week(s)". The time in years/months can be calculated from the number of weeks: one year is 48 weeks, one month is 4 weeks.

ahk-horus
05-06-2007, 12:01 PM
Okay, thanks again, that's easier for translation. :)

ahk-horus