OSP Kit Combat Battlefield Tactics kit. Multiple formations per team+command revamp!

Users who are viewing this thread

yanzco said:
hello. how can i port this to warband 1.125
is it compatible with the current diplomacy mod?..

Read the Warband Readme from my June 24 post http://forums.taleworlds.com/index.php/topic,34685.msg2929248.html#msg2929248

I'm not familiar with the diplomacy mod, but my guess would be "yes." Most of my code is in new scripts/structures, and the "Native" code I alter with a few insertions is strictly related to battlefield mechanics.
--M
 
Idibil said:
I'm not familiar with the diplomacy mod, but my guess would be "yes." Most of my code is in new scripts/structures, and the "Native" code I alter with a few insertions is strictly related to battlefield mechanics.

It run perfectly with diplomacy  :wink:

oh. i was wondering why it wasnt listed on the compatible mods to the latest diplomacy mod thread.

oh btw. where can i find the formation mod?.. its not in the first page..

@Idibil: mind if you could share the diplomacy and formations mod combined together?..
im quite a newbie to modding.. so, i might make alots of mistakes..
 
You have motomataru code here:
http://forums.taleworlds.com/index.php/topic,34685.510.html

You need diplomacy module system
http://forums.taleworlds.com/index.php/topic,116434.0.html

if you wish know most about modding, look here:
http://forums.taleworlds.com/index.php/topic,48405.0.html


You can download diplomacy code and add motomataru formations code. Both mods use different spaces, you will have problems.

@Idibil: mind if you could share the diplomacy and formations mod combined together?..
im quite a newbie to modding.. so, i might make alots of mistakes..

I had it integrate in Brytenwalda with a lot of other code  :???:
 
oh thats alright..
hmm..

-> Directions:
1. Append the constants listed in module_constants (regular v3 directory).

where can i find this regular v3 directory..
hmm. do i need an editor here?..
when i checked scripts.txt.. i see numbers.. not the commands like motomotaru posted..

sorry.. can you pm me and give instructions ? :smile:
 
you need module system (pyton files, no txt), yanzco, you can use diplomacy module system of base, link i posted up.

if you dont know module system and you wish learn, you should read Jik guie:
http://forums.taleworlds.com/index.php/topic,56798.0.html

Jik´s guie teach you like understand code and add it.  :wink:


 
ok.. will work on that now..
last question.. the module system warband released is for 1.124.. can i use it for 1.125?..
 
I've done an experimental wrapping of this mod to try to introduce it into my game with minimal intrusion.

file at:
http://www.filedropper.com/formationsv3sourcerewrapped

What this does:
* Keep all formation files separate from the main module files
* Only insertion into main files is a small code snippet at the bottom to run the in-built injector scripts, which will handle all the insert here, insert there stuff at run-time, leaving the original module files clean (except for part calling the injector functions).
* Transparent to small version changes in game and other mods.  I.e. for newer game versions, unless there are MAJOR or DRASTIC changes to the part the injector scripts tries to find to insert the modded content, it can probably work for future game versions as well (after you add the injector code at the bottom of the new module files)

What this does not:
* Add/change this mod.  The code is from the original mod.  the only thing that this rewrapping do, is to make use of scripts to do the merge the mod into the current module using the manual instructions motomataru wrote for the human in his README.
* Change your original module files.  In case there are misunderstanding, this rewrapping is NOT some script that actually open up the module py files and writes their contents into the files.  This scripts will do the merging in memory when you build your module.  YOU WON'T SEE THE MERGED SOURCE FILES!!!! (only the txt version will contain the merged changes) Pardon me there. Just in case somebody come up and ask me where are the modded changes... :wink:

Changes from original:
* There is just ONE change atm, I've re-rigged the optional part motomataru provided for enemy AI to use formations as well, to be dependent on a global variable "$g_formation_option_ai_use_formation".  If set to 1, it will call Formation's own scripts to let AI use Formations.  otherwise, it will use the original scripts (backed up by the injector code)  There are NO ui to change this value atm, though.  (DIY)

