Author Topic: [Code] Dynamic Kingdom Troop Tree Presentation  (Read 4345 times)

0 Members and 1 Guest are viewing this topic.

NewBie-BR

  • Veteran
  • *
  • Mod game like a game
    • View Profile
  • Faction: Swadian
Re: [Code] Dynamic Kingdom Troop Tree Presentation
« Reply #15 on: January 22, 2012, 07:35:07 PM »
Great. I'm glad you made it.

("faction_troop_tree", "Faction's Troop Tree"),

Change the right string as you want. If you want to use another color,
change the constants :
title_red     = 0xFF0000 ## FF0000 is red

Wait. How can your troop tree has 3 braches from tier 3 to tier 4?

Would you like to send me your upgrading declaration from your module_troops.py please?
You might just found  a bug of this presentation.
oh yes. I understand my trouble now. But my upgrading declaration isn't in my  module_troops.py. I open build file. After i copy and overwrite file troop.txt . So what can i do?

Dawg of War

  • Sergeant Knight at Arms
  • *
  • Silverstag Dev Team
    • View Profile
  • Faction: Nord
  • MP nick: Dawg_of_War
  • M&BWBWF&S
Re: [Code] Dynamic Kingdom Troop Tree Presentation
« Reply #16 on: January 22, 2012, 09:52:01 PM »
Great. I'm glad you made it.

("faction_troop_tree", "Faction's Troop Tree"),

Change the right string as you want. If you want to use another color,
change the constants :
title_red     = 0xFF0000 ## FF0000 is red

Wait. How can your troop tree has 3 braches from tier 3 to tier 4?

Would you like to send me your upgrading declaration from your module_troops.py please?
You might just found  a bug of this presentation.
oh yes. I understand my trouble now. But my upgrading declaration isn't in my  module_troops.py. I open build file. After i copy and overwrite file troop.txt . So what can i do?



If your using the module system why are using morgh's?  I would recommend using the module system to build your troops and troop trees, much easier then having to copy over your troops.txt every time you build.  Plus dunde is asking for these at the very bottom of your troops.py

Example:

upgrade2(troops,"sarranid_footman","sarranid_veteran_footman","sarranid_skirmisher")
upgrade2(troops,"sarranid_veteran_footman","sarranid_horseman","sarranid_infantry")
upgrade(troops,"sarranid_infantry","sarranid_guard")
upgrade(troops,"sarranid_skirmisher","sarranid_archer")

But since your not editing module_troops.py I guess it don't matter.  :|



Windyplains

  • Master Knight
  • *
  • Silverstag Dev Team
    • View Profile
  • Faction: Bandit
  • WB
Re: [Code] Dynamic Kingdom Troop Tree Presentation
« Reply #17 on: January 23, 2012, 12:28:28 AM »
...we must make the troop trees for them one by one and to adjust the diagram positions is a boring and time consuming activity...
There's an understatement.  Excellent work, Dunde.

13exa

  • Knight at Arms
  • *
  • B23A, RoB, and MC Modder
    • View Profile
  • Faction: Nord
Re: [Code] Dynamic Kingdom Troop Tree Presentation
« Reply #18 on: January 23, 2012, 09:56:49 AM »
I get skl_power_strike isn't defined when I compile  :(
(click to show/hide)
(click to show/hide)

Lav

  • Knight
  • *
    • View Profile
  • Faction: Vaegir
  • MP nick: Lav
  • M&BWB
Re: [Code] Dynamic Kingdom Troop Tree Presentation
« Reply #19 on: January 23, 2012, 10:01:49 AM »
I get skl_power_strike isn't defined when I compile  :(
Add

Code: [Select]
from header_skills import *
At the beginning of module_presentations file.

13exa

  • Knight at Arms
  • *
  • B23A, RoB, and MC Modder
    • View Profile
  • Faction: Nord
Re: [Code] Dynamic Kingdom Troop Tree Presentation
« Reply #20 on: January 23, 2012, 10:59:10 AM »
I get skl_power_strike isn't defined when I compile  :(
Add

Code: [Select]
from header_skills import *
At the beginning of module_presentations file.
Awesome, Forget to check that  :shock:
Thank You  :D
(click to show/hide)
(click to show/hide)

