PDA

View Full Version : Crusader_Unit_Editor



Gregoshi
01-04-2003, 04:31
Lord Gnome, from the Entrance Hall posts the following for the local Dungeon-dwellers:

-----
To any who are interested in a crusaders_unit_prod11.txt editor I have just uploaded a small prog to the org.
It is called crusaderUnitEditor, and does what it says. it's not as pretty as viewing the file in excel but you can save your changes, and it's easier than doing it in wordpad. here's the readme file I've put with it:

------------------------------------------------------------------------------------------

----------------------------------------

Crusader_Unit_Editorv1.0b 3/2/03

tool to view/edit crusaders_unit_prod11.txt

If like me you enjoy messing with the crusaders_unit_prod11.txt file you may find this program useful.
I adapted an old bit of vb code I had to do this because I was frustated by navigating the unit_prod11 file in wordpad, and try as I would I couldn't get excel to save the files in the right format. This editor isn't particularly pretty but it is at least functional.

Be warned though - the Editor does not do any error checking on the values you enter into the fields, it just reads/writes the string data to and from files in the correct format and makes it easier to navigate the data. It can cope with any number of units in the file (within reason, but far more than the game can probably cope with.), but I haven't included any functionality to add units to the file. Your best bet is to copy a units data to the end of the list (or wherever after data start) manually, save the file and then load/edit the new units data in the editor. I may add this function if I get into adding lots of new units myself. (you do know there is a massive ton of real work to add new units don't you? the data in prod11.txt is just the easy bit ) other functions that may never be added are: value checking, mdi, compareWithOtherFile function.

As this is a vb program it requires the vb6 runtimes to be installed on your system, you might well already have them but if not they can be got from microsoft or any download site. The files needed are: Msvbvm60.dll and comctl32.dll. I think comctl32.dll is a standard windows file (check in windows/system and /system32) so you may only need msvbvm60.dll if at all.

