Putting the 'role' back in role-playing games since 2002.
Donate to Codex
Good Old Games
  • 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.

Pillars of Eternity Coding/Hacking Thread

Sensuki

Arcane
Joined
Oct 26, 2012
Messages
9,799
Location
New North Korea
Codex 2014 Serpent in the Staglands Shadorwun: Hong Kong A Beautifully Desolate Campaign
do you have the ildasm command ? mine doesn't open the ildasm window like it says on this tutorial, it wants another input
 

J_C

One Bit Studio
Patron
Developer
Joined
Dec 28, 2010
Messages
16,947
Location
Pannonia
Project: Eternity Wasteland 2 Shadorwun: Hong Kong Divinity: Original Sin 2 Steve gets a Kidney but I don't even get a tag. Pathfinder: Wrath
Ok, this thread just turned into something I don't understand a thing about.
 

Liston

Augur
Joined
Mar 28, 2013
Messages
200
do you have the ildasm command ? mine doesn't open the ildasm window like it says on this tutorial, it wants another input

Just type ildasm in vs command prompt. I don't know what could be the problem, what is its output?
 

Sensuki

Arcane
Joined
Oct 26, 2012
Messages
9,799
Location
New North Korea
Codex 2014 Serpent in the Staglands Shadorwun: Hong Kong A Beautifully Desolate Campaign
Yeah I got it, the tutorial I was looking at was for an old version, I've changed the 8 to 16 in my assemblyCsharp.il file, now I need to recompile it with ilasm, but once again I think its a newer version or something and the command to recompile isn't working properly

I'm doing like

ilasm.exe F:\Steam....\assemblycsharp.il /dll

comes up with error invalid option
 

Liston

Augur
Joined
Mar 28, 2013
Messages
200
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.

I don't own reflector, nor do I need it for personal use. I was only making small changes, reflector wouldn't be of much help here.
 

Sensuki

Arcane
Joined
Oct 26, 2012
Messages
9,799
Location
New North Korea
Codex 2014 Serpent in the Staglands Shadorwun: Hong Kong A Beautifully Desolate Campaign
Damn, didn't work.

.method public hidebysig specialname instance int32
get_InventoryMaxSize() cil managed
{
// Code size 2 (0x2)
.maxstack 16
IL_0000: ldc.i4.8
IL_0001: ret
} // end of method CharacterStats::get_InventoryMaxSize

I changed the maxstack to 16, but was i supposed to do something else?

like change ldc.i4.8 to something ?

I also tried Reflexil and I couldn't figure out what I was supposed to do - it had this same thing, just ldc.i4.8 and I wasn't sure what to change it to.
 

Immortal

Arcane
In My Safe Space
Joined
Sep 13, 2014
Messages
5,062
Location
Safe Space - Don't Bulli
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.

I don't own reflector, nor do I need it for personal use. I was only making small changes, reflector wouldn't be of much help here.

I meant that in response to you saying that the only way to modify IL was to run those tools..
 

Liston

Augur
Joined
Mar 28, 2013
Messages
200
Damn, didn't work.

.method public hidebysig specialname instance int32
get_InventoryMaxSize() cil managed
{
// Code size 2 (0x2)
.maxstack 16
IL_0000: ldc.i4.8
IL_0001: ret
} // end of method CharacterStats::get_InventoryMaxSize

I changed the maxstack to 16, but was i supposed to do something else?

like change ldc.i4.8 to something ?

I also tried Reflexil and I couldn't figure out what I was supposed to do - it had this same thing, just ldc.i4.8 and I wasn't sure what to change it to.

change ldc.i4.8 to ldc.i4 16.
 

Liston

Augur
Joined
Mar 28, 2013
Messages
200
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.

I don't own reflector, nor do I need it for personal use. I was only making small changes, reflector wouldn't be of much help here.

I meant that in response to you saying that the only way to modify IL was to run those tools..

I guess that you misunderstood me. I never said that that was the only way, I just explained how I did it.
 

Sensuki

