Skip to content

[How do I] learn to mod the Infinity Engine?

HalcyonHalcyon Member Posts: 56
Or perhaps more pertinent, how did you?

Let's say I have virtually no programming or coding (outside of HTML in posts and some less than stellar Wiki editing) experience, middling proficiency with math and too much free time on my hands; is it possible to learn to mod Baldurs Gate, or am I starting out on a Sisyphean task?

If it seems possible, or especially if you once found yourself in a similar position, how did you go about learning the basics? What rudimentary skills do I need under my belt before jumping in?

Any and all advice appreciated; thanks!

Comments

  • AquadrizztAquadrizzt Member Posts: 1,069
    Anyone can mod the Infinity Engine if they commit to it; programming experience is helpful because it teaches you an algorithmic mindset (e.g "here is what I want to do, here's how I'm going to do it most efficiently"), but it is by no means essential in my opinion. An understanding of binary arithmetic is also helpful although non-essential; until you figure it out, there are plenty of web resources that will let you mess around with it to get a feel for how bit-wise arithmetic works.

    Anyway I'd start as I did with a goal in mind of what you want your first mod to do (for example, my first mod was a set of Monk kits back when that functionality was new). This initial goal can be as big or as small as you like, but I'd encourage you to be realistic and start small. If you're wondering which types of mods are the easiest to start with, I'd say that the types of mods one can make are, in order of complexity: items, kits, spells, quests, npcs, areas. This weakly corresponds with the number of files required to implement all the desired functionality. Items can be as simple as one file with one feature, while areas require images, scripts, light/height/search maps, wall polygons, etc.

    First thing I would do is find a mod that does something similar to what you want to do, and actually look through it's WeiDU files (extensions: .tp2, .tpa) that come with the mod. For example, if you wanted to work on items, maybe poke through Item Revisions or any of the smaller item packs here on the forums. Most modders will have comments throughout their code (as any good programmer should) which explain what certain sections do. To help you understand the code, I'd look through the WeiDU readme and the IESDP, both of which serve as excellent references to the functionalities of WeIDU and the game's data structures, respectively.

    From there is a process of iterative development and experimentation. People have been modding the Infinity Engine games for almost two decades now, so there are plenty of people who can help you along the way if you have questions or get stuck. I'd say that the two things that always throw off new modders are 1) the distinction between what is and isn't possible, and 2) the distinction between what is and isn't easy to implement.

    Ask questions, take chances, make mistakes, get messy. It's fun.
  • HalcyonHalcyon Member Posts: 56
    That is a ton of (encouraging!) information and a good place to get started, danke =D
  • ArunsunArunsun Member Posts: 1,592
    Pretty much everything was said. I'll add my own pinch of salt and say "don't be greedy":
    Don't try and start with a huge mod. You probably have dozens of ideas of kits, quests, etc... in mind, but start little. WeiDU is a relatively friendly language (though it has a few quirks at times), but still, learning it on top of trying to do something may become quite tedious and discouraging. When I first learnt how to mod, I was told by a wise man to start with small mods and go bigger and bigger:
    Create a couple of items and spells
    Create a simple kit
    Then a more complicated kit
    Then a simple quest mod
    Then a more complicated quest mod (with new maps for instance)
    Then a NPC mod with banters etc...
    Then you'll be ready to make bigger mods !

    And progress at your own rythm. I'm currently at step 4-5, trying to create quest mods!

    And by all means, do ask questions. We will all be glad to answer
  • mshenkomshenko Member Posts: 6
    Hello, I have a further follow-up question. Can I have an explanation of the earlier steps (like think for real dummies). What do I do first? Lets say I will "try" this on BG2:SOA. So what do I do? First I download the game and install it (I have the beamdog client) and then what? I install a Mod via WeiDU and poke inside the files of the Mod's folder? How do I ACTUALLY start?
  • RaduzielRaduziel Member Posts: 4,714
    The way I learned was:

    Reading as many guides as possible

    Asking around a lot

    Doing reverse-engineer in other mods

    Trial and error

    I'm currently working on a huge mod (Deities of Faerun) and yet I still fail a lot and know very little - so don't get frustrated if the same happens to you.
  • CamDawgCamDawg Member, Developer Posts: 3,438
    One of the best pieces of advice I have for new modders is to do a store mod first. It'll touch on a lot of the basics--you'll need to do a little scripting for the merchant, some dialogue coding, and also create/edit stores and items.

    Otherwise, I'll second the solid advice already given.
  • mshenkomshenko Member Posts: 6
    Thank you, though I still don't understand HOW to start, where to write the code. I tried to download Weidu (which I don't understand what it is) from the site (https://weidu.org/), but the download page for "WeiDU 236 . Download the "Weimer" Dialogue Utilities" doesn't work. I downloaded the other one: WeiDU 185 (868K) . Download the last version of WeiDU compiled by Weimer." I also followed up the orders from this post:

    http://forums.pocketplane.net/index.php?topic=55.0

    Which tells me to delete all files from the Weidu installation excluding the exe file, read me and examples files and to put these 3 in the BG2SOA folder.

    Now what? for now I am reading the readme and other guides.

    I really dislike how they always use a special "Jargon" (the use of a certain coding language like everybody should know the terms and the shortcuts...)
  • RaduzielRaduziel Member Posts: 4,714
    edited January 2019
    You write the code in a text editor like Notepad++ (I think he is the favorite of this community). The file needs to be either a tp2 or tpa format. A tp2 file is used for more complex mods as it may start multiple tpa files.

    Let's say you want to make a kit mod. You can make it: Setup-MyKit.tpa

    But let's say that your kit mod does multiple things. Each thing will me a tpa and they will be read inside a tp2 file.

    Your kit mod now creates the kit and gives it to a NPC. You would have a file called: Setup-MyKit.tp2

    This file would have some commands to install the components. Like:

    Install componentkit.tpa

    Install componentnpc.tpa

    The Weidu.exe is just an installer. You rename this file to Setup-MyKit.exe

    This may sound very hard and confusing, but you see it is kind of intuitive if you look at others mods' codes.

    I have a thread that wished to help people in your situation:

    https://forums.beamdog.com/discussion/69104/useful-sites-for-modding#latest

    Hope it helps. Pretty much everything that helped me learn (other than asking A LOT around here and looking at other modders coding by downloading their mods and reverse-engineering it) is there.

    The General Modding Questions thread has a lot of good information too. Don't let yourself be intimidated by the terms that are used there - a lot of things you can ignore for now, but try to dig the basics.

    @subtledoctor made a nice thread with a pretty much self-explanatory name: How to do stuff in Weidu. It will help you every now and then.

    My piece of advice: before writing anything, read a lot. Read guides, read other people's coding.

    Good luck! And be careful: modding can be very addictive. Deities of Faerun started with me trying to give a kit to Yeslick and now is a project with 38 kits, several other components and way more to come in the future. I try to keep my codes as clean, simple and organized as possible, so feel free to look at it.
  • The user and all related content has been deleted.
  • AlonsoAlonso Member Posts: 806
    edited May 2019
    Removed. There was a misunderstanding with this post.
    Post edited by Alonso on
  • JuliusBorisovJuliusBorisov Member, Administrator, Moderator, Developer Posts: 22,754
    @Alonso It's better to ask kinder.

    I recommend to check out the tutorial by @LavaDelVortel in the community magazine. Check out their issues from March, April, June, August, October, and December 2017 https://www.wildsurge.ca/archive
  • jasteyjastey Member Posts: 2,780
    edited May 2019
    Alonso wrote: »
    I think @mshenko got frustrated and gave up. He asked for advice without jargon, but he got even more jargon. Advice for non modders is only useful if it is written in a way that non modders can understand.

    @Alonso So, how would you write for example "All of this in a text file with a .tp2 extension. All of the "programming" that you do for a mod is in this text file" as @subtledoctor wrote it? How do you write this without "Programmer jargon"?
    I'm asking because the explanations given by @Raduziel and @subtledoctor are as basic as I can imagine, but appearently they still have too much "jargon" for a beginner?
    You criticize helpful people and even imply they are the reason @mshenko didn't reply back, so please give better examples.
    EDIT: This was a misunderstanding, disregard my post.
    Post edited by jastey on
  • [Deleted User][Deleted User] Posts: 0
    edited May 2019
    The user and all related content has been deleted.
  • mshenkomshenko Member Posts: 6
    edited August 2019
    I like to explain people things they don't know like they are stupid children with specific details going back back further as possible. Like:

    You install the game.. You go to the directory. You open a file called "X" bla bla... like going to the explain of the explain no jargon (it shouldn't offend them.. it's explaining and clarifying that is how people understand at any age new material)

    You all have been very helpful. I did gave up but it's more connected to motivation and time. I hope I will start.

    My dream is a total conversion but .. you know.. dreamss... lol. I've started creative writing for science fiction and fantasy worlds but I'mm not sure a book is my desire... so I thought maybe for the fantasy world I'll use the infinity emgine to create a story. My emphasis is the story anyways.
  • AlonsoAlonso Member Posts: 806
    edited August 2019
    Arunsun wrote: »
    WeiDU is a relatively friendly language
    A few months later, after having banged my head against the wall more times than I want to remember, I can confidently say WeiDU is not friendly at all. Over the years I have tinkered with roughly a dozen programming languages, and WeiDU is definitely the least friendly of them all (with the possible exception of assembler, but that's a completely different type of programming).
    mshenko wrote: »
    I like to explain people things they don't know like they are stupid children with specific details going back back further as possible.
    As part of my learning process I wrote a tutorial that explains step by step how to create a very simple mod. It's not for stupid children, though, it's for intelligent people who like clear and detailed information. Some parts might still need some extra detail, though. If anything is unclear, just ask. Hope you find it useful.

    Note: This tutorial is based on a thread in the Spellhold Studios forum. Unfortunately that forum is currently offline, so I cannot link to the original thread.
    Post edited by Alonso on
  • AquadrizztAquadrizzt Member Posts: 1,069
    A few months later, after having banged my head against the wall more times than I want to remember, I can confidently say WeiDU is not friendly at all. Over the years I have tinkered with roughly a dozen programming languages, and WeiDU is definitely the least friendly of them all (with the possible exception of assembler, but that's a completely different type of programming).

    WeiDu was written in the early 2000s and based heavily on OCAML. It's hardly surprising that it doesn't hold up well in the context of more modern, user-friendly languages like Python. I've toyed with writing an alternative in a language like Python, but it's a significant undertaking even before you consider the compatibility aspects required for any new tools to integrate with the existing IE modding ecosystem.
  • atryllachatryllach Member Posts: 2
    I hope Halcyon got the gist of it better than I did :)
    Alonso wrote: »
    As part of my learning process I wrote a tutorial that explains step by step how to create a very simple mod. It's not for stupid children, though, it's for intelligent people who like clear and detailed information. Some parts might still need some extra detail, though. If anything is unclear, just ask. Hope you find it useful.

    I too have zero knowledge about coding and moding and stuff, so thank you for this foundational tutorial.

    I followed Alonso's tutorial exactly with one exception; tried to change the creature whom the item is dropped from otyugh in Irenicus' dungeon to Noober in Nashkel. This might be causing the problem. (Second game is not installed on my PC. So I tried this change, assuming the process is the same for both games.)
    I changed this:
    COPY_EXISTING ~IOTYUGH.cre~ ~override/IOTYUGH.cre~ 
      ADD_CRE_ITEM ~MagicSword~ #0 #0 #0 ~NONE~ ~inv11~
    
    to this:
    COPY_EXISTING ~NOOBER.cre~ ~override/NOOBER.cre~ 
      ADD_CRE_ITEM ~MagicSword~ #0 #0 #0 ~NONE~ ~inv11~
    
    I keep getting this error when i execute the WeiDU file:
    Installing [MagicSword]
    Copying and patching 1 file ...
    ERROR: error loading [MagicSword/MagicSword.itm]
    Stopping installation because of error.
    
    ERROR Installing [MagicSword], rolling back to previous state
    Will uninstall   0 files for [MAGICSWORD/MAGICSWORD.TP2] component 0.
    Uninstalled      0 files for [MAGICSWORD/MAGICSWORD.TP2] component 0.
    ERROR: Unix.Unix_error(20, "stat", "MagicSword/MagicSword.itm")
    Please make a backup of the file: SETUP-MAGICSWORD.DEBUG and look for support at: myemail
    Using Language [English]
    

    I want to understand some coding but my real interest in modding is to render landscapes, deities, characters and sprites, beasts, arms & armour... I'm a painter. So I would really appreciate your ready-to-consume code strings :smiley:
  • GwendolyneGwendolyne Member Posts: 461
    Game files (.itm, .cre...) are restricted to 8 characters. WeiDU can't interpret MagicSword.itm as a valid file. ;)
  • atryllachatryllach Member Posts: 2
    edited October 2021
    Thank you for replying. Made again with a shorter name, successfully "installed" this time but no item dropped when I slayed the poor Noober :) I will try dissecting and lobotomizing some mods I've played with I think. If that doesn't work I shall dominate a programmer from the local university :smiley:
    Post edited by atryllach on
  • GwendolyneGwendolyne Member Posts: 461
    It won't work if you entered the area before installing your mod. Install your mod, then enter the area where Noober should spawn.
  • jasteyjastey Member Posts: 2,780
    @atryllach
    I will try dissecting and lobotomizing
    ... I thought you would write "Noober" after that. :D
    I started modding with mods I liked and the WeiDU readme. @Gwendolyne already pointed out two very important things (file names not longer than 8 letters, always test with a save where you haven't been to the area you made changes to). Good luck!
  • fluke13fluke13 Member Posts: 399
    If it helps, Im clueless with programming language, but with the tools we have anyone can mod - just need time and patience. For someone just starting I wouldn't even go near Weidu... I would:
    1. Install the game I want to mod
    2. Install a single mod that's close to what I want to achieve myself.
    3. Read tutorials about the specfic type of mod I want to create
    4. Install note pad++
    5. Open the mod folder I installed, right click the tp2 = open with notepad++ read through it along side the tutorials
    6. Install modders tools (and read tutorials on how to set these up)...NearInfinity, EE Keeper, DLTCEP
    7. Open NearInfinity, open the override section and look at the files the mod has changed
    8. Start playing around with tweaking the mod - e.g. if it's an item - try adding your own description, own image, change the store it's in, put in on another npc etc

    I'd only start looking at weidu, once you're feeling pretty comfortable with the above. Just my 2 cents.
  • GraionDilachGraionDilach Member Posts: 590
    A suggestion for newbies though - instead of Notepad++, go with Visual Studio Code and look up the https://bgforge.net/mls/ extension for it. That helps reducing typos and gives you some helping hand here'n'there.
Sign In or Register to comment.