Please dont run obfuscation over the code!

The Galaxy Lives On! Distant Worlds, the critically acclaimed 4X space strategy game is back with a brand new 64-bit engine, 3D graphics and a polished interface to begin an epic new Distant Worlds series with Distant Worlds 2. Distant Worlds 2 is a vast, pausable real-time 4X space strategy game. Experience the full depth and detail of turn-based strategy, but with the simplicity and ease of real-time, and on the scale of a massively-multiplayer online game.

Moderator: MOD_DW2

Deathawaits4
Posts: 20
Joined: Mon Mar 01, 2021 9:26 pm

Re: Please dont run obfuscation over the code!

Post by Deathawaits4 »

zgrssd wrote: Tue Mar 08, 2022 6:59 pm
Deathawaits4 wrote: Tue Mar 08, 2022 6:01 pm
brucethemoose wrote: Tue Mar 08, 2022 7:07 am All of this ^.

Typically, in Cities:Skylines, Kerbal Space Program, Oxygen Not Included, Rimworld, Stardew Valley and many other games, modders mess with game mechanics implemented in C# via Harmony without having to touch, say, Unity's C++ functions. This has the added benefit of letting all these code modifications play nice with each other, via patching and transpiling, among other things.

It sounds like DW2 may be structured differently than a typical Unity game, with many of the game mechanics implemented in C++ code? Obviously this would be great to access, and I echo Deathawaits4's suggestion above, but modders will gratefully take absolutely anything and everything we can get. We have zero expectations. If you have to obfuscate all of the C++ and part of the C# while leaving some C# open, so be it, that would be far superior than being limited to basic scripting. On the other hand, I suspect modders will do amazing things with anything and everything you choose to leave unobfuscated.



Just to expand on Stellaris some, its problems are manyfold. A big one is the scripting language, which could be worse, but is extremely limited in terms of what it exposes and what it allows you to do. As Death said, some basic operations are ridiculously convoluted and slow, and what modders have done already is nothing short of a miracle.