Arcane
Joined
Oct 26, 2012
Messages
9,799
Location
New North Korea
Codex 2014 Serpent in the Staglands Shadorwun: Hong Kong A Beautifully Desolate Campaign
That didn't work for me, but ldc.r4 16. compiled so I'll see if that worked

edit:

:yeah:

RSf0pxP.jpg


Mod and installation instructions here: http://forums.obsidian.net/topic/68592-inventory-mod-16-slots/
 
Last edited:

Immortal

Arcane
In My Safe Space
Joined
Sep 13, 2014
Messages
5,062
Location
Safe Space - Don't Bulli
I don't really expect them to emulate the Infinity Engine.. Honestly our job will be easier then WeiDu's was..
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.


After looking over the code I can almost grantee that the AI will be implemented fully in C#..
If they had a middleware language I would be extremely surprised. It is still possible though I guess...

The good news is that Obsidian follows very good practices for objects.. They make good use of abstraction.

Here is a quick generated class diagram to see the inheritance structure and how things are laid out.. Again this will likely be fleshed out more.. and it will be interesting to see how much of this AI is dependent on configuration files.. (So the non-programming plebs at Obs can do AI)

I am gonna keep digging around. It's much nicer to read then I thought it would be.. Kudos to any Obs devs reading this.

AIState.png
 

aeonsim

Augur
Joined
Dec 30, 2007
Messages
122
I don't really expect them to emulate the Infinity Engine.. Honestly our job will be easier then WeiDu's was..
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.


After looking over the code I can almost grantee that the AI will be implemented fully in C#..
If they had a middleware language I would be extremely surprised. It is still possible though I guess...

The good news is that Obsidian follows very good practices for objects.. They make good use of abstraction.

Here is a quick generated class diagram to see the inheritance structure and how things are laid out.. Again this will likely be fleshed out more.. and it will be interesting to see how much of this AI is dependent on configuration files.. (So the non-programming plebs at Obs can do AI)

I am gonna keep digging around. It's much nicer to read then I thought it would be.. Kudos to any Obs devs reading this.
---

Nice diagram.

It seems to me that if they're coding in C# on a mono or .net platform you should be able to code the AI in any of the .net support languages (F#, IronPython, IronRuby, IronLISP etc) you may need or be able to pull the code out into a separate class/resource or dll (mainly a Java/Scala coder so not certain of exact terminology for .net) and simply patch the main code to call/import your additional resource.
That way you could have a rather nice simple patch for the core Obs DLL that pretty much deletes the code you want to replace and adds an import command for your resource. It might get a bit mucky depending on how much use they're making of the global name space vs object based passing of data but hard for me to tell with out a good look at the code.

Also with the .net/mono platform as I've already mentioned the range of languages you can use to target the platform is pretty large, so while you may not have a specialist domain specific language for AI code I'd think F# or IronLISP might work quiet well or even IronPython if that's what your more familiar with.
 

Immortal

Arcane
In My Safe Space
Joined
Sep 13, 2014
Messages
5,062
Location
Safe Space - Don't Bulli
I don't really expect them to emulate the Infinity Engine.. Honestly our job will be easier then WeiDu's was..
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.


After looking over the code I can almost grantee that the AI will be implemented fully in C#..
If they had a middleware language I would be extremely surprised. It is still possible though I guess...

The good news is that Obsidian follows very good practices for objects.. They make good use of abstraction.

Here is a quick generated class diagram to see the inheritance structure and how things are laid out.. Again this will likely be fleshed out more.. and it will be interesting to see how much of this AI is dependent on configuration files.. (So the non-programming plebs at Obs can do AI)

I am gonna keep digging around. It's much nicer to read then I thought it would be.. Kudos to any Obs devs reading this.
---

Nice diagram.

It seems to me that if they're coding in C# on a mono or .net platform you should be able to code the AI in any of the .net support languages (F#, IronPython, IronRuby, IronLISP etc) you may need or be able to pull the code out into a separate class/resource or dll (mainly a Java/Scala coder so not certain of exact terminology for .net) and simply patch the main code to call/import your additional resource.
That way you could have a rather nice simple patch for the core Obs DLL that pretty much deletes the code you want to replace and adds an import command for your resource. It might get a bit mucky depending on how much use they're making of the global name space vs object based passing of data but hard for me to tell with out a good look at the code.