Finally
Thanks to motomataru  and any others who have helped developed this mod which benefits the rest of the community.  Also, would be cool if future development/changes to this mod can use some arrangement like this re-wrapped version so that it is easier to update. (easiest method is to write all new scripts in formation's own py files, and make use of injector to replace the original scripts at build time).  One side benefit is that it is faster to edit a small py file vs a file with > 40000 lines.

Feedback to me on the injector idea (currently messily hacked together in a short time... like 2 days?) and suggestions on improvements are welcome.  Formation related stuff goes to moto, including all the thanks.

EDIT:
I have not tested it with other mods, but if other mods did not change the part that the injector scripts tries to find beyond recognition, it could work just by dropping it in (and adding the injector code snippets).  Tell me if it works (if it doesn't, let's forget you've seen this post... :wink: )
 
I'd like to report 2 problems with the Warband version:
- Sometimes, the enemy's troops just stand there and don't attack. Easy picking.
- The enemy's reinforcements don't form a formation.

Can something be done to fix that or are these engine limitations?
 
sphere said:
I've done an experimental wrapping of this mod to try to introduce it into my game with minimal intrusion.

Sphere, you the Man!

So, with the injector, modders just replace the formations_* rather than manual cut and paste to module_*. I think they'll prefer that!

I don't know enough Python to completely maintain your code, but as long as I am able to keep the mod source "compact" there shouldn't be a problem.

Very impressive for two days' work!
 
Bismarck said:
I'd like to report 2 problems with the Warband version:
- Sometimes, the enemy's troops just stand there and don't attack. Easy picking.
- The enemy's reinforcements don't form a formation.

Can something be done to fix that or are these engine limitations?

Prob 1: Native AI script. I've completely redone AI, but haven't put the mod out beyond it's use in Brytenwalda beta. The testers are bashing it as we speak! When it's fairly robust, I'll put it up.

Prob 2: I noticed a variant of this problem with my new AI. Basically, the troops get their formation data from the team leader (partly because faction data is NOT attached to most troops -- even faction troops). When the leader dies, the troops can't determine which faction they belong to, hence can't pick a formation. Initially, I thought, "No problem. Leaderless troops shouldn't perform functions that require orders from a leader." But it does look funny to see a formation go kaplooey in the middle of a battle when the leader is killed. Suggestions?
 
I'm using your SW AI scripts in 1257ad, I like the AI much better than the native weirdness.  I would like to play around with your updated AI script!

You could store formation information in global variables at the start of the battle, I guess, $team_blah_blah = formation_so_and_so.
 
motomataru said:
sphere said:
I've done an experimental wrapping of this mod to try to introduce it into my game with minimal intrusion.

Sphere, you the Man!

So, with the injector, modders just replace the formations_* rather than manual cut and paste to module_*. I think they'll prefer that!

I don't know enough Python to completely maintain your code, but as long as I am able to keep the mod source "compact" there shouldn't be a problem.

Very impressive for two days' work!

still wip :smile: It still have the short coming of having to manually edit module_???.py if there is a change in the number and order of mods to merge.... but I've just successfully finish a new protoype where all you have to do is insert this:

Code:
# All-in-one modmerger
from modmerger import modmerge
modmerge(scripts)

to EVERY module_*.py file (yes.. SAME 2 lines for all files)

and a master control option files that decides the mod files and order of processing they should do:
Code:
# master options for mod merger
# -2 : print error only
# -1 : print errors and warnings
# 0 : print errors, warnings and info
# 1 : print all
DEBUG_MODE = 1



# List of active mod code names.
# This is also the default order during bulk processing
# The specific mod source files must be in the format "{modname}_????.py".  
# for example, the mod content corresponding to "items", for mod "fc" should be in the file "fc_items.py"
mods_active = [
    "fc",          # force commander
    "surrealarms", # surrealarms items
    "ospitemv",    #osp item variants
    "customsettlements", # Item addon for custom settlements
    "formations"   # motomataru's formations v3    
]


# Alternate process order for certain modules components
# Only need to be defined if order/combination is different from mods_active
# Each element in is is a tuple with the following elements
#
# 1) mod component name (less the "module_" prefix), e.g. for "module_items", it will be "items"
# 2) list of mod names in the order to be processed.  The mod names should be 
#      the ones used in mods_active, and will only be processed if they are in
#      mods_active.
#
mods_process_order=[
#    ("{component_name}", [{list of mod names}]),

    ("items", [
    "ospitemv",    #osp item variants
    "customsettlements", # Item addon for custom settlements
    "surrealarms", # surrealarms items
    #"formations"   # no items
    "fc",          # no items
    ]), # items
]


And from now on, unless game version updates, the module_* files will stay unchanged.  By changing the options file, I can control which mods to include/exclude and in which order of processing.... it is already successful, but I'm taking my time to debug and see whether it can be improved further... :wink:

As for maintenance, it's actually quite easy: just do your changes in the formations_* files.
If you don't want the injector which does low level insertion of script lines operation blocks, you could just redefine a script function.

E.g. say you want to modify some "scriptA" in module_scripts.py.  Instead of actually modifying it there, you should make a copy of the ("scriptA", [...]) in module_scripts.py and put it in formations_scripts.py (which ALSO have a scripts=[...] variable just like module_scripts.py), and then use the modmerge_scripts to replace it when it is processed (I forgot what version I used, but I think there should be a check_duplicate thingy somewhere that just need to be set to True... or izzit on by default already...)

But if I get my new "modmerger" kit into shape, I could do another round of update from whatever latest code you have (I really really just followed the instructions in your README, except that I translate human action into python script action).
 
othr said:
I'm using your SW AI scripts in 1257ad, I like the AI much better than the native weirdness.  I would like to play around with your updated AI script!

This ought to work better for 1257 than the original Star Wars version -- infantry and cavalry are fleshed out.

The scripts depend on the formations mod. They're pretty well contained and added in just like the formations scripts -- I only had to make a slight fix to the WB morale script (which I'd just as soon dump!).

http://dl.dropbox.com/u/8432316/AI%20in%20Formations%20v1/module_constants.py

http://dl.dropbox.com/u/8432316/AI%20in%20Formations%20v1/module_mission_templates.py

http://dl.dropbox.com/u/8432316/AI%20in%20Formations%20v1/module_mission_templates_wb.py (Warband version)

http://dl.dropbox.com/u/8432316/AI%20in%20Formations%20v1/module_scripts.py

http://dl.dropbox.com/u/8432316/AI%20in%20Formations%20v1/module_scripts_wb.py (Warband version)

http://dl.dropbox.com/u/8432316/AI%20in%20Formations%20v1/decide_run_away_or_not.py (slight fix to WB script)
 
I'm still relative new to using this mod, so the following may not be accurate.  Please be tolerant, and just take those that may be useful :wink: Using warband 1127, btw.  Note this is the version BEFORE the last update.  Please ignore all the points which are no longer applicable.


1) relation with the original Hold command (holding F1-F1, move to target, then release).  intuitively, I'll expect the formations to be centered horizontally and have front touching the spot marked.  This is not always the case.