NewBie-BR

  • Veteran
  • *
  • Mod game like a game
    • View Profile
  • Faction: Swadian
Re: [Code] Dynamic Kingdom Troop Tree Presentation
« Reply #21 on: January 23, 2012, 06:48:46 PM »
Why don't you add more faction in this code, like: outlaws faction, player faction (maybe this's impossible),... :D

dunde

  • Grandmaster Knight
  • *
  • Curious Coder of The Vision
    • View Profile
  • Faction: Swadian
  • WB
Re: [Code] Dynamic Kingdom Troop Tree Presentation
« Reply #22 on: January 23, 2012, 09:28:32 PM »
Why don't you add more faction in this code, like: outlaws faction, player faction (maybe this's impossible),... :D
You can do it just by copy pasting the script, and set the lowest tier troops of other faction here :
  # lowest troop tiers initialization BEGIN
  (troop_set_slot, "trp_temp_array_a", 0, 1),           # Number of Lowest Tier Troop
  (troop_set_slot, "trp_temp_array_a", 1, 1),           # 1 for 1st troop
  (troop_set_slot, "trp_temp_array_b", 1, ":troop_no"), # 1st troop id
  # lowest troop tiers initialization END

The limitation is that the code doesn't support trees with merging upgrade lines like camp follower that natively is upgraded target from peasant woman and refugee.

NewBie-BR

  • Veteran
  • *
  • Mod game like a game
    • View Profile
  • Faction: Swadian
Re: [Code] Dynamic Kingdom Troop Tree Presentation
« Reply #23 on: January 24, 2012, 03:15:20 PM »
Why don't you add more faction in this code, like: outlaws faction, player faction (maybe this's impossible),... :D
You can do it just by copy pasting the script, and set the lowest tier troops of other faction here :
  # lowest troop tiers initialization BEGIN
  (troop_set_slot, "trp_temp_array_a", 0, 1),           # Number of Lowest Tier Troop
  (troop_set_slot, "trp_temp_array_a", 1, 1),           # 1 for 1st troop
  (troop_set_slot, "trp_temp_array_b", 1, ":troop_no"), # 1st troop id
  # lowest troop tiers initialization END

The limitation is that the code doesn't support trees with merging upgrade lines like camp follower that natively is upgraded target from peasant woman and refugee.
Thank you pro

Caba`drin

  • Administrator
  • *
  • It's time to toss the dice.
    • View Profile
  • Faction: Nord
  • MP nick: Caba_drin
  • M&BWBWF&SNW
Re: [Code] Dynamic Kingdom Troop Tree Presentation
« Reply #24 on: March 07, 2012, 02:37:51 AM »
Thanks again for the great code/system dunde. I was looking for something to tinker with, so I tried thinking through the merging lines problem. This is what I've come up with. (NOTE - This is under the assumption that the 'merge' happens in and from the same tiers--that merged troop is Tier X and the two troops that upgrade into the same troop are both Tier X-1 ; I've not found a good way to loosen this assumption, but I think it holds true in most trees I have seen that have 'merging' lines.)

(click to show/hide)
The code essentially inserts 3 checks that the troop currently being considered hasn't previously been dealt with, and then (for the line drawing bits) makes the necessary accommodations. It ensures the only duplicated entry in the data arrays is the troop where the merge occurs, which works out neatly.

(click to show/hide)
In this example (for illustration purposes) the Swadian footman is changed to upgrade to the M@Arms and the Crossbowman, while the Skirmisher is upgrading to the Crossbowman and the Infantry -- so the lines merge at the crossbowman from the skirmisher and the footman, though each have unique paths, too. Hopefully that's clear. Not sure if changing the line color is the best solution...but without it, the line blends in with the others. Perhaps an off-set would be better?


EDIT
Off-set definitely better than changing the color.

(click to show/hide)
While this looks fine on a simple merge in a tree, as the second shot shows it doesn't work if the tree is a bit more convoluted.

(click to show/hide)
The double offset seems overkill on the simple merge, but I think it adds better clarity in the more complicated example.

The next thing, I suppose, would be to remove the bend on the tree with only 1 branch (as the other is the merge). Looking into that, then will update code.

EDIT 2
And, tree correction finished, allowing for a middle-of-the-road offset that I think looks quite workable

(click to show/hide)
(click to show/hide)
« Last Edit: March 07, 2012, 07:57:58 PM by Caba`drin »



