Author Topic: Troop Tree Generator 10.05.29 (UPDATED 2010/05/29)  (Read 26498 times)

0 Members and 1 Guest are viewing this topic.

Backe

  • Sergeant at Arms
  • *
    • View Profile
  • Faction: Neutral
Troop Tree Generator 10.05.29 (UPDATED 2010/05/29)
« on: November 16, 2008, 10:23:13 AM »
Now supports Warband!

Introduction

Many mod descriptions lack troop trees, since creating them is a boring and tedious process. Boring and tedious processes are great for automatisation, so I wrote a very simple program which creates very simple troop trees out of a "troops.txt" file.
Of course, the result can't be compared to the artistic work of a human being. But it's better than no troop trees at all and very easy to maintain after updating a mod.

Download

Windows (212KB):
http://www.mbrepository.com/modules/PDdownloads/singlefile.php?cid=3&lid=1087

Usage

Just extract the two files from the download and a "troops.txt" in the same directory and run TroopTreeGenerator.exe.

The behaviour of the program is controlled by a config file called "TroopTreeGenerator.txt". You can open and edit it with any text editor.

Every configuration must be declared in the following form:
Code: [Select]
config name
{
 ...
}

The parameters "input" and "output" expect a relative or absolute path to the input/output files.

"renderer" determines the type of the file which should be created. Possible values are "html", "text" and "bbc". "bbc" creates bulletin board code, which can be directly used to create a post in this forum.

By changing the options "default_color", "ranged_color", "mounted_color" or "ranged_mounted_color" you can change the font color assigned to the troop types. The well known #RRGGBB format is used.

The next parameters "default_text", "ranged_text", "mounted_text" and "ranged_mounted_text" define the text for the different troop types. The following placeholders are available:
$NAME$
$NAME_PLURAL$
$ID$
$LEVEL$
$STRENGTH$
$AGILITY$
$INTELLIGENCE$
$CHARISMA$
$PROF_1H$
$PROF_2H$
$PROF_POLEARMS$
$PROF_ARCHERY$
$PROF_CROSSBOWS$
$PROF_THROWING$
$PROF_FIREARMS$

Examples

Mounted troops are red, ranged troops green and horse archers blue.

Star Wars Mod:
(click to show/hide)

Timeless Kingdoms (1.011):
(click to show/hide)

Native (1.011):
(click to show/hide)

Hundred Years War (0.960):
(click to show/hide)

Hegemony 268 B.C. (0.960):
(click to show/hide)

Known Problems

Because of a change in the structure of "troops.txt", which is not reflected in a change of the version number of this file, only data from versions >= 0.960 is currently usable.

Credits

Credits go to HokieBT (and therefore indirectly to Jordan) and his Troop Editor, which made reengineering "troops.txt" a matter of minutes.
« Last Edit: May 29, 2010, 04:20:28 PM by Backe »

Kolba

  • Guest
Re: Troop Tree Generator 8.11.15
« Reply #1 on: November 16, 2008, 11:29:23 AM »
Very nice program!

Achilla

  • Squire
  • *
  • Knight of Apocalypse
    • View Profile
  • Faction: Vaegir
Re: Troop Tree Generator 8.11.15
« Reply #2 on: November 16, 2008, 01:23:31 PM »
Just when I was looking for a program like that it popped before my very eyes ... coincidence?

Great job and solid thing nevertheless.

D'Sparil

  • Baron
  • *
  • Wordfilter up your bottom
    • View Profile
  • Faction: Swadian
Re: Troop Tree Generator 8.11.15
« Reply #3 on: November 16, 2008, 02:16:27 PM »
Great job man!

HokieBT

  • Grandmaster Knight
  • *
  • may the force be with you
    • View Profile
  • Faction: Neutral
  • M&BWB
Re: Troop Tree Generator 8.11.15
« Reply #4 on: November 16, 2008, 06:56:22 PM »
this sounds great, nice work!   I'm definitely going to try it out for my star wars mod, thanks!

Edit:  you might want to have an admin move this under the unofficial tools forum?

Edit2:  I tried it but it seemed to go into an infinite loop and never created a file?

here's the output
(click to show/hide)

here's a link to my troops.txt file
http://rapidshare.com/files/164683193/troops.txt.html
« Last Edit: November 17, 2008, 04:09:19 PM by HokieBT »
 
PC Gamer - "Uninstall KOTOR. Forget TIE Fighter and Star Wars Battlefront. There is only one Star Wars video game, and it's an unfinished mod for a six-year-old medieval RPG built by an indie studio from Turkey."

Backe

  • Sergeant at Arms
  • *
    • View Profile
  • Faction: Neutral
Re: Troop Tree Generator 8.11.15
« Reply #5 on: November 17, 2008, 06:15:06 PM »
@HokieBT: Thank you very much for the bug report and test data. I will look into it and post a fix as soon as possible.

