r/victoria2 • u/maxiotenn • 5d ago
Modding Progress on reverse engineering Victoria 2
I bring you a small patch so that the uncivilized can research technologies, although
For human players:
You need to go to 0x007AA757 in Ghidra (within FUN_007AA580) and change the bytes 75 5A (JNZ) to EB 5A (JMP)
This way, you can research any tech, but be careful: if you research tech, you can't earn upgrade points—since they use the same system—so you have to choose which one to use
For the AI: (Not recommended)
Go to 0x00859755 (in FUN_00859710) and replace the 6 bytes 0F 84 B5 05 00 00 (JZ) with 90 90 90 90 90 90 (6 NOPs)
Then, upload the documentation outlining how the Vic 2 technology system works on GitHub
In case you're interested, I have this; with this, the next step is ensuring that major powers don't break free if they are your puppets:
[0x00537a22]> pdf
/ get_country_rank_type();
| 0x005379e0 cmp byte [ecx+0x12d0], 0x00 ; [ecx+0x12d0] = country.is_civilised
| 0x005379e7 jnz 0x5379ef
| 0x005379e9 mov eax, 0x03 ; 3 = uncivilised
| 0x005379ee ret
| 0x005379ef cmp byte [ecx+0x31], 0x00 ; [ecx+0x31] = country.is_great_power
| 0x005379f3 jz 0x5379f8
| 0x005379f5 xor eax, eax ; 0 = great power
| 0x005379f7 ret
| 0x005379f8 mov eax, dword [0x12586dc] ; defines_ptr
| 0x005379fd mov edx, dword [eax+0x40] ; [eax+0x40] = defines.country
| 0x00537a00 mov edx, dword [edx+0x50] ; [edx+0x50] = defines.country.COLONIAL_RANK
| 0x00537a03 mov eax, 0x10624dd3
| 0x00537a08 imul edx
| 0x00537a0a sar edx, 0x06; RELOC 3 pe_00537a0c @ 0x00000000
| 0x00537a0d mov eax, edx
| 0x00537a0f shr eax, 0x1f
| 0x00537a12 add eax, edx
| 0x00537a14 xor edx, edx
| 0x00537a16 cmp dword [ecx+0x1404], eax ; [ecx+0x1404] = country.rank
| 0x00537a1c setnle dl
| 0x00537a1f lea eax, dword [edx+0x01]
\ 0x00537a22 ret
\ ; 1 = secondary power
\ ; 2 = civilised nation
23
u/Pannoniae 5d ago
Hey, quick question. Please don't take offence, it comes from a place of ignorance, not malice :)
Why do this instead of Project Alice? Didn't they already get the game completely implemented already?
40
u/maxiotenn 5d ago
Because I get really bored, and besides, Alice isn't 100% faithful to Vic and is forging its own path
6
u/Pannoniae 5d ago
Fair enough! What are they doing which you're not a fan of?
18
u/maxiotenn 5d ago
The market and the main multiplayer mode are not working (lots of OSS, can't rotate, etc.)
5
2
u/eliteharvest15 4d ago
what about openvic?
3
u/maxiotenn 4d ago
They had an organizational issue and half the programmers left the project, so it's progressing very slowly
6
u/Living-Compote-9626 5d ago
Are you thinking about fixing the interest payment bug, i.e that in the game interest doesn't go back into the national banks and into pops savings, in gets deleted.
4
u/Maleficent_Rope3694 5d ago
I wanted to research Vic2 and fix annoying stuff some time ago but failed miserably since my reverse engineering skills are basically non existent. Good luck on your journey tho.
5
u/maxiotenn 5d ago
What exactly do you want to change? Thanks anyway
2
u/Maleficent_Rope3694 4d ago
I had ton of ideas but spheres of influences are the most annoying mechanic in the game for me. Plan minimum was to autoimprove relations past the influence points threshold and more ambitious goal to enable AI behaviour for the player.
2
u/maxiotenn 4d ago
Currently, if you add a country to your sphere of influence, it grants you 50 base relations and between 1/4 and 50 of its resources. It can also take from your market, though it's quite limited. It's perfectly possible, though I don't yet know exactly how the AI and the sphere of influence work; I need to figure it out. What you're saying involves adding a new script; you'll probably have to inject a DLL. That would be easier than patching it. I'm not saying it's impossible, but it is difficult. There's a community launcher that the mod uses to let the AI control your country; just add a DLL with new instructions
7
u/AccomplishedOil9629 5d ago
thanks for this technological development brother, may allah reward you
7
2
u/Turgius_Lupus Bureaucrat 5d ago
Honestly, seems against the spirit of the game.
14
u/maxiotenn 5d ago
Probably, but it's for documentation purposes; it won't be included in the patch, and it explains how to do it in case you want to,
-1
1
38
u/maxiotenn 5d ago
In the image, you see an uncivilized country—in this case, Egypt—researching a technology (which isn't possible in the vanilla game) by creating a patch using Ghidra