Also with the .net/mono platform as I've already mentioned the range of languages you can use to target the platform is pretty large, so while you may not have a specialist domain specific language for AI code I'd think F# or IronLISP might work quiet well or even IronPython if that's what your more familiar with.


By no means am I a Unity/Mono expert so please correct this post if I am wrong but...

The only officially supported languages in Unity are C# / Javascript / Boo.. Note that this code is not compiled against the .NET framework but uses Mono exclusively so that it can remain cross platform. Although it does make use of unbiased syntax within C# that is not the same as supporting .NET specific conventions.

Now I know Mono has support for things like F#, Scala, Java ect ect.. But not all these languages are supported by default.. some are done by other communities and more importantly.. I don't think Unity supports them either.

EDIT:

I don't think any of this is a bad thing.. I think the way they have set up their object hierarchy.. They could create a pretty modular AI system.. The only part I am missing or not sure about is how fluid it will pull in configuration files and dynamic actions like spell types or whatever.

It seems to be pretty tightly coupled to what actions the m_owner can do.. but I haven't had enough time to look through everything so far.
 

aeonsim

Augur
Joined
Dec 30, 2007
Messages
122
I don't really expect them to emulate the Infinity Engine.. Honestly our job will be easier then WeiDu's was..
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.

---

Nice diagram.

It seems to me that if they're coding in C# on a mono or .net platform you should be able to code the AI in any of the .net support languages (F#, IronPython, IronRuby, IronLISP etc) you may need or be able to pull the code out into a separate class/resource or dll (mainly a Java/Scala coder so not certain of exact terminology for .net) and simply patch the main code to call/import your additional resource.
That way you could have a rather nice simple patch for the core Obs DLL that pretty much deletes the code you want to replace and adds an import command for your resource. It might get a bit mucky depending on how much use they're making of the global name space vs object based passing of data but hard for me to tell with out a good look at the code.

Also with the .net/mono platform as I've already mentioned the range of languages you can use to target the platform is pretty large, so while you may not have a specialist domain specific language for AI code I'd think F# or IronLISP might work quiet well or even IronPython if that's what your more familiar with.


By no means am I a Unity/Mono expert so please correct this post if I am wrong but...

The only officially supported languages in Unity are C# / Javascript / Boo.. Note that this code is not compiled against the .NET framework but uses Mono exclusively so that it can remain cross platform. Although it does make use of unbiased syntax within C# that is not the same as supporting .NET specific conventions.

Now I know Mono has support for things like F#, Scala, Java ect ect.. But not all these languages are supported by default.. some are done by other communities and more importantly.. I don't think Unity supports them either.

EDIT:

I don't think any of this is a bad thing.. I think the way they have set up their object hierarchy.. They could create a pretty modular AI system.. The only part I am missing or not sure about is how fluid it will pull in configuration files and dynamic actions like spell types or whatever.

It seems to be pretty tightly coupled to what actions the m_owner can do.. but I haven't had enough time to look through everything so far.

So by the looks of things you can use any mono supported language with unity, just need to drop the resulting dll's into the game folder once they're compiled to the CLI level. https://semitwist.com/articles/article/view/unity3d-supports-all-.net-clr-mono-languages

So you should be able to write the AI in F#, IronPython, LUA, IronJavaScript (why???), Visual basic.net (god no!!!) and a number of other ones possibly including java & scala though those last two might be a little more complicated to get working with the mono namespace and packaging system: http://www.mono-project.com/docs/about-mono/languages/
 

SCO

Arcane
In My Safe Space
Joined
Feb 3, 2009
Messages
16,320
Shadorwun: Hong Kong
Like diversity for diversity sake is a good idea for software projects. What's needed is a (safe) api that perfectly fits the purpose of data driven (file format based) modular code that doesn't interfere with eachother but combines fine and can be metaprogrammed* over if you're willing to go deeper. Something like Weidu in fact. Language is the least of the issues. Inheritance and all that stuff which has nothing to do with the problem domain will only make it worse i suspect.