2) Facing is also a problem.  As there is a lack of rotating formations atm (unless I miss out some features), keeping the default idea of autorotating to face the nearest concentration of enemies will be good.

3) Have the option to get a threshold range for soldiers to move from their post (default could be not moving an inch from the spot).  Sometimes, it is very frustrating that soldiers do not just move that extra 20 cm to take a strike at enemy

4) Separate formation position templates from assignment template.  Position will define position "slots" like ranks, staggered ranks (where a ranks positions are aligned with gaps of the rank in front, like the default Hold position in game has with "Stand Closer" issued), shieldwall, square, wedge, loose (where rest of "formation" just follow the leader losely without any fixed formation) and of course no formations.  assignment templates will decide how to assign troops to that formation (and also how to "repair" damaged formations when troops die).  E.g. maybe for just ranks, we could have:
a) 3 ranks: infantry in first line, archer in second line, mounted archers in third, cavalry divided into two blocks at either side (not mixed with the center ranks) (If only we have kneel animation and make the first line kneel with shields up....)
or
b) 2 ranks, first rank with alternating infantry and archers, second rank with alternating cavalry and mounted archers

5) Extended formation commands: like for ranks/square, have a "rotate ranks" that makes first rank go to last rank, 2nd rank becomes first rank, etc.  This is good for distributing damage to first row, and also for "maneuvers" like quickly switching two ranks of archers and infantry when enemy is close.  This is done by keeping formation position template, but swapping/updating the assignment template.  i.e. make deciding what units to put in front easy.