Another is the primitive conflict resolution. Some fundamental files and functions have to be overwritten entirely, which is an absolute nightmare when more than one mod needs to touch that same file or function. Again, Harmony (as well as xml patching in Rimworld's case) takes care of this.

And yes. Frustrated modders from many communities would jump right into DW2 modding, and drag plenty of their fans and Patreons in with them. DW2 is a perfect storm of what they've been craving: complexity, performance, competent AI, and highly automated systems.
Yes! Exactly. And you know what is best? It seems like the game is written fully in c# as the underlying engine seems to be stride or xenko engine which is fully developed in c#. Maybe there are some parts using c++ (maybe the connection between the graphics engine and the drivers), but most of it will be c#, which brings vast posibilities on what is possible!
With "C++" we have to differentiate with what I call "native C++" (involves naked pointers, arrays without bounds checks and all the other funny ways to get speed and mess up) and "C++ .NET".
If it is the later, it realy makes 0 difference. MSIL is MSIL, regardless of the source langauge.
Yeap, but since i mostly work with c# in my job, im very happy about it :) C# is overall easier in my opinion and most of the times people mix c++/CIL with native c++ (native in order to get the best possible performance and CIL for wrappers and making it cross compatible).
Deathawaits4
Posts: 20
Joined: Mon Mar 01, 2021 9:26 pm

Re: Please dont run obfuscation over the code!

Post by Deathawaits4 »

Hello, sorry for the bump!

Just asking if there are any news on this topic as the release is just around the corner!
would love to hear the decission which has been made
Buio
Posts: 368
Joined: Wed Nov 21, 2012 7:40 pm

Re: Please dont run obfuscation over the code!

Post by Buio »

https://www.reddit.com/r/pcgaming/comme ... &context=3
We'll be posting a bit of a modding roadmap and some modding docs on release day as well to help explain where we are and where we're going modding-wise. DW2 is at least as moddable as Universe was (a bit more really) at release.
Deathawaits4
Posts: 20
Joined: Mon Mar 01, 2021 9:26 pm

Re: Please dont run obfuscation over the code!

Post by Deathawaits4 »

Buio wrote: Wed Mar 09, 2022 8:06 pm https://www.reddit.com/r/pcgaming/comme ... &context=3
We'll be posting a bit of a modding roadmap and some modding docs on release day as well to help explain where we are and where we're going modding-wise. DW2 is at least as moddable as Universe was (a bit more really) at release.
Thanks for the link!
Sadly this still does not answer the question, but it definetly gives me a hint that modding is atleast very much supported.
brucethemoose
Posts: 46
Joined: Fri Feb 18, 2022 6:14 pm

Re: Please dont run obfuscation over the code!

Post by brucethemoose »

So just poking through the game directory for a few minutes before I even open the game, it looks like we have enough access to the Xenko engine to get in trouble... I'm having trouble finding where the actual game mechanics are in the code though. I think I need more coffee.


Also, I'm happy to see lots of data formatted as xml (as opposed to plain text in DW1). XPath patching alone will be a huge boost to modding some day, assuming it isn't already enabled.
Deathawaits4
Posts: 20
Joined: Mon Mar 01, 2021 9:26 pm

Re: Please dont run obfuscation over the code!

Post by Deathawaits4 »

brucethemoose wrote: Thu Mar 10, 2022 5:00 pm So just poking through the game directory for a few minutes before I even open the game, it looks like we have enough access to the Xenko engine to get in trouble... I'm having trouble finding where the actual game mechanics are in the code though. I think I need more coffee.


Also, I'm happy to see lots of data formatted as xml (as opposed to plain text in DW1). XPath patching alone will be a huge boost to modding some day, assuming it isn't already enabled.
Eyo, havent had time to check the game out as im currently out of town. Did you check if you could access the game data via ilspy? Do you think harmony modding is viable? Ill check it out as soon as i get the time.

also theres atleast the xpath dlls available, so im confident that xpath is possible.
brucethemoose
Posts: 46
Joined: Fri Feb 18, 2022 6:14 pm

Re: Please dont run obfuscation over the code!

Post by brucethemoose »

Deathawaits4 wrote: Thu Mar 10, 2022 6:31 pm
brucethemoose wrote: Thu Mar 10, 2022 5:00 pm So just poking through the game directory for a few minutes before I even open the game, it looks like we have enough access to the Xenko engine to get in trouble... I'm having trouble finding where the actual game mechanics are in the code though. I think I need more coffee.


Also, I'm happy to see lots of data formatted as xml (as opposed to plain text in DW1). XPath patching alone will be a huge boost to modding some day, assuming it isn't already enabled.
Eyo, havent had time to check the game out as im currently out of town. Did you check if you could access the game data via ilspy? Do you think harmony modding is viable? Ill check it out as soon as i get the time.

also theres atleast the xpath dlls available, so im confident that xpath is possible.
Not sure, TBH I haven't set up a C# environment since refreshing my PC. This is what I briefly saw with dotPeek: Image

I'm also busy atm, but I will set up VS and take a closer look soon(TM).
Deathawaits4
Posts: 20
Joined: Mon Mar 01, 2021 9:26 pm

Re: Please dont run obfuscation over the code!

Post by Deathawaits4 »

brucethemoose wrote: Thu Mar 10, 2022 7:48 pm
Deathawaits4 wrote: Thu Mar 10, 2022 6:31 pm
brucethemoose wrote: Thu Mar 10, 2022 5:00 pm So just poking through the game directory for a few minutes before I even open the game, it looks like we have enough access to the Xenko engine to get in trouble... I'm having trouble finding where the actual game mechanics are in the code though. I think I need more coffee.


Also, I'm happy to see lots of data formatted as xml (as opposed to plain text in DW1). XPath patching alone will be a huge boost to modding some day, assuming it isn't already enabled.
Eyo, havent had time to check the game out as im currently out of town. Did you check if you could access the game data via ilspy? Do you think harmony modding is viable? Ill check it out as soon as i get the time.

also theres atleast the xpath dlls available, so im confident that xpath is possible.
Not sure, TBH I haven't set up a C# environment since refreshing my PC. This is what I briefly saw with dotPeek: Image

I'm also busy atm, but I will set up VS and take a closer look soon(TM).
i have also done some deeper investigation into the code now since i have time. First i was extremely optimistic as we got full access to the xenko engine dlls, but after delving a bit deeper, i think we are at a maybe worst case scenario but i cant tell yet. Basically none of the xenko dlls seem to be gameplay relevant, they just provide the backbone but nothing gameplay relevant. I searched everything and everywhere until i checked the .exe. And my fear is, that the whole game logic has been compiled into the exe. It makes sense, as the .exe is pretty big. It can be read with dotpeek and ilspy, but it is insanely obfuscated, so much that reading it is near impossible (honestly id rather try to read assembly). Half of the code in the .exe looks like dummy code to make reading it harder but i found some values that might also point to gameplay specific code.. its hard to tell tho. If you find anything related to real gameplay code, please tell me. I hope this is not a sad turn of events :(
brucethemoose
Posts: 46
Joined: Fri Feb 18, 2022 6:14 pm

Re: Please dont run obfuscation over the code!

Post by brucethemoose »

Deathawaits4 wrote: Thu Mar 10, 2022 8:08 pm
brucethemoose wrote: Thu Mar 10, 2022 7:48 pm
Deathawaits4 wrote: Thu Mar 10, 2022 6:31 pm

Eyo, havent had time to check the game out as im currently out of town. Did you check if you could access the game data via ilspy? Do you think harmony modding is viable? Ill check it out as soon as i get the time.

also theres atleast the xpath dlls available, so im confident that xpath is possible.
Not sure, TBH I haven't set up a C# environment since refreshing my PC. This is what I briefly saw with dotPeek: Image

I'm also busy atm, but I will set up VS and take a closer look soon(TM).
i have also done some deeper investigation into the code now since i have time. First i was extremely optimistic as we got full access to the xenko engine dlls, but after delving a bit deeper, i think we are at a maybe worst case scenario but i cant tell yet. Basically none of the xenko dlls seem to be gameplay relevant, they just provide the backbone but nothing gameplay relevant. I searched everything and everywhere until i checked the .exe. And my fear is, that the whole game logic has been compiled into the exe. It makes sense, as the .exe is pretty big. It can be read with dotpeek and ilspy, but it is insanely obfuscated, so much that reading it is near impossible (honestly id rather try to read assembly). Half of the code in the .exe looks like dummy code to make reading it harder but i found some values that might also point to gameplay specific code.. its hard to tell tho. If you find anything related to real gameplay code, please tell me. I hope this is not a sad turn of events :(
This is what I was afraid of, as I couldn't find any gameplay logic either. Just engine/rendering stuff, mostly. And yeah, the main exe looks like assembly and/or nonsense to me.


I'm hoping its all hidden under some non-obvious name.
Last edited by brucethemoose on Thu Mar 10, 2022 8:23 pm, edited 1 time in total.
User avatar
Erik Rutins
Posts: 39652
Joined: Tue Mar 28, 2000 4:00 pm
Location: Vermont, USA
Contact:

Re: Please dont run obfuscation over the code!

Post by Erik Rutins »

Please see our new modding Roadmap here:

https://www.matrixgames.com/forums/view ... 8#p4969718
Erik Rutins
CEO, Matrix Games LLC


Image

For official support, please use our Help Desk: http://www.matrixgames.com/helpdesk/

Freedom is not Free.
Deathawaits4
Posts: 20
Joined: Mon Mar 01, 2021 9:26 pm

Re: Please dont run obfuscation over the code!

Post by Deathawaits4 »

brucethemoose wrote: Thu Mar 10, 2022 8:20 pm
Deathawaits4 wrote: Thu Mar 10, 2022 8:08 pm
brucethemoose wrote: Thu Mar 10, 2022 7:48 pm

Not sure, TBH I haven't set up a C# environment since refreshing my PC. This is what I briefly saw with dotPeek: Image

I'm also busy atm, but I will set up VS and take a closer look soon(TM).
i have also done some deeper investigation into the code now since i have time. First i was extremely optimistic as we got full access to the xenko engine dlls, but after delving a bit deeper, i think we are at a maybe worst case scenario but i cant tell yet. Basically none of the xenko dlls seem to be gameplay relevant, they just provide the backbone but nothing gameplay relevant. I searched everything and everywhere until i checked the .exe. And my fear is, that the whole game logic has been compiled into the exe. It makes sense, as the .exe is pretty big. It can be read with dotpeek and ilspy, but it is insanely obfuscated, so much that reading it is near impossible (honestly id rather try to read assembly). Half of the code in the .exe looks like dummy code to make reading it harder but i found some values that might also point to gameplay specific code.. its hard to tell tho. If you find anything related to real gameplay code, please tell me. I hope this is not a sad turn of events :(
This is what I was afraid of, as I couldn't find any gameplay logic either. Just engine/rendering stuff, mostly. And yeah, the main exe looks like nonsense to me.


I'm hoping its all hidden under some non-obvious name.
Got some official news!

We can turn off our alarm bells.

Erik answered on steam and they said that most of the code will be made readable:
https://steamcommunity.com/app/1531540/ ... 331888185/

So i guess its just a patience thing :)
swizzlewizzle
Posts: 182
Joined: Sun Mar 16, 2014 4:38 am

Re: Please dont run obfuscation over the code!

Post by swizzlewizzle »

Things are definitely looking up.

XPatching for the XML and full Harmony-based access would be perfect.

Hoping Harmony is integrated into an official mod-loader so we don't have to get people to download external programs to inject it into the game. Bleh.
brucethemoose
Posts: 46
Joined: Fri Feb 18, 2022 6:14 pm

Re: Please dont run obfuscation over the code!

Post by brucethemoose »

swizzlewizzle wrote: Fri Mar 11, 2022 1:26 am Things are definitely looking up.

XPatching for the XML and full Harmony-based access would be perfect.

Hoping Harmony is integrated into an official mod-loader so we don't have to get people to download external programs to inject it into the game. Bleh.
Yes, also this ^.

A number of games have had issues related to externally supplied Harmony.
Post Reply

Return to “Distant Worlds 2”