I have tested this program on win98 and win2000 and it seems to work fine, good luck with me/xp (it'll be nice if it works, but I have no idea.).
If you find a bug then feel free to drop me an email (attaching any botched file and/or some kind of description of the error) to crusadereditor@craven-griffiths.net.
This is a kind of beta, I think it should work okay but it has had exactly one tester on just two systems (and one of those is the development machine.) so who knows. If it dosen't work and you let me know I'll be sure to have a go at fixing it.

installation:
unzip the crusaderUnitEditorv1.0b.zip to wherever you like, if you check 'use folder paths' it will create a folder, but you can put it any folder you want. The program requires no registration etc. to run. The '.bak' file included contains the default data and can be replaced with a newer version of crusaders_unit_prod11.txt if we ever get a patch past 1.1. To uninstall the editor just delete the exe.

Of course you use this at your own risk, and please backup your original crusaders_unit file before you start over-writing it.

Lord Gnome.

------------------------------------------------------------------------------------------

-------------------------------------------

comments are welcome.

--------------
Lord Gnome

Kraellin
01-04-2003, 08:38
cool. has this been uploaded to the .org or is on another site?

K.

barocca
01-04-2003, 11:52
http://www.totalwar.org/Downloads/Mtw_Uploads/MTWupload/

Gnome_CrusadeUnitEditor v1.0b.zip

Kraellin
01-04-2003, 17:07
ok, i downloaded this and installed it. it's MUCH easier to read than even the excel viewer and it docks the first column on the left, which is the name of the unit, so that you can see this always as you scroll through the rest of the columns. very nice. one of the things i knew i could do with excel was dock a column, but was always a bit afraid to do cause i might mess up the formatting or something. this editor/viewer solves this.

there is also a VERY nice feature in which you can user-define which fields you want displayed, such that you could have columns 2, 3, and 4 displayed only, or have 5, 6, 7, 19, 23 being the only ones displayed currently and there are about 5 different user-defined sets, so that you can switch back and forth from set to set, as well as the full default display. also very nice.

even if you dont want to trust this thing to save files, it is a VERY good viewer it is MUCH easier to read than wordpad or excel...MUCH

now, i wont attest to how well it saves or not; i just wanted to see what the thing looked like, so i havent tried actual editing and saving with it yet, so i wont make any comments on its workability yet in that regard.

one thing that is a bit difficult is that column with all the ai behaviors. this is a VERY wide field no matter what tool you use to view the file with. this column is just loooong. now, the gnome editor (how's that for a catchy title :) displays the column ok, but it also has the trouble of displaying the entire length of the field all on one screen. it would be helpful with this colum if the #1 column could be un-docked. this would allow for more room to see #15 column. a little radio button or something to allow this would be nice. the entire field is editable; you just have to click in the field and then arrowkey it over to the stuff that is off the screen in each row. but, even if you could un-dock the #1 column, the bloody #15 might still not all show. it really is a wide body.

i didnt try this, but i'm assuming this editor is specifically designed for the unit_prod file in ver 1.1 and wont work for ver 1.0 or for the build_prod files. is that correct, gnome?

it's a very nice job and really does make viewing the unit_prod file MUCH easier.

i'll give it a shot on actual editing later on, but just wanted to comment on it now so that others will take a look at this. it's worth it and the price is definitely right :)

K.

Gregoshi
01-05-2003, 00:01
Lord Gnome replies:

-----
thx for the kind words Kraellin. I'm glad you find it easy to use and like the 'range-selector', I found I was often only interested in a few fields at a time (across many units) so a range-selector was essential. Now to answer your questions in no particular order:

The editor (I like 'gnome editor' btw:) should work just fine with v1.0 unit_prod11 files as the file format was unchanged, the critical part is that each field is tab-delineated and there are still 50 fields per record (71 in the editor I know, but only 50 actual 'tabbed' fields in the file.) Actually I'll just quickly test this... yep, works ok
The editor does for the moment only work with unit_prod though, not build_prod or projectiles.

As to #15 column, yes it's bloody big Even if I 'undock' the names column I still wouldn't see all of it on my max resolution (1024x768) anyway, larger resolutions might have more luck. (btw- it's not actually #1col docked - it's a seperate display like the field headers, note you can't edit the names in this col but the #1col is still present in the main display for editing.)
I can make the names column disappear fairly easily, also how about if I make it so that when you give #15 column the focus (click in it) it expands vertically (temporarily obscuring the next unit's data) to display the whole text? It would revert as soon as it lost focus. (cols 50/51 and maybe a couple of others could also benefit from this.) Hmmm, I'll have a looksee anyway. Maybe I'll give it a little button to toggle on/off also.

out of interest, what os and resolution are you using? if you answer this you will double the test sample

--------------
Lord Gnome

-----

Kraellin
01-05-2003, 02:35
hehe, ok, i've doubled the test sample :)

yeah, i understand about column 15 and i like your solution for it, expanding the rows when it's in focus. this would make it much easier to simply click where you wanted to to edit. this would also make it less necessary to do the whole thing with the names column. just make sure that if you do this, that it also works when using the user defined buttons. the first one of those that i set up was #15. very simple and a very nice shortcut.

you realize, of course, that i'm now going to harrass the hell out of you to make this either workable with the building_prod file or to make a completly new one for that file as well, right? ;) (wordpad is fine for the early.txt files, btw, so no biggy there)

i run win98se on a 1024 x 768 desktop.

it's a very nice job, gnome. well done

K.

Cid
01-05-2003, 05:26
And he just rides off into the sunset.

Thanks Lord Gnome Now maybe I can figure these things out without acquiring progressive myopia. Of course I have to leave for a business trip for a week now http://www.totalwar.org/forum/non-cgi/emoticons/mad.gif

What's he doing in the Entrance Hall? Let him in before he gets away

Lord Gnome
01-06-2003, 06:42
I'm in http://www.totalwar.org/forum/non-cgi/emoticons/cool.gif Hello to the Dungeon.

Here's a post I put up earlier in the Entrance Hall that didn't make it over here:


I have just uploaded crusaderUnitEditorv1.1 to the Org. (http://www.totalwar.org/Downloads/Mtw_Uploads/MTWupload/)

----------------------------
changes made in 1.1:
[thx to kraellin for suggestions]
added button to hide the names column to give maximum possible width to display columns.
fields with too much text to display in one line expand automatically to display the whole text for editing.
the field currently selected is highlighted together with the row/col labels so you don't lose track of the cursor.
fixed a minor bug in range input, made the error reporting on invalid input for ranges more informative. (still NO error checking for actual field values though.)
----------------------------


The changes were easier to make then I thought, with the names column hidden or with an expanded text box it's harder to keep track of which unit is selected so I added some highlighting and the unit names as tooltips to the unit Nos labels on the left side. The highlighting is generally useful as well just for better awareness of exactly which field of the 200 currently displayed you are trying to edit

Build_prod editing is a possibility... no promises but the file format is very similar so it's just a question of a little tinkering to read the data, (the editor will actually read the data from a build_prod/projectiles file as it is - it just then discards it as it has the wrong no of fields ) but then I have to think about how I handle it.... hmmm, maybe, ok, no eta's but I'm looking into it...

campaign editing - I'm glad you don't want this (it's tempting as I only ever play self-modded campaigns and would get a lot of use out of such a tool, but there are so many unexplained rules in the format, only about 3 in 4 of my campaigns work, nightmare.)



-since I posted this I had a little play this afternoon with the code and I reckon you'll have an integrated build/unit Editor fairly soon. Don't be afraid to save your data either Trust me, as long as the data you enter is valid it works http://www.totalwar.org/forum/non-cgi/emoticons/smile.gif

Rosacrux
01-06-2003, 09:19
Oh, yes it does. http://www.totalwar.org/forum/non-cgi/emoticons/pat.gif

It's great and was much needed. Very good work.

Swoosh So
01-06-2003, 10:13
Lord gnome my hero Youll never know how much time you saved me by creating this prog Thanks alot we could do with more peeps like u around here http://www.totalwar.org/forum/non-cgi/emoticons/smile.gif

Kraellin
01-06-2003, 22:52
gnome,

nice touches. i havent tried it yet, but sounds great.

it might actually be better if the two files didnt work in the same editor. there are times when i want both files up and running at the same time, so not sure which way you might wanna go on that one. perfectly fine by me if they were separate editors, given that you're willing to do another one, of course. i suppose you could do a tabbed thing in a single editor where you could simply tab to unit_prod and then tab to build_prod though. might also be possible to simply run the same editor twice though, dunno.

as for error checking on the values, i wouldnt put any in. i like having the ability to do oddball things at times and wouldnt want that inhibited. besides, there is a given that modders are responsible for what they do, including screwing up their own files, so i wouldnt worry about that. your arrangement of the files into sensible, readable formats is already above and beyond, and that they can also save the files correctly was the big missing link in all the excel stuff we've tried.

so, thanks :)

campaign editing? um, all i was talking about was the text files of early, high, and late.txt, not the campaign maps. of course, if you want to give that one a shot, i know a few in here that will gladly name their first born after you. ;)

K.

Lord Gnome
01-07-2003, 20:14
well the new GnomeEditor (integrated build/unit(/and maybe even projectile) editor) is pretty much done, just some testing and final adjustments left. ETA: end of the week.
Integrated just means it will use the same code - seems silly to have different .exe's with 90% of the code identical. The way it will work is when you launch the prog you choose which Editor (build_prod13 or unit_prod11) you want it to load into thru a menu, or you can use a switch on the command line so you can shortcut straight into whichever one you want. Although the prog can only be one editor at a time you can launch as many instances of the application as you want (memory permitting of course). This way you can have multiple unit and/or build editors running simultaneously, each in it's own window.

Kraellin, map-editing scares me By campaign editing I only meant editing the startpos files: early/high/late etc. but mine are called ByzmegaHard, turksVSenglish etc. I leave the more hardcore map-editing to those with graphics skills who understand the complicated fiddling with borders/colours and stuff (has anyone actually successfully modded the campaign map yet BTW?). Besides, messing with text files is one thing, messing with graphics quite another (hats off to RSW's bif editor here.) My 'glad you don't want it' comment was a little sarcastic I'm afraid http://www.totalwar.org/forum/non-cgi/emoticons/tongue.gif as it would seriously be a mammoth undertaking to write a startpos editor, still, you never know. (won't happen soon though )
I think you're right that error-checking values is un-needed, I just wanted to be clear in the readme so no-one got upset when their 5000 man unit crashed the game out People need to know the Editor dosen't make editing fool-proof, just easier on the eye. The only thing I had thought about along these lines was maybe turning the text-field into a drop-down menu with the available choices for fields like 'mount' where there are only a couple of distinct values (HORSE/CAMEL/NONE). I might still add this at some point but I've got a couple of other features I want to think about first.

Hi Cid, Rosacrux and Swoosh http://www.totalwar.org/forum/non-cgi/emoticons/smile.gif. Nice to know ppl are using my prog, would you mind posting your os and screen res so I know if my code works on the various specs I couldn't test? Feel free to comment on any features you want added etc. All ideas/comments are welcome.

Since there's been quite a few mods released now one little germ of an idea I've had is some kind of mod-manager that would swap mods in and out of your MTW directory. I find it a real pain keeping track of which files I've replaced/added in the various folders. Still needs some thought but I know this would be damn useful to my most important user - me http://www.totalwar.org/forum/non-cgi/emoticons/wink.gif.

cugel
01-07-2003, 20:50
"Since there's been quite a few mods released now one little germ of an idea I've had is some kind of mod-manager that would swap mods in and out of your MTW directory. I find it a real pain keeping track of which files I've replaced/added in the various folders. Still needs some thought but I know this would be damn useful to my most important user - me ."

OMG If you attempt this I, for one would be very grateful I can't even keep track of the changes I've made anymore, because I've used bits from different mods made by others, as well as my own changes. If I ever had to go back to the original files . . .(holds head). If you get a chance DO IT

http://www.totalwar.org/forum/non-cgi/emoticons/pat.gif http://www.totalwar.org/forum/non-cgi/emoticons/pat.gif http://www.totalwar.org/forum/non-cgi/emoticons/pat.gif

King David
01-09-2003, 14:52
This program is just what the doctor ordered. Thank you

Lord Gnome
01-11-2003, 17:13
A new editor is available, GnomeEditorv2.0 is an integrated unit_prod11, build_prod13 and projectileStats editor.

As before, get it from the MTWUploads page at the org. (http://www.totalwar.org/Downloads/Mtw_Uploads/MTWupload/)

happy modding,

Kraellin
01-13-2003, 22:57
cool beans, gnome.

i'm about a week backlogged in my replies and modding. computer harddrive crashed and it's been a pain in the arse restoring everything and retrieving all the stuff from the old drive...which caused another crash and full re-install...bah

at any rate, i'll hopefully have this monster fixed pretty soon and will try out your editor. sounds good. the drop down thing would be fine and i definitely like that one can run multiple instances of the editor at the same time. when i mod i often have 4 or 5 files open at once.

as for the mod swapper thing, that's gonna be tricky. if you write a .bat file for it, you always have to keep updating the .bat file as new mods come out. what i do is simply create new directories that hold all the mod files for every mod and then just swap them in and out manually. this is a must because the crusader files are always named the same thing, but they can be modded differently, so one has to keep those files in with whatever other mod files exist for a given mod and swap stuff back and forth. thus, i have a tendency to ignore most stat and mod swapper utilities because they only work for a set list of mods or stats that existed at the time the swapper was made. if you can get around this somehow, then it might be worth having. otherwise it tends to be just another download that i never use.

there is one other danger with swapper type utilities. you never know what's being swapped in and out, since it's usually all automated. i LIKE and even DEMAND to know what's going back and forth. one can easily get lost when too much automation enters into things. and, sometimes folks make mistakes on the swappers and dont know what got changed so it's hard sometimes to change it back to right.

normally, i'm a fairly optomistic, progressive sort of guy, encouraging others with their projects and so forth, but the swapper thing is one i'm not really keen on. but, then maybe you can convince me otherwise. not trying to stop you, mind you, most swappers have left me cold of late.

K.

Cid
01-14-2003, 05:51
What a difference Gnome

As per request- O.S.-WindowsXP, Res-800/600.

Thanks

Cid
01-14-2003, 06:12
Uh-Oh,

I just tried opening the Build Prod and Projectile Stats and got an error message on both. Unit Prod works A-OK.

Lord Gnome
01-14-2003, 21:17
Kraellin, you've hit the nail on the head. Streamlined file swapping is one thing but if it relies on every change being made through itself to keep track of events it won't be massively useful. What I want is to have a prog that as well as being a file-swapper can take a nicely 'mature' MTW directory (ie. heavily modded) and analyse which relevant files have changed, and in some cases tell you precisely how - what extra units etc. I want it to then save this info so when you next run the app it recognises the files and can tell you which files you are using. It will of course also allow you to record which files are matched with each-other in mod-sets (and will store them in mod-folders) so it can easily swap sets in and out. I agree about knowing what's going on, although I'm into having a lot automated it's easy to have very detailed info on each step before it's taken with an option to always get user confirmation before doing any action.
I'm still not sure exactly how to do all this, I'm tinkering with some ideas about comparing file attributes against original/known files (the app could build a user database of modded file attributes and tag descriptions onto the files, which works as long as different files aren't exactly the same byte-size) and also validating the cross links for unit/building references and the nessecary graphics files. I can use quite a bit of existing code for the technical stuff (searching/sorting/comparing) but I need to think a bit about how it'll mesh together to be a prog that is actually useful

If that dosen't work out fairly soon I've got some other ideas lurking about as well.

I'm also going to be doing some catching up on my current campaign game http://www.totalwar.org/forum/non-cgi/emoticons/smile.gif

btw - Hope your pc gets better soon, computer death can be an all too painful experience.



Cid, I'm hoping you are just using the earlier version What exactly is the error message? Does it say "Error Loading File" or "Error Loading [which_type] File" at the top of the message box? (if the former the crusadeUnitEditorv1.0b/v1.1 only works with unit_prod11, you are using gnomeEditorv2.0 right?)
If it is gnomeEditorv2.0 you are using you should also (maybe-hopefully) get some more detailed info on what has gone wrong reading the file. (more than just "the data is incorrectly formatted.")

There are 3 different formats the gnomeEditorv2.0 can read but it has to decide before it reads the file which it will be. If the 'auto-detect' box is checked (default) the editor reads the first few chars of the file, which should be unique constants as this is just the label data/ver no, and initialises the correct mode before creating the data.
If you switch auto-detect off you can manually set the mode and force a file to load, say if you've got a file with just some extra units in it and no labels. If you force a file into an incorrect mode you'll get an error message.

I'm sure I've got the respective formats right and as it is the same code that reads the files in each mode I just can't see why it would work for one file and not the other two... (I really am confident all 3 modes work, please correct me people if I am wrong.)
Having said that no-one has found any other bugs yet, (a mathematical impossibility by one school of thought) so if it is a bug send me the files that won't open (zipped up) to gnomeEditor@craven-griffiths.net and I'll be sure to take a look.

just to be clear the latest versions download file is: Gnome_UnitBuildProj_Editorv2.0.zip on the Mtw_Uploads page at the Org. (http://www.totalwar.org/Downloads/Mtw_Uploads/MTWupload/)



oh, and to keep things in one place we should probably direct bug reports/comments to the stickied new GnomeEditorv2.0 thread (http://www.totalwar.org/cgi-bin/forum/ikonboard.cgi?act=ST;f=5;t=4636) at the top of the board http://www.totalwar.org/forum/non-cgi/emoticons/smile.gif.

Kraellin
01-15-2003, 00:25
gnome,

k. glad you didnt take my post as 'no way you can do this so stop doing everything'. :)

in the old 8 bit days i made a nice little mod thing that would do a raw read of a file and look for certain bytes or positions. it might be possible to add in a couple of rems to the crusader files at the beginning of the file and simply read those and match them up to the other files in the mod. or maybe add in a rem for all the files on a given mod so as to code or tag them and then have your swapper read the rems to match them up. however, this would mean that all mods would then have to add in these rems or other identifying marks and the authors would have to include these to make the whole thing work.

i suppose you could read the file stamps also and maybe get it to work that way, but that can be tricky also.

another approach might be something like what i said i did. i put all mods in their own directorys under a main mod directory. with an approach like this you could have the swapper simply look for the appropriate directory and maybe include an .ini file or something like that for the entire contents of the directory.

would a double extension approach work or would the game reject double extensions?

a packing approach might also work. stick all relevant files into one packed file and have the swapper unpack and copy into the appropriate directorys. still, you'd have to prepare each new mod for this.

ok, i'll shut up now. i'm just grasping at straws here. i'll leave it to you :)

K.

Cid
01-15-2003, 02:43
Gnome,nothing is a mathematical impossibility when it comes to me and computers. That said-

I'm useing v2.0 and was getting error message "incorrectly formatted" and "Program stopped loading at Record 2: Field 26. I did have auto detect unchecked, HOWEVER when I tried Load Default rather than Load file it worked...hmm.

I should mention that I'm useing Wes's mod if that matters.

One other thing I've noticed is that in Unit_Prod I can't locate the faction specific column eg., Genoese Sailors Italian.

I'm almost "mathematically certain" that it's something I'm doing wrong (note lack of problems by anyone else)as my computer acumen is / where the average acumen of others in Dungeon appears to be ////////////

Thanks

Lord Gnome
01-15-2003, 04:41
Cid, just a quick reply before I have to sleep (it's *yawn* late here in gnomeland):

The 'Load Defaults' button just loads the appropriate .bak file from the gnomeEditor directory (they are just the original (MTW1.1) .txt files renamed). If auto-detect is checked and you are already in a particular mode (ie. unit, build or projectile) the load defaults button will assume you want that modes default data, if unchecked (or not in a specific mode) it prompts you as to which you want.

If the editor really won't load a genuine (ie. one that works with the game) unit/build/projectile file with auto-detect on then I definitely want to know If it still dosen't load when you switch auto-detect off (assuming you've picked the appropriate mode/file type) it's even worse. http://www.totalwar.org/forum/non-cgi/emoticons/mecry.gif

If this is the case then I'd be very grateful if you could zip the file that won't load and mail it to me. (I've probably got Wes' mod on my hd but I'd rather see the exact file causing the problems if poss.) If you're not certain it's a bug but you still can't get it to load still send it, I'd much rather discover it's not a bug than have a bug unchecked.

oh, and almost forgot, the faction specific column is #50. btw- Genoese sailors aren't limited to Italian faction (they have an ALL_FACTIONS entry in #50) just Genoa - set in region specific column #51. Also relevant to who can build what is #54, specific culture (they can all be set and you have to satisfy all of them to be able to build the unit). And not to be confused with #12 and #13 which specify faction/region bonus for a unit. http://www.totalwar.org/forum/non-cgi/emoticons/smile.gif is that clear?

Kraellin, thanks for the input. I feel like I'm getting closer to nailing a design... hmmm, could just be the fog of tiredness though I'll post up any ideas that survive the night tomorrow.

Cid
01-15-2003, 06:02
Will do LG.

As to faction specific columns--Doh

This really is a great tool.

Nighty night