6) Regarding "Shield wall", is it a formation where those units with the biggest/baddest shield will go to first row and set their individual ai to actually hold the shield (i.e. agent performing shieldwall duty are automatically set to not put down the shield like fire range weapons or use two handed weapons unless otherwise commanded or shieldwall is changed to some other formation).  If it isn't, maybe it should be???

7) Separate and build up on the "reform" formation idea.  Which does stuff like repair damaged positions (with empty slots) and also swap formation positions between agents based on a "current strength" evaluation.  Formation can be set to be periodically called automatically by default (but nice if can switch off in some options) or can be triggered by a "Reform!" command.  Although the original Charge command (F1-F3) serves as a "Break formation" command for now, I think we should really provide a formations specific key/concept, even if underneath it just calls native's Charge settings.  This will train user to the Formation's ui, even if in the future, we want to change or add to what "Break formation" will do (e.g. maybe it will have to do some cleanup to the formation members before Charging).

a) Wedge will always put the strongest units nearer the "point".  If units gets wounded and become less "strong", they should fall down the heap (replaced by a stronger troop behind) during a reform.  A cheap way is to check through every position and the two positions behind it and use some evaluation script function to determine who is "strongest" among the three, and if one in the back positions is stronger than the one in front, the agents will swap their formation slots.
b) Similar to the Wedge reordering, square formation should put the strongest units in the first row, side columns and then back row, concentrating the weakest units in the center (e.g. for each position, compare with the 2 adjacent position nearer to formation center, 1 in file direction, 1 in rank direction, the weakest unit should end up closer to the center)

:cool: To restrict number of triggers in battle, instead of hard coding keys to fixed formations, we can bind customized formation/assignment commands as well as set default commands before hand.  Nice if can have a "Let's have a formation drill..." from Camp menu, which launches a wilderness map with player party troops and no enemy, (and have victory condition suppressed to prevent the stupid cheering?) and let the player experiment with formations using a bulkier and time consuming UI structure (e.g. more/longer key press sequence) which allows player to experiment with all formation options, and "save" the ones that he/she likes most in the limited slots available in real combat.  Then have another "Let's have a military exercise..." option from camp which launches similar mission/map but with the same triggers as in actual battle, and let the user test/practise formation commands.  This should allow individual player to fine tune their formations greatly.

9) This is not directly game related, but have users of formation mod discuss and rank formation (position/assignment templates) against troops category like infantry, infantry(shield), ranged, cavalry, mounted ranged, (firearms?) in the forums, and from feedback, can generate a profile for best automatic formation choosing by AI in future versions of this mod (may also want to scale by ai difficulty setting)

typed too much.... :wink:


Not directly related to above, but... (please ignore useless stuff, and just hoping something could be helpful)
motomataru said:
Prob 2: I noticed a variant of this problem with my new AI. Basically, the troops get their formation data from the team leader (partly because faction data is NOT attached to most troops -- even faction troops). When the leader dies, the troops can't determine which faction they belong to, hence can't pick a formation. Initially, I thought, "No problem. Leaderless troops shouldn't perform functions that require orders from a leader." But it does look funny to see a formation go kaplooey in the middle of a battle when the leader is killed. Suggestions?

I don;t understand the "faction" part exactly, do you mean this:

* formation related data are stored in faction data, and only team leader records the faction id?
* is it possible to propagate this data to all formation members during formation forming/reforming?
* if it is the lack of leader problem, can a new leader be elected by the first agent that detects leader is gone? (e.g. once agent detects leader killed, store the agent's id in global data, then read back the id (to cater for race-condition), and if the id is the agent's id, the agent is now the new leader and will do initiate the formation reforming and reading/generating all the formation data again.

I'm still not that familiar with missions and agents, but if you think it could be helpful, can always discuss more in post to see if there are any useful glitter in the mud :wink:
 
There is just one issue I noticed.  Cavalry units will wait for their dehorsed friends before making another charge, I think it would be best if they didn't, they're very vulnerable to ranged fire when they're just standing there waiting for their buddies on foot to join up.
 
Back
Top Bottom