Official Codex Discord Server

  1. Welcome to rpgcodex.net, a site dedicated to discussing computer based role-playing games in a free and open fashion. We're less strict than other forums, but please refer to the rules.

    "This message is awaiting moderator approval": All new users must pass through our moderation queue before they will be able to post normally. Until your account has "passed" your posts will only be visible to yourself (and moderators) until they are approved. Give us a week to get around to approving / deleting / ignoring your mundane opinion on crap before hassling us about it. Once you have passed the moderation period (think of it as a test), you will be able to post normally, just like all the other retards.
    Dismiss Notice

Pillars of Eternity Coding/Hacking Thread

Discussion in 'Obsidian Entertainment' started by Sensuki, Sep 16, 2014.

  1. Sensuki Arcane Cuck

    Sensuki
    Joined:
    Oct 26, 2012
    Messages:
    9,405
    Location:
    Australia
    Codex 2014 Serpent in the Staglands Shadorwun: Hong Kong A Beautifully Desolate Campaign
    Someone able to help me increase the inventory size? I've changed the InventoryMaxSlots in the Characterstats.cs to 16, just need to get the UI to show them now, trying to find the code in among the UIInventoryxxxx stuff
     
    ^ Top  
  2. Sensuki Arcane Cuck

    Sensuki
    Joined:
    Oct 26, 2012
    Messages:
    9,405
    Location:
    Australia
    Codex 2014 Serpent in the Staglands Shadorwun: Hong Kong A Beautifully Desolate Campaign
    Whoever wrote the inventory code looks like they've done Mobile/Android Development before.
     
    • Brofist Brofist x 1
    ^ Top  
  3. Sensuki Arcane Cuck

    Sensuki
    Joined:
    Oct 26, 2012
    Messages:
    9,405
    Location:
    Australia
    Codex 2014 Serpent in the Staglands Shadorwun: Hong Kong A Beautifully Desolate Campaign
    Liston said he's already done it (changed it to 16 slots), I paged him earlier to ask how, I can't seem to find the code that makes the second row show up.

    This wasn't hard to do (someone posted a mockup of this earlier)

    [​IMG]
     
    Last edited: Sep 16, 2014
    • Brofist Brofist x 23
    ^ Top  
  4. Immortal Arcane

    Immortal
    Joined:
    Sep 13, 2014
    Messages:
    3,610
    If people start releasing mods.. you really need to write a patcher.. Releasing entire .dll's as "fixes" will just limit peoples ability to use multiple mods because they will overwrite eachother.

    Someone should write a generic patcher for those files first..
    Congrats you learned about string tables.. something that any software that hopes to be localized does..
    Is this your first look at C# or something? :lol:

    I can't wait to see the mods that come out of this.. *sigh*
     
    ^ Top  
  5. Sensuki Arcane Cuck

    Sensuki
    Joined:
    Oct 26, 2012
    Messages:
    9,405
    Location:
    Australia
    Codex 2014 Serpent in the Staglands Shadorwun: Hong Kong A Beautifully Desolate Campaign
    Why do you think Sawyer prefers classless systems?

    What? I've changed heaps of shit in the text string tables before, I only just remembered that I could make a real version of the mock up someone posted about 50 pages ago of this.

    I've done Object Oriented Java at uni, C# doesn't look too hard to understand, annotations such as @Serializable is [Serializable] and there are a bunch of other differences. Anyway at least I can understand most of what I'm reading.

    Still can't find where the line that controls the second inventory row is though. I've changed the max size, but I think I have to enable it on one of the UI classes.

    I couldn't write a patcher though, I'm pretty shit at programming as it is. Someone else will do one.
     
    Last edited: Sep 16, 2014
    ^ Top  
  6. SCO Arcane In My Safe Space

    SCO
    Joined:
    Feb 3, 2009
    Messages:
    16,297
    Shadorwun: Hong Kong
    Unless the AI is externalized with composable scripts (even with decompiling) it won't ever reach BG levels by modding. C# like all the other complex languages is not composable at source code level unless the code is designed for it. Meaning it probably won't be.
     
    ^ Top  
  7. Immortal Arcane

    Immortal
    Joined:
    Sep 13, 2014
    Messages:
    3,610
    The AI will be externalized / decoupled in some way.. whether that means a C# API or an actual script language is yet to be seen.. but it won't matter.

    Even if they use a C# API.. it can be hooked and improved as long as they don't do anything to prevent that.. like obfuscating the code.. which based on Sensuki's 1337 Text String Manipulation seems to be the case.

    This game will be highly moddable.. new content though? That's gonna be rough with those Isometric texture backgrounds..
     
    ^ Top  
  8. SCO Arcane In My Safe Space

    SCO
    Joined:
    Feb 3, 2009
    Messages:
    16,297
    Shadorwun: Hong Kong
    The 'problem' is that the engine they're trying to emulate has a script api that was reverse engineered to the point when the scripts were decompiled, and by a very happy accident, all that they do is to follow a heartbeat every frame for all characters from top to bottom allowing the possibility to bail out.

    Which means modders could add code to the file and as long as their trigger conditions were true only occasionally their new code didn't interfere with 'old' code. It is modular in the sense that to add functional code, you don't need to touch the previous code, which is almost never the case with more efficient, function oriented languages.
     
    ^ Top  
  9. Immortal Arcane

    Immortal
    Joined:
    Sep 13, 2014
    Messages:
    3,610
    Uhm.. What..?

    EDIT
    How is this a problem.
     
    Last edited: Sep 16, 2014
    ^ Top  
  10. Jaesun Fabulous Moderator Patron

    Jaesun
    Joined:
    May 14, 2004
    Messages:
    36,921
    Location:
    Seattle, WA USA
    Torment: Tides of Numenera Divinity: Original Sin 2 BattleTech
    I thought you were an expert programmer Drog, what don't you understand? :M
     
    • Brofist Brofist x 4
    ^ Top  
  11. Immortal Arcane

    Immortal
    Joined:
    Sep 13, 2014
    Messages:
    3,610
    I modified my post. I don't understand what the problem is.
     
    ^ Top  
  12. SCO Arcane In My Safe Space

    SCO
    Joined:
    Feb 3, 2009
    Messages:
    16,297
    Shadorwun: Hong Kong
    I'm doubting that composability will be preserved in this engine and a Infinity Engine type of moding environment will be prevented from arising. All of Tim Cain previous rpg engines weren't composable (bloodlines/ToEE, fallout) at the code level, such as in Weidu mods where one mod can alter all the scripts of all one handed weapons and another completely different one by another author add damage types and resistances to weapons and enemies (for instance) and you can install both without caring that the authors never coordinated. Of course there are incompatibilities, but notice that the games i mentioned all use 'megamods' (aka 'we can't figure out how not to conflict so we quit trying').

    Just replacing files in a virtual directory structure is not enough for this kind of modding in general (also the mistake of D:OS btw).
     
    Last edited: Sep 16, 2014
    • Brofist Brofist x 2
    ^ Top  
  13. Immortal Arcane

    Immortal
    Joined:
    Sep 13, 2014
    Messages:
    3,610
    So a couple things here.. Not sure what you mean by composability but your definitely right that we will not have a modular way of patching in AI code unless we write our own environment bed.. We could construct an interface or generic loader that allows us to supply AI objects that can be external to the code and we just patch over those external objects..

    Like the difference between PoE and those other examples is that we have direct access to the source code.. So we can do whatever we want. How much time and work it will take.. is a different story.

    Already I see the problem coming up where mods will be shitting on each other. All the code changes being made currently by Sensuki and friends are just using reflex to hot patch code changes into the assembly-CSharp .dll. This is the wrong way to release mods so we are going to need a Weidu type hook / patcher that supports modular code swaps instead of just swapping entire .dll's..

    Bearing in mind that.. I am not in the beta so I haven't seen the code yet and I don't believe their AI system has even been implemented so we have no idea how it will work yet. The current AI could just be hacked in or filler code until they finished that framework.
     
    ^ Top  
  14. Sensuki Arcane Cuck

    Sensuki
    Joined:
    Oct 26, 2012
    Messages:
    9,405
    Location:
    Australia
    Codex 2014 Serpent in the Staglands Shadorwun: Hong Kong A Beautifully Desolate Campaign
    There are a few class files that govern the behaviour, there's not much there at the moment but they have someone adding some more shit in for the next patch or the one after.
     
    ^ Top  
  15. Immortal Arcane

    Immortal
    Joined:
    Sep 13, 2014
    Messages:
    3,610
    Can you provide their namespace heiarchy or give us some class names they are using? It could reveal how decoupled their AI will be.. which will dictate how hard it is to replace / modify intelligently.

    Or is it all inLined in some AiManager class?
     
    ^ Top  
  16. SCO Arcane In My Safe Space

    SCO
    Joined:
    Feb 3, 2009
    Messages:
    16,297
    Shadorwun: Hong Kong
    It mostly depends on that scripting structure yes.

    Outright mechanics change are probably out, due to needing to change the actual C# (things like Sensuki is doing).
    Depending on the structure they end up using for the AI, if they use a sane interface for it, it may be possible to straight jacket the modders so their code is 'composable by design' although due to the complicated syntactic nature of C# the compiler will probably need to be restrictive and will not permit all language possibilities (and a good thing too, you probably want to prevent dumbfucks creating threads or reading IO in the AI engine).
     
    ^ Top  
  17. Sensuki Arcane Cuck

    Sensuki
    Joined:
    Oct 26, 2012
    Messages:
    9,405
    Location:
    Australia
    Codex 2014 Serpent in the Staglands Shadorwun: Hong Kong A Beautifully Desolate Campaign
    can do better than that actually
     
    ^ Top  
  18. Immortal Arcane

    Immortal
    Joined:
    Sep 13, 2014
    Messages:
    3,610
    I think most of those things are managed through Unity.. Again I think we are not fully on the same page SCO.. Why shouldn't we modify the source code if the goal is to create a WeiDu type environment that allows multiple mods to play nice together..
     
    ^ Top  
  19. Liston Savant

    Liston
    Joined:
    Mar 28, 2013
    Messages:
    200
    I only changed CharacterStats.InventoryMaxSize, although I'm using BB v257. Look at what is assigning BaseInventory.MaxSize (BaseInventory.Update() probably).
     
    ^ Top  
  20. SCO Arcane In My Safe Space

    SCO
    Joined:
    Feb 3, 2009
    Messages:
    16,297
    Shadorwun: Hong Kong
    No reason, except maybe legal ones which i hope obsidian waivers somehow. But i'd have hoped that when people promise a 'IE successor' that work is done for us. Not to mention that it might be that all AI needs to be replaced.

    I looked at the code you gave Sensuki and although the scripting engine is not there yet, they're going for a tick model of AI updates (in the misnamed 'GameAIState' - more like NPCAIState).
     
    Last edited: Sep 16, 2014
    ^ Top  
  21. Immortal Arcane

    Immortal
    Joined:
    Sep 13, 2014
    Messages:
    3,610
    I don't really expect them to emulate the Infinity Engine.. Honestly our job will be easier then WeiDu's was.. He had to find those hooks and data without the source code.. (As did a friend of mine when we implemented the scripting system for Nox) It's much more difficult digging around in Assembly and hex to find information then reading the source code.

    I doubt legal action will be an issue.. Obsidian's rules on modding is "if you can do it then your allowed to".. No publisher or team of lawyers to descend on us.. WeiDu is just as invasive.
     
    ^ Top  
  22. Sensuki Arcane Cuck

    Sensuki
    Joined:
    Oct 26, 2012
    Messages:
    9,405
    Location:
    Australia
    Codex 2014 Serpent in the Staglands Shadorwun: Hong Kong A Beautifully Desolate Campaign
    What program did you use? I tried Reflexil with NET Reflector
     
    ^ Top  
  23. SCO Arcane In My Safe Space

    SCO
    Joined:
    Feb 3, 2009
    Messages:
    16,297
    Shadorwun: Hong Kong
    It might be easier than WEIDU but the modders job will probably be much harder if this information/behavior is not centralized and restructed somehow into a domain specific language. Look at the AI/plan directory. CasterScanForTarget is a whole (complicated) file just for the AI choosing their target, checking for nulls (!!!), pushing waypoints, adding fidget animations etc, which in BGScript is just a selector over a list of nearest and a cast command.
     
    Last edited: Sep 16, 2014
    ^ Top  
  24. Liston Savant

    Liston
    Joined:
    Mar 28, 2013
    Messages:
    200
    I decompiled dll with ildasm, made changes and recompiled with ilasm.

    Edit: You have to make changes in MSIL this way, it's really easy when you use ilspy. Just find what you want to change in ilspy, look at ilspy il output, find the code in .il file (output of ildasm) and recompile
     
    ^ Top  
  25. Immortal Arcane

    Immortal
    Joined:
    Sep 13, 2014
    Messages:
    3,610
    I don't have time to dig in the source right now.. when I get home I will take a look .. Bearing in mind this code will most likely be changed before release.

    Oh Lawdy.. :D


    EDIT: Liston Reflexil Modifies the MSIL and is capable of hot patching / code injecting and generating a modified assembly.. Similar tools exist for byte code manipulation as well.
     
    Last edited: Sep 16, 2014
    ^ Top  

(buying stuff via the above buttons helps us pay the hosting bills, thanks!)