Jump to content
Age of History Games

Recommended Posts

0% AI aggressiveness

 

Menu_CreateNewGame_Options_v2

Find the first line with the word AI_AGGRESSIVENESS in it

The two lines above it will be

const/16 v16, 0x32 (0x32 is the min ai aggressiveness written in hexadecimal)

   const/16 v17, 0x190 (0x190 is the max ai aggressiveness written in hexadecimal)

Change 0x32 to 0x0

Edited by Lipark Japanese modder

Share this post


Link to post
Share on other sites

3 hours ago, Dyndyk Dudun said:

sorry, it's a translator English isn't my native language. I would like to ask through what programm I can edit code on a PC version

I have the exact same question as you. I want to edit code on PC, not Android.

Share this post


Link to post
Share on other sites

2 hours ago, Chairman Baad said:

I have the exact same question as you. I want to edit code on PC, not Android.

 

10 hours ago, Dyndyk Dudun said:

Can you make a similar guide for a PC? Because I can't find a suitable file manager similar to Mt Manager

・To edit it on pc, you need to extract smali from dex file

 first, open --- file (recommanded took is unzip. --- is a zip-styled file) and pull out classes.dex

・next, extract smal files from dex file

recommanded tool ・・・dex2smali 

Share this post


Link to post
Share on other sites

Just now, Lipark Japanese modder said:

 

・To edit it on pc, you need to extract smali from dex file

 first, open --- file (recommanded took is unzip. --- is a zip-styled file) and pull out classes.dex

・next, extract smal files from dex file

recommanded tool ・・・dex2smali 

I was actually thinking of editing the EXE file since it has Java code in it.

Share this post


Link to post
Share on other sites

Is there a way to modify the economy growth to absolute zero so that it never increases or decrease regardless of any variable because changing it via the Ages.json file doesn't seem to work for me

Share this post


Link to post
Share on other sites

13 hours ago, Chairman Baad said:

I was actually thinking of editing the EXE file since it has Java code in it.