[edit]trp_knight_1_7 (Major_General_Cass) tries to upgrade to the troop type with the ID 431253885844215163866665134079905033142143528482437284843171417686016, while I am expecting an unsigned 32bit integer ... that could be a problem. ;) After changing the troop id to 0, the program runs as expected.
Are such huge troop IDs some sort of modding hack I have to deal with?[/edit]
« Last Edit: November 17, 2008, 08:05:46 PM by Backe »

HokieBT

  • Grandmaster Knight
  • *
  • may the force be with you
    • View Profile
  • Faction: Neutral
  • M&BWB
Re: Troop Tree Generator 8.11.15
« Reply #6 on: November 17, 2008, 08:51:41 PM »
@HokieBT: Thank you very much for the bug report and test data. I will look into it and post a fix as soon as possible.

[edit]trp_knight_1_7 (Major_General_Cass) tries to upgrade to the troop type with the ID 431253885844215163866665134079905033142143528482437284843171417686016, while I am expecting an unsigned 32bit integer ... that could be a problem. ;) After changing the troop id to 0, the program runs as expected.
Are such huge troop IDs some sort of modding hack I have to deal with?[/edit]

Just sent you a PM, but there was accidentally an extra face code for that troop in my code.  ;)  Once that was removed your program worked great, thanks very much!
 
PC Gamer - "Uninstall KOTOR. Forget TIE Fighter and Star Wars Battlefront. There is only one Star Wars video game, and it's an unfinished mod for a six-year-old medieval RPG built by an indie studio from Turkey."

SonKidd

  • Knight
  • *
    • View Profile
  • Faction: Nord
Re: Troop Tree Generator 8.11.15
« Reply #7 on: November 18, 2008, 11:05:25 AM »
Wow! Very nice =)

I think it should be put in unofficial editing tools too.
SonKidd's Multiplayer Troop Item Generator (v0.9b)
http://forums.taleworlds.com/index.php?topic=197856.0
Shaking Camera Script (Earthquake):
http://mbmodwiki.ollclan.eu/wiki/Shaking_Camera_Script
Script to guarantee all melee weapons:
http://mbmodwiki.ollclan.eu/wiki/Spawn_troops_with_all_melee_weapons

dealman

  • Veteran
  • *
    • View Profile
  • Faction: Neutral
Re: Troop Tree Generator 8.11.15
« Reply #8 on: November 18, 2008, 03:14:14 PM »
Either this doesn't work for 1.010, or I'm doing it wrong.

I made an troops.txt in same directory as the .exe file, I open it up and it closes fast, really fast. I was lucky enough to get a PrintScreen of the error after a few attempts.

If I remember correctly, it said something about troops.txt could not be read. Any further instructions how to use this? :P
Today, I saw a Slave become more Powerful than the Emperor of Rome!

Backe

  • Sergeant at Arms
  • *
    • View Profile
  • Faction: Neutral
Re: Troop Tree Generator 8.11.15
« Reply #9 on: November 18, 2008, 08:09:12 PM »
Thank you all for the feedback.

@dealman: You can save the whole output to a file by typing "TroopTreeGenerator.exe > error.txt", but this is of course not necessary if you have already identified the ""troops.txt could not be read" message.
I don't know what could cause this problem, if the two files are really in the same folder. Maybe it's an authorisation problem or you somehow specified a different working directory.

HokieBT

  • Grandmaster Knight
  • *
  • may the force be with you
    • View Profile
  • Faction: Neutral
  • M&BWB
Re: Troop Tree Generator 8.11.15
« Reply #10 on: November 19, 2008, 01:56:25 PM »
Backe - the mouse-over effect with the extra information is very cool, could you consider adding a flag to include the level of each troop in the tree itself?  Maybe with a (#) or (lvl #) at the end of their name?

# Caravan Guard (14)
    * Mercenary Swordsman (20)
          o Hired Blade (25)
    * Mercenary Horseman (20)
          o Mercenary Cavalry (25)

EDIT: few other comments, this is a great program and very helpful, just trying to give some feedback.   ;)

- I had to use "-text" not "-txt" to get it to create a trooptree.txt, you might want to update your first post
- I would suggest you request an account on mbrepository.com to upload this and maybe ask an admin to move this thread into unofficial tools forum
- the mouse-over is missing some info like intelligence, charisma, etc.
- you might want to see if you can re-format the output of HTML code a little bit to make it more readable (ie. newline char before <ul>,<li>, <div>, etc)
- long term it would be nice to have a TroopTreeGenerator.ini configuration file, where you could specify what the HTML color code for each category was, maybe a font size/type, maybe be able to define a string with some variables so you could list extra information (ie. Hired Blade (Level: 25, Str: 7, 1H: 117), etc.  This is by no means essential, but if you are looking for ways to improve it then its always nice to have some flexibility, etc.

« Last Edit: November 19, 2008, 03:24:35 PM by HokieBT »
 
PC Gamer - "Uninstall KOTOR. Forget TIE Fighter and Star Wars Battlefront. There is only one Star Wars video game, and it's an unfinished mod for a six-year-old medieval RPG built by an indie studio from Turkey."

Backe

  • Sergeant at Arms
  • *
    • View Profile
  • Faction: Neutral
Re: Troop Tree Generator 8.11.15
« Reply #11 on: November 19, 2008, 09:26:55 PM »
Great suggestions, don't hesitate to post more! (The current version of the Troop Tree Generator is nothing more than a proof of concept hacked together on a Saturday morning and I'm happy about any directions to where the development should go, especially from modders)