I hope that what modders end up programing for AI doesn't require stuff like triggering casting animations, if you want them. Of course i hope this is a silly example, but that code doesn't make me confident.

*something like AspectJ and some standard names/interface for some important functions like the dialog engine? (adding topics to conversations, modifying weapon effects etc).
Or just do it with a interface if you manage to think up of everything that modders will want changed.

IE had another great advantage that its code was completely separate from the tabular data, so many mods could 'massage' the original data or even data from other mods at install time without them knowing about it. This is probably the first casualty that modding with a general purpose programming language will inflict on modding.

Just thinking of the bullshit ad-hoc runtime arrays of non-standardized data or strings if modders end up hacking C# to mod makes me shudder. Not to mention the terrible code.
 
Last edited:

aeonsim

Augur
Joined
Dec 30, 2007
Messages
122
It depends exactly on how complex you want to make the AI for a fairly basic one any language will work, and a data driven modular system would work well.

For some more complex AI's functional languages like F# and lisp can allow complex behaviours to be written in only a fraction of the lines of code needed in an imperative language todo the same thing.
 

SCO

Arcane
In My Safe Space
Joined
Feb 3, 2009
Messages
16,320
Shadorwun: Hong Kong
Yes i toyed with prolog too. What they don't tell you on those classes about inference engines is that they're very slow (and completely useless for combat AI too since the game AI has all the information all the time). Maybe they would be good for spell selection idk.
 

Immortal

Arcane
In My Safe Space
Joined
Sep 13, 2014
Messages
5,062
Location
Safe Space - Don't Bulli
To be honest.. like none of those languages would be my first pick for a scripting language and I really don't want to spend time making one.. If you want to go ahead.

I think a much more valuable use of time is to write a patcher that hooks into important objects of the game and can dynamically insert code changes from different developers who want to expand the AI stack or modify it to be more intelligent.. Without blowing out each other.

I still don't know enough about their final AI system to accurately describe what that would look like but I have a rough idea.. The smart thing would be to probably create an interface to an AIStatePatch or some other object and then dynamically fill that with new routines that can replace/improve/expand the originals. Or just hot swap them directly and create a backup of the affected classes. *shrug*

So lets say they have an AIStack that checks if 3 people are grouped together and if they are, and m_owner has a fireball spell.. he casts it. Simple but effective.. I am not AI master but I am sure other people could think of a better more sexy AI that didn't cheat but was harder to predict.

Or a more random AI that had different spells each time the encounter started.. That may be tricky.. again I don't know the code that well yet.

If you want to build another layer on top of that.. be my guest.. C# already looks like a scripting language to me honestly.. This isn't really complex code compared to some of the hack'n'cocky shit i'v seen in other games / engines. (The ugly stuff is in Unity itself)

EDIT:
Just want to state this is all bullshit theory stuff until I get a handle on how all these things work.. I can't even run the game (Im not in beta).. I am just making bookmarks and code hopping around trying to figure out all the patterns. Girlfriend keeps bugging me with something.
 

SCO

Arcane
In My Safe Space
Joined
Feb 3, 2009
Messages
16,320
Shadorwun: Hong Kong
Well, we'll see how it turns out. I'm predicting megamods right now, and buggy to boot, but i will be happy to eat my words if it doesn't happen.
 

Immortal

Arcane
In My Safe Space
Joined
Sep 13, 2014
Messages
5,062
Location
Safe Space - Don't Bulli
Well, we'll see how it turns out. I'm predicting megamods right now, and buggy to boot, but i will be happy to eat my words if it doesn't happen.

I'm predicting shit mods right now.. Where they change the names of swords to penis +3.. and Dyrewood to Farts Town.. I think to actually see decent modifications for like Implementing new XP systems or overhauling AI we are gonna have to wait a while.. But not as long of a while as with other games..
 

As an Amazon Associate, rpgcodex.net earns from qualifying purchases.
Back
Top Bottom