Upcoming Events

Weekly BMW races on Simracing.GP Weekly BMW races on Simracing.GP Other regular AC events on Simracing.GP Weekly GT3 Sprint Races on Simracing.GP Weekly GT4 Sprint Races on Simracing.GP Daily WTCR races on Simracing.GP

Assembly Editing and Reflexil Instruction

[You may want to sticky this in the mods forum as this is purely a resource thread for modifying the Assembly-CSharp.dll]

ASSEMBLY-CSHARP.DLL

The amount of modding now taking place in the Assembly-CSharp.dll is increasing. Over the last month, my mod, which normally involved changing some random variables, started to become getting more complex, with several new functions being created. As we're currently using ILSPY and REFLEXIL, changing code isn't as simple as writing some C#, but rather altering the 'instructions' and 'opcode' in the dll, altering the code indirectly.

I was talking to Hudson (who many of you may remember did the original blue-flag fix) who taught me how to use these tools, and we talked about storing our changed codes somewhere, mostly for reference, but may benefit some other modders who wish to change their own dlls - or maybe get some more people into modding the game in general.

EDITING THE ASSEMBLY
To edit the Assembly-CSharp.dll you will need:
ILSPY (http://ilspy.net/)
REFLEXIL pluggin for ilspy (http://reflexil.net/)

I'll post below examples of modified code and what they do (I won't show simple number changes, as that would not really be showing anything at all). I'll focus on the areas of the game I have modded as part of my Balance Mod where changes to code has taken place. I won't do them all at once, but when I find time I'll share the code and some insights here.

Others who are modifying this file, please share your work also so we can get a decent database of changes.

UPDATE:

New Editing Techniques

So, when I first started modifying the code, we could really only go one level - via an Injector, I could change some values. Then, one day, we leveled up! Level 2 let us use Relfexil/ILSpy to edit more of the code and begin really making some changes.

This weekend we upgraded to Level 3! We have a new tool provided to us (and thanks to Robery Eady who provided the link). Now we have DNSpy. https://github.com/0xd4d/dnSpy/releases

What's so special about DNSpy? Well, this:

R49IbZLdo.png

Yes! We can now edit the code directly using normal coding methods!

As an example, in just a few minutes, I created that so during a collision, the part chosen is more random.

Original ILSpy
R3vUJgqc4.png


Edited with DNspy
R439hjgha.png


Checking with ILspy that everything is fine!
R436ZRmNY.png


And it works fine!
Race 1:

R3Y7Tcz52.png

R3Y5dvH8Y.png

R3Y3xX60S.png

Race 2:

R42396clE.png

(obviously, damange to these parts isn't going to be added to the mod, but I could have collisions to the rear mean its Rear Wing Damage 20% of the time, and Suspension 50% of the time, and no damage the last 30% of the time)

What this means for the mod

So, now I can edit the code, this means that:

  • I can make far more complex changes.
  • I can make them faster
  • As I am literally changing code, I can copy all my changes into a .txt document. This means that when I have to update the mod to a new dev patch, I can use CTRL+C and CRTL+V to update an entire class, instead of spending an hour having to remake the opcodes!
This means that I can now add as many features as I desire, and I am nearly unrestricted. Because, though I have not began to test it yet, DNSPY has this:

R4myWUclO.png

If I can add classes, I can create entirely new features from scratch. Define new variables, craft new systems. I can make as many rules and manipulate variables however I wish to craft them. This means I can probably make new 'Season Rules', extend the amount of tiers, bascially anything I want.

I still cannot make new "Game Objects", or make new UI, but the scope of watch's acheiveable has probably increased 10-fold. Which is why I asked for wishlists... Anything Code Related is probably now possible. Some things will be simpler then others, but now almost anything is possible.

All this means is that we have New Powers. And more importantly, it means more people are probably going to be able to edit the code themselves (learning opcodes is was a new and long process, but as a mathematician, I can IF and For anything with ease just from seeing examples). This may mean I can get some more collaborators and help making new features!

 
Last edited:
I'll have a look at seeing if mail can be triggered (could probably piggy back on the preseason testing results mail at the very least), all I need to find is what the rollover tooltip calls and see if the mail can call it too.
In the 'next track mails' (which alrarely trigger, no idea why not) there is a bit about a part name which is critical, and a vauge statement about how your car compares to others. No idea how it works it out through, but if you can find that reference, let me know, as I may be able to trace it and see how that's handled (may help with existing issue).
 

BrianUK

So blunt a hammer looks sharp
I think they have a cap to how many times they spawn, I may look at increasing it if it's simple for me, a simpleton, to do as it's a nice bit of flavour for the game.

But, good shout, I'll have a poke around messages/mediareports.
 
Finished the Drivers, Engineers and Mechanics files for 12 teams.
 

Attachments

  • Engineers_12.txt
    15.7 KB · Views: 360
  • Mechanics_12.txt
    28.3 KB · Views: 373
  • Drivers_12.txt
    92.6 KB · Views: 406
Last edited:
I think they have a cap to how many times they spawn, I may look at increasing it if it's simple for me, a simpleton, to do as it's a nice bit of flavour for the game.

But, good shout, I'll have a poke around messages/mediareports.
Granted, as players we may start to ignore it after a while. But there's no need to stop getting it :) strange choive . I like the new one from the chairman about above or below expanded vtatioms a d budget
 
@TheFlamingRed with the change in the way you are working with the assembly.

How much will it affect the way I can change the speeds for example to my prefered values?

Will i be able to edit in the same way? or do i need to learn a new process?
 
@TheFlamingRed with the change in the way you are working with the assembly.

How much will it affect the way I can change the speeds for example to my prefered values?

Will i be able to edit in the same way? or do i need to learn a new process?
youll probably need to learn the new Spy.

Now I can edit the values in the Array in.... somewhere. Which means I don't need to make a new IF state,met to achieve the same. But seriously, download and play with it ) you'll see it's 10x better and easier
 
Indeed, I can make it so you have negative marketability and you have to pay the sponsors to 'convince' them to put their brand on your car if I desired.... hmmm... I think I'll add that in to 1.31e :)
 
youll probably need to learn the new Spy.

Now I can edit the values in the Array in.... somewhere. Which means I don't need to make a new IF state,met to achieve the same. But seriously, download and play with it ) you'll see it's 10x better and easier
Can you add the download link to the first post ?
 
dnSpy really is great isn't it :)

A few ideas I had...

- Can we make the AI strategies better in wet weather? Right now they seem to stick too rigidly to a predefined strategy and undervalue the importance of being on the right tyre at the right time.

- On a related note, can we make the AI pay attention to weather in qualifying? Right now they just ignore it and often get screwed over. This is a particular problem in 3-stage qualifying where the AI cars a few places above the cutoff point don't bother doing another lap if the weather has improved.

- Could more randomness be introduced in the car performance for a new season? Maybe it's just my luck but the pecking order in the top series at least seems to remain pretty constant over time. In real life teams sometimes make big steps forward or back between seasons and I feel like that's missing in the game.

I haven't tried the balance mod so forgive me if this stuff has already been improved.
 
dnSpy really is great isn't it :)

A few ideas I had...

- Can we make the AI strategies better in wet weather? Right now they seem to stick too rigidly to a predefined strategy and undervalue the importance of being on the right tyre at the right time.

- On a related note, can we make the AI pay attention to weather in qualifying? Right now they just ignore it and often get screwed over. This is a particular problem in 3-stage qualifying where the AI cars a few places above the cutoff point don't bother doing another lap if the weather has improved.

- Could more randomness be introduced in the car performance for a new season? Maybe it's just my luck but the pecking order in the top series at least seems to remain pretty constant over time. In real life teams sometimes make big steps forward or back between seasons and I feel like that's missing in the game.

I haven't tried the balance mod so forgive me if this stuff has already been improved.
It's located in SessionAIOrders but I've not studied it much. I assume the devs will fix this one day so it's a low priority for me, though it would be nice to fix. It's a shame I have such a massive wish list.

This covers both points 1 and 2.

And yes, randomness or even new performance 'modes' have been discussed in the wishlist of the balance mod thread. :) still mostly in the experiment phase ATM.
 
I've been following this thread and other mods now. Specially TFR's mod.
Despite all this changes, I was planning to play the game without this mods.
Only making one change.
The reliability system of the vanilla game ruins it. Especialy the values in the start of the season.
So I was thinking to make some changes on this aspect.
What I thought is to raise the initial reliability of the original parts on the new season (only this would make the game a lot better).
The second part, would be changing the degradation of the parts during the race.
Spliting the parts in two groups (wings and the other parts).
The idea is to remove the gradual degradation of the wings. Making them only lose reliability on accidents or when you get those messages when they lose some more (but happening with one or two cars per race).
This would take 40% or more of the part reliability. And the AI would be able to go to the pit to repair it.
The other parts would keep the gradual degradation, but the AI would not be able to repair it.

Its a bit different from what I've seen on other mods.
I don't have experience with modding and i don't know if we're able to make those changes.
But if anyone could help me, showing how to make those changes I would be grateful.
 
Can someone point me to the method in the assembly file where the tech decay is coded?
and also the "-20*Team Star Level" on new parts?

I love the mod, but I'd like to disable these two things.
 
Top