celestialred

  • Knight at Arms
  • *
  • At night we're conspiring by candlelight
    • View Profile
    • My Facebook Profile
  • Faction: Vaegir
  • M&BWBWF&SNW
Re: [Code] Dynamic Kingdom Troop Tree Presentation
« Reply #25 on: April 05, 2012, 07:58:10 PM »
Hey Dunde,

I've run into a touch of snag with this presentation generation.

Due to the way we're constructing reinforcement templates and AI party make up, we have between 6-10 tiers of troops. We also have troops within the same faction that do not ever upgrade into one another.

A simple case in point.

In every faction, infantry only upgrades into other infantry. Cavalry only upgrades into other cavalry. Non-commissioned officers upgrade into Commissioned Officers.

The result winds up with this:

(click to show/hide)

NPCs within a faction (lords/ladies) show up on the screen, scattered around rather unrelated and often non-faction troops, yet clicking on any of them gives you not only the selected factions troops, but also other faction troops. Even weirder, after getting past the first 3 factions, only one soldier remains on the other 10 pages. I also get a scrolling error message. It managed to update all the remaining factions after I started a new game, but the presentation is still completely messed up.

I don't mind doing the leg work and customizing it to our needs, but do you mind giving me some suggestions as to where the problem could be?

I'm using the NMC base, which came with Custom Commander's view upgrade presentation and all of it's related scripts, as well as diplomacy.

Thanks,

CR

Runea

  • Regular
  • *
    • View Profile
  • Faction: Rhodok
  • M&BWBWF&S
Re: [Code] Dynamic Kingdom Troop Tree Presentation
« Reply #26 on: April 05, 2012, 09:56:10 PM »
I'm getting a similar error; it looks like its running out of room and trying to make do with what it has?

This tree was simple enough so it works:
(click to show/hide)

This one was larger; two units overlap each other in the middle and it gives the illusion that there are three upgrade points.
(click to show/hide)

These two paths overlap; but otherwise are displaying correctly.

So would this be resolvable by just making every picture/branch a little smaller?

Also: Very great code; literally saved me hours upon hours upon HOURS of work if I had to manually make each one of these.

eswallie

  • Veteran
  • *
    • View Profile
  • Faction: Swadian
  • M&BWBWF&S
Re: [Code] Dynamic Kingdom Troop Tree Presentation
« Reply #27 on: May 04, 2012, 07:42:38 AM »

Ok here is the output from my compiler....  it seems that it is now complaining about the Power strike skill.   I can't seem to figure this one out.  I know it has to be a missing comma or some other easy thing.  Any ideas where to begin looking?  It would seem that my skills.py file was somehow messed up, but I do not see how inserting this mods code could cause that.

(click to show/hide)


ok following the guidlines for the additional lines in the constants file it stopped complaining about power strike, but now I get this...  it seems I am misisng somthing obvious here, but i cant see it.

(click to show/hide)
« Last Edit: May 04, 2012, 08:03:15 AM by eswallie »

Caba`drin

  • Administrator
  • *
  • It's time to toss the dice.
    • View Profile
  • Faction: Nord
  • MP nick: Caba_drin
  • M&BWBWF&SNW
Re: [Code] Dynamic Kingdom Troop Tree Presentation
« Reply #28 on: May 04, 2012, 11:18:09 AM »
Simply looks like you didn't add the scripts to the module_scripts file. (Or, if you did, you added them outside of the scripts = [] list)



Patta

  • Sergeant Knight at Arms
  • *
    • View Profile
  • Faction: Sarranid
  • MP nick: IT_Patta_Kaiser
Re: [Code] Dynamic Kingdom Troop Tree Presentation
« Reply #29 on: May 04, 2012, 06:58:12 PM »
I'm getting this:
(click to show/hide)
What did I do wrong? I marked what I think is most important in green.

edit: The first thing seems to be from a presentation, from the scoreboard presentation to be exactly. But I did not do any changes to that after adding this dynamic troop trees. And I compiled it before and it worked fine.