Jump to content


Photo

Weidu Best Practices - request for guide


20 replies to this topic

#1 ALIENQuake

ALIENQuake
  • Modders
  • 409 posts
  • Gender:Male
  • Location:Poland

Posted 21 July 2017 - 04:48 AM

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

 

 


You cannot have progress without changes...


#2 CamDawg

CamDawg

    Dreaming of a red Xmas

  • Gibberling Poobah
  • 9298 posts
  • Gender:Not Telling

Posted 21 July 2017 - 08:30 AM

"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.

I came here with a simple dream: a dream of killing all humans. And this is how it must end? Who's the real seven billion ton robot monster here? Not I. Not... I.


#3 Roxanne

Roxanne

    Modder

  • Modders
  • 1671 posts
  • Gender:Female
  • Location:Auckland, NZ

Posted 21 July 2017 - 08:46 AM

This topic - just started a few days ago - may have a very similar intention:

http://gibberlings3....topic=28835&hl=


The Sandrah Saga

another piece of *buggy, cheesy, unbalanced junk*


#4 subtledoctor

subtledoctor
  • Modders
  • 2212 posts
  • Gender:Male

Posted 21 July 2017 - 09:22 AM

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


Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#5 CamDawg

CamDawg

    Dreaming of a red Xmas

  • Gibberling Poobah
  • 9298 posts
  • Gender:Not Telling

Posted 21 July 2017 - 04:01 PM

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.


I came here with a simple dream: a dream of killing all humans. And this is how it must end? Who's the real seven billion ton robot monster here? Not I. Not... I.


#6 Ardanis

Ardanis

    A very GAR character

  • Modders
  • 2557 posts
  • Gender:Male
  • Location:Saint-Petersburg, Russia

Posted 21 July 2017 - 04:29 PM

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.

Edited by Ardanis, 21 July 2017 - 04:40 PM.

"Uguu~ Boku Ayu."

Before you start breaking wall tiles with your bare fists, ask yourself first - do you truly need it?

#7 Ardanis

Ardanis

    A very GAR character

  • Modders
  • 2557 posts
  • Gender:Male
  • Location:Saint-Petersburg, Russia

Posted 23 July 2017 - 10:08 PM

So, I think I may have something specific after all, based on Alien's implications over at PPG... From here http://forums.pocket....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.

"Uguu~ Boku Ayu."

Before you start breaking wall tiles with your bare fists, ask yourself first - do you truly need it?

#8 Jarno Mikkola

Jarno Mikkola

    The Imp

  • Modders
  • 6303 posts
  • Gender:Male
  • Location:The town where the dead haven't keeled over, yet. In Finland.

Posted 23 July 2017 - 10:31 PM

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.
Welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand.
Here's how to install all the ... mods you ever really could want to Infinity Engine games. I removed the stable word from there as Roxanne began to add BS mods that are likely to break compatibility from the BWS.

#9 jastey

jastey
  • Gibberlings
  • 6964 posts
  • Gender:Female

Posted 23 July 2017 - 11:00 PM

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



#10 Roxanne

Roxanne

    Modder

  • Modders
  • 1671 posts
  • Gender:Female
  • Location:Auckland, NZ

Posted 23 July 2017 - 11:56 PM

 

So, I think I may have something specific after all, based on Alien's implications over at PPG... From here http://forums.pocket....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.


Edited by Roxanne, 23 July 2017 - 11:59 PM.

The Sandrah Saga

another piece of *buggy, cheesy, unbalanced junk*


#11 Jarno Mikkola

Jarno Mikkola

    The Imp

  • Modders
  • 6303 posts
  • Gender:Male
  • Location:The town where the dead haven't keeled over, yet. In Finland.

Posted 24 July 2017 - 03:05 AM

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:
Welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand.
Here's how to install all the ... mods you ever really could want to Infinity Engine games. I removed the stable word from there as Roxanne began to add BS mods that are likely to break compatibility from the BWS.

#12 jastey

jastey
  • Gibberlings
  • 6964 posts
  • Gender:Female

Posted 24 July 2017 - 03:50 AM

you can check if the file exists and thus

You can do a lot of things on a long day. As if the community isn't already at its limits actually updating the existing mods to the current games.



#13 ALIENQuake

ALIENQuake
  • Modders
  • 409 posts
  • Gender:Male
  • Location:Poland

Posted 24 July 2017 - 04:33 AM

So, I think I may have something specific after all, based on Alien's implications over at PPG... From here http://forums.pocket....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.


You cannot have progress without changes...


#14 CamDawg

CamDawg

    Dreaming of a red Xmas

  • Gibberling Poobah
  • 9298 posts
  • Gender:Not Telling

Posted 24 July 2017 - 06:30 AM


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.


I came here with a simple dream: a dream of killing all humans. And this is how it must end? Who's the real seven billion ton robot monster here? Not I. Not... I.


#15 Roxanne

Roxanne

    Modder

  • Modders
  • 1671 posts
  • Gender:Female
  • Location:Auckland, NZ

Posted 26 July 2017 - 01:51 AM

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...


The Sandrah Saga

another piece of *buggy, cheesy, unbalanced junk*




Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users