Jump to content

Weidu Best Practices - request for guide


Recommended Posts

Hi,

 

I should request this 3 years ago but hey, better late than never :hm: . My request is for all mod authors which know how to not do things using weidu. There are many ways to do the same things using weidu but some of them are much worse than others. You can do many bad things and you won't be aware about possible consequences until someone will encounter a bug and report it.

 

So I'm requesting competent and experienced IE mod creators (I'm looking at you, DawidW, CamDawg, K4thos, subtledoctor and others ) to share their best practices and examples. Please share you because without it, other mod authors might have hard times to achieve compatibility and reliability of their mods.

 

Example: mod want's to modify a string "Hello"

How to not do it:
modify a string "Hello"

 

Proper way to do it:

modify a string "Hello" and check if modification was successful

 

 

Link to comment

"Best practices" is, by design, meant to be broad-ranging advice. If you're looking for the best way to do specific things, you're better served looking at code from good mods and modders, and the newer the release the better. Tweaks has generally been at or near the tip of the spear code-wise, and covers a broad range of modifications so it's not a bad place to look. As of v11, Fixpack's pretty sharp as well and covers some unusual stuff (such as BAM patching) not typically seen elsewhere.

 

My general advice would be

  • Patch. There may be times when you should overwrite, but they're rare. This is the singular, best thing you can do for compatibility.
  • Listen to feedback. My experience has been that consistently good mods and modders actively solicit and act upon feedback. A single "your mod sucks and here's why" post is more important and will do more to improve your mod than a thousand "your mod is awesome!!!" posts.
  • Comment everything. This is a habit I learned from Perl, but it has served me well no matter what I'm coding.
  • In the same vein, use meaningful variable names. Your code will be much more readable and easier to maintain.
  • If you find yourself doing similar code repeatedly, look to combine it or handle it with macros.
  • Don't be afraid to ask for help.
  • Learn the difference between things you can do vs. things you should do (e.g. SP Collection).
  • Never stop learning. Whether you're on your first day or your second decade, there's always a new trick or clever code that you can add to your toolbox.
Link to comment

I pretty much always do things the "wrong" way, so I probably shouldn't be on that list :jump:

 

Lessons learned the hard way are lessons that are not forgotten. I'm happy my first language was Perl. Not an easy first programming language, but it taught me great habits (comments, good variable names, the power of regexp) that continue to benefit me as I learn "easier" languages.

Link to comment

I should request this 3 years ago but hey, better late than never :hm: . My request is for all mod authors which know how to not do things using weidu. There are many ways to do the same things using weidu but some of them are much worse than others. You can do many bad things and you won't be aware about possible consequences until someone will encounter a bug and report it.

I don't think there's an answer to that, it's like asking how to not speak English improperly.

 

I pretty much always do things the "wrong" way, so I probably shouldn't be on that list :jump:

Still, that's exactly what makes you a better teacher than someone who just can't fail.
Link to comment

So, I think I may have something specific after all, based on Alien's implications over at PPG... From here http://forums.pocketplane.net/index.php/topic,29676.msg338693.html#msg338693 :

 

  • Never change DESIGNATED values of your components as you update the mod. If you had like 1,2,3,4,5 going in a row, and you need to insert something between them, then use other values i.e. 101,102,103 etc. but don't remap what you have already DESIGNATED because it will disrupt compatibility code in other mods checking for yours.
Link to comment

Never change DESIGNATED values of your components as you update the mod. If you had like 1,2,3,4,5 going in a row, and you need to insert something between them, then use other values i.e. 101,102,103 etc. but don't remap what you have already DESIGNATED because it will disrupt compatibility code in other mods checking for yours.

Or just bother to make a proper update to the BWS thread that's explains the effect of the update. In a logical manner that even the google translator could try to not to botch.
Link to comment

 

So, I think I may have something specific after all, based on Alien's implications over at PPG... From here http://forums.pocketplane.net/index.php/topic,29676.msg338693.html#msg338693 :

 

  • Never change DESIGNATED values of your components as you update the mod. If you had like 1,2,3,4,5 going in a row, and you need to insert something between them, then use other values i.e. 101,102,103 etc. but don't remap what you have already DESIGNATED because it will disrupt compatibility code in other mods checking for yours.

 

 

 

Jarno: There is not only BWS to be considered. Other mods could check for DESIGNATED components of your mod, too.

Fully agree - regardless of BWS - mods providing crossmod contents and looking for specific components either fail or produce garbage if the numbering is changed with every update. And the numbering does nothing for the sequence in your tp2, so why re-number?

Besides crossmod, it also applies for other mods like tweaks or spells that look for other mods to avoid overlap or incompatibility (e.g. I do not install my 15 if mod B's 12 is already installed.). Other example is portrait mods.

Link to comment

And the numbering does nothing for the sequence in your tp2, so why re-number?

Typical case is to remake the number sequences to actually mean something. That's why the whole thing is there for, you could just not have the whole thing in .tp2 file and be fine without it, if they didn't mean a darn thing. As the .tp2 includes it's invisible DESIGNATED function before it installs the components.

 

Besides crossmod, it also applies for other mods like tweaks or spells that look for other mods to avoid overlap or incompatibility (e.g. I do not install my 15 if mod B's 12 is already installed.). Other example is portrait mods.

If a mod is installed, there's a typical file associated, for example a .dlg for EVERY NPC mod, the fact that a file exist in the first place in portrait mods in the override folder. And nearly every spell mod is either way incompatible with any other Spell mod if you go looking for it in that way. And last the rule tweak mods.... well prepare for a cheese show, that you'll find yourself to be a part of a wheel. Aka you might as well overwrite all the old files as that will prevent incompatibility easier than way, than try to extend the existing mess that other mods make of them. .

Thus, you don't need to check if the mod component number that makes it is installed is there, you can check if the file exists and thus extend that file or not.

Now, this of course doesn't mean that everyone should voluntarily go and use an ALWAYS phase to randomize their their DESIGNATED #, but an Imp could, perhaps. :p:devlook:

Link to comment

So, I think I may have something specific after all, based on Alien's implications over at PPG... From here http://forums.pocketplane.net/index.php/topic,29676.msg338693.html#msg338693 :

  • Never change DESIGNATED values of your components as you update the mod. If you had like 1,2,3,4,5 going in a row, and you need to insert something between them, then use other values i.e. 101,102,103 etc. but don't remap what you have already DESIGNATED because it will disrupt compatibility code in other mods checking for yours.

Changes to DESIGNATED numbers shouldn't affect external systems (BWS/Mod Database/Other Mods) in a way that any change will destroy whole world. We need GUID/UUID keyword for every component. I've posted all arguments at weidu board. Please support my request.

Link to comment

 

If a mod is installed, there's a typical file associated, for example a .dlg for EVERY NPC mod, the fact that a file exist in the first place in portrait mods in the override folder.

Alter Weapon Proficiency System from Tweaks has five different options, none of which create any new files, and make fairly radical shifts to the game. You would actually have to check contents of 2das and do other annoying things to check them in the absence of a stable component number.

 

Ardanis is right, full stop. Don't mess with component numbers.

Link to comment

Another thing but not related directly to Weidu.

Mods adding new areas should provide the Tis+PVRZ converted files with their mod and use them if GAME_IS any of the EE's. Just to stop the *horizontal lines* discussion every other week...

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...