The .jar (aka .exe) file has compiled classes inside it, which need to be decompiled first before you can do any serious changes to them. There are several offline decompilers to do so (I use CFR), use them instead of the 500 trillion nearly identical online decompilers, and because of the complete mess of code Lukasz left behind, not all files may decompile properly (CFG.java has a quite important function that doesn't decompile, at least with CFR).

BTW, decompile the entire .jar (decompiling just a single class doesn't work properly when doing so), and also copy the original classes to the directory where you have your code, with the same code structure (overwrite if asked). Also, back up the original code files in another folder so you can reset in case things go really wrong.

Edited by Valixor

Share this post


Link to post
Share on other sites

Oh ur great!

How to change AI abilities like war declaring, declaring independence, changing government, changing relation, Sending ultimatum, making allies, offering a union, offering other things etc.

These are so important for my future mod because AI and player should do anything with events in my mod.

Share this post


Link to post
Share on other sites

23 hours ago, Valixor said:

The .jar (aka .exe) file has compiled classes inside it, which need to be decompiled first before you can do any serious changes to them. There are several offline decompilers to do so (I use CFR), use them instead of the 500 trillion nearly identical online decompilers, and because of the complete mess of code Lukasz left behind, not all files may decompile properly (CFG.java has a quite important function that doesn't decompile, at least with CFR).

BTW, decompile the entire .jar (decompiling just a single class doesn't work properly when doing so), and also copy the original classes to the directory where you have your code, with the same code structure (overwrite if asked). Also, back up the original code files in another folder so you can reset in case things go really wrong.

So have you succeeded in recompiling the codes?

We are facing, like, 1000+ compiling errors...

Share this post


Link to post
Share on other sites

1 hour ago, Magolor said:

So have you succeeded in recompiling the codes?

We are facing, like, 1000+ compiling errors...

Yup, enough so to add a color randomization feature to the WotEC mod.

When doing your compiling, make sure your current folder is the root (whatever you named it), which should have "age", "com", "javazoom" and a couple of other folders in it, if you extracted the entire .jar into the root folder. Just one of the "features" there of the default Java compiler (javac), if the folder you are working in is .../[root]/age/of/.../lukasz, then the classpath is .../[root]/age/of/.../lukasz/age/of/.../lukasz... which doesn't exist.

Also, have all your source files in one folder, just to better organize things. I'll do my best to assist you if any more problems appear.

P.S. There's a very versatile program called Bytecode Viewer (BCV), official link: https://bytecodeviewer.com/, with several kinds of decompilers, including CFR, which I'm not fully familiar with yet (that is, with BCV). The best thing is that you don't have to screw with Command Prompt or something to compile your classes, though, use at your own risk, and always keep backups!!! You'll have to provide the javac executable path (which should be somewhere in the JDK installation folder) if you want to compile in BCV.

Edited by Valixor

Share this post


Link to post
Share on other sites

1 hour ago, Valixor said:

Yup, enough so to add a color randomization feature to the WotEC mod.

When doing your compiling, make sure your current folder is the root (whatever you named it), which should have "age", "com", "javazoom" and a couple of other folders in it, if you extracted the entire .jar into the root folder. Just one of the "features" there of the default Java compiler (javac), if the folder you are working in is .../[root]/age/of/.../lukasz, then the classpath is .../[root]/age/of/.../lukasz/age/of/.../lukasz... which doesn't exist.

Also, have all your source files in one folder, just to better organize things. I'll do my best to assist you if any more problems appear.

P.S. There's a very versatile program called Bytecode Viewer (BCV), official link: https://bytecodeviewer.com/, with several kinds of decompilers, including CFR, which I'm not fully familiar with yet (that is, with BCV). The best thing is that you don't have to screw with Command Prompt or something to compile your classes, though, use at your own risk, and always keep backups!!! You'll have to provide the javac executable path (which should be somewhere in the JDK installation folder) if you want to compile in BCV.

Thank you so much for your reply.

We are actually stuck at the decompilation: as you mentioned, the CFR decompiler failed to decompile tons of codes. How did you fix them? Have you manually changed all the codes that failed to decompile? Before this, we tried decompiler jd-gui, Jadx, as well as IDEA. They were able to decompile codes without reporting errors but those codes are filled with bugs and could not compile.

Share this post


Link to post
Share on other sites

1 hour ago, Magolor said:

Thank you so much for your reply.

We are actually stuck at the decompilation: as you mentioned, the CFR decompiler failed to decompile tons of codes. How did you fix them? Have you manually changed all the codes that failed to decompile? Before this, we tried decompiler jd-gui, Jadx, as well as IDEA. They were able to decompile codes without reporting errors but those codes are filled with bugs and could not compile.

I couldn't just fill in the parts that failed to compile, they amount to a pretty significant number of code. Also, the parts that failed are pretty important for AoH's functioning, such as dialog_True() in CFG.java, which performs (to my knowledge) all affirmative dialog actions, and moveAtWar() in AI_Style.java, which has all the code for when the AI should move during a war.

CFR probably failed because of the size of the code file, and the numerous layers of spaghetti code. Not many decompilers can handle what ends up being 5,000+ lines of code. The remaining files that did decompile can be edited and recompiled as normal, assuming there's no syntax or other errors and the classpath is correct. I'll try some other decompilers and see if their final output can compile on my part...

P.S.: Successfully decompiled the CFG class with FernFlower decompiler in BCV, then manually replaced the part that failed to decompile with the FernFlower code (with some slight modifications to remove duplicate variables) and successfully compiled it too. So far, no issues to report. Gonna try AI_Style next, something CFR also has serious problems with. Looks like some cases of mixed-decompiler code are not a problem.

Edited by Valixor

Share this post


Link to post
Share on other sites

13 minutes ago, Valixor said:

I couldn't just fill in the parts that failed to compile, they amount to a pretty significant number of code. Also, the parts that failed are pretty important for AoH's functioning, such as dialog_True() in CFG.java, which performs (to my knowledge) all affirmative dialog actions, and moveAtWar() in AI_Style.java, which has all the code for when the AI should move during a war.

CFR probably failed because of the size of the code file, and the numerous layers of spaghetti code. Not many decompilers can handle what ends up being 5,000+ lines of code. The remaining files that did decompile can be edited and recompiled as normal, assuming there's no syntax or other errors and the classpath is correct. I'll try some other decompilers and see if their final output can compile on my part...

Thank you.

So you are saying that, we could just ignore all the compile errors, and then directly use the corresponding compiled files from correctly decompiled codes? Does replacing a single .class file really work for AoC2.jar?

Share this post


Link to post
Share on other sites

1 minute ago, Magolor said:

Thank you.

So you are saying that, we could just ignore all the compile errors, and then directly use the corresponding compiled files from correctly decompiled codes? Does replacing a single .class file really work for AoC2.jar?

Yup! A .jar file is basically a collection of class files, plus some other supporting code and information. Changing a few variables or adding independent functions (those that don't affect other code files) and compiling the resulting file won't directly affect other class files.

Share this post


Link to post
Share on other sites

1 minute ago, Valixor said:

Yup! A .jar file is basically a collection of class files, plus some other supporting code and information. Changing a few variables or adding independent functions (those that don't affect other code files) and compiling the resulting file won't directly affect other class files.

However, just a few hours ago, I tried to move an android-based mod to PC, by turning classes.dex -> classes.jar using dex2jar, and then replace the files of AoC2.jar on PC. However, the game could be run (which was really suprising), but it could not function correctly: tons of bugs such as “Next Turn” failure, "Recruit" failure... occurred.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...