- I had to use "-text" not "-txt" to get it to create a trooptree.txt, you might want to update your first post
*cough* done

Quote
- long term it would be nice to have a TroopTreeGenerator.ini configuration file, where you could specify what the HTML color code for each category was, maybe a font size/type, maybe be able to define a string with some variables so you could list extra information
My initial plan was to reference a CSS file in the HTML, which could be used to customize the look of the output. Your idea is much better, because it works for all output formats and gives more control over the data. A placeholder string to define the displayed data will definately be in.

Quote
I would suggest you request an account on mbrepository.com to upload this and maybe ask an admin to move this thread into unofficial tools forum
I will fill the according forms this weekend. ;)

Quote
- the mouse-over is missing some info like intelligence, charisma, etc.
This is actually intended, since I thought intelligence and charisma would only be relevant to the player and companions. Am I wrong?

Quote
- you might want to see if you can re-format the output of HTML code a little bit to make it more readable (ie. newline char before <ul>,<li>, <div>, etc)
Yes, a few newlines wouldn't hurt. I'm not sure if I will spend much time on this with all the auto-identing HTML editors out there. No need to reinvent the wheel.

HokieBT

  • Grandmaster Knight
  • *
  • may the force be with you
    • View Profile
  • Faction: Neutral
  • M&BWB
Re: Troop Tree Generator 8.11.15
« Reply #12 on: December 02, 2008, 07:17:10 PM »

I used this again for a different mod so wanted to post some comments.

- as mentioned earlier, a configuration file, or being able to add the troop level on the output, would be cool
- you are correct that charisma/intelligence isn't really necessary for troops, so i guess it does make sense to leave out or make it configurable.  ;)
- the BBC output for the forum is all on one line which was a little bit of a pain since I only wanted the faction troop tree's

Regardless, this is a great and program and is very useful since it even helped me find some upgrade bugs in my code.  ;)  Definitely deserves a spot in the unofficial tools and on mbrepository, etc.
 
PC Gamer - "Uninstall KOTOR. Forget TIE Fighter and Star Wars Battlefront. There is only one Star Wars video game, and it's an unfinished mod for a six-year-old medieval RPG built by an indie studio from Turkey."

Backe

  • Sergeant at Arms
  • *
    • View Profile
  • Faction: Neutral
Re: Troop Tree Generator 8.11.15
« Reply #13 on: December 02, 2008, 10:57:48 PM »
@HokieBT:
There will be an improved version with your suggestions.
Allowing the user to define troop classes (archer, mounted, ...) in the configuration file is probably also useful. ("Unmounted troops with guaranteed helmet, armor and boots are "heavy infantry" => display melee skills only and use green as the font color")
The next step could be analysing the item file, so you can for example distinguish between crossbow and bow units.

The configuration could look something like this:
Code: [Select]
config default
{
input = troops.txt
output = trooptree.html
default_color = #000000
default_text = $NAME$ (Level $LEVEL$)

class ranged(GUAR_RANGED, !GUAR_MOUNTED)
{
color = #00FF00
text = $NAME$ (Level $LEVEL$; $PROF_XBOW$)
}
}

config test
{
...

(The problem is that I'm currently on vacation and - ironically - the more time I have, the lower my motivation is.)

HokieBT

  • Grandmaster Knight
  • *
  • may the force be with you
    • View Profile
  • Faction: Neutral
  • M&BWB
Re: Troop Tree Generator 8.11.15
« Reply #14 on: December 03, 2008, 02:49:54 AM »
Well, I understand the sample configuration file you posted, and I love flexibility in programs, so that would be very cool.  However, I'm not sure how long that would take to code and I personally think it might be overkill since I doubt most people would use all the functionality.  I think your program will primary be used by mod creators to make a simple troop tree they can post in the forum. So this will primarily be the BBC output and they might like a very simple configuration file to change a few things like the color and default_text.

Code: [Select]
input = troops.txt
output = trooptree.html
default_color = #000000
ranged_color = #000000
mounted_color = #000000
ranged_mounted_color = #000000
default_text = $NAME$ (Level $LEVEL$)

Then, if you can add some new line characters to the BBC output, that would allow people to very easily cut-n-paste all or part of the troop tree to include in their mod description on the forum.  Anyway, not trying to be negative at all, and the program works great as it is so no rush, but I think a few new variables would be very neat.
« Last Edit: December 03, 2008, 02:32:50 PM by HokieBT »
 
PC Gamer - "Uninstall KOTOR. Forget TIE Fighter and Star Wars Battlefront. There is only one Star Wars video game, and it's an unfinished mod for a six-year-old medieval RPG built by an indie studio from Turkey."