Enhanced Balance Mod for 3.x

Did you create a mod, map, music, or a tool? Present them here and earn feedback!
Note: addon requests do not belong here.
Note, everything uploaded to this forum, MUST have a license!
Post Reply
MIH-XTC
Trained
Trained
Posts: 368
Joined: 31 Jan 2014, 07:06

Re: Enhanced Balance Mod for 3.x

Post by MIH-XTC »

Cyp wrote:
MIH-XTC wrote:I need to change some things in stats.cpp, statsdef.h and the QT scripts to implement the below.
What's the best way to submit that to you?

The best way would probably be making a ticket with a patch, or at least a link to your repository, if you have/make one. Or something like that.

Okay. I did create a GitHub account a few months ago but I haven't taken the time to become familiarized with it. How do I keep my forked version up to date with commits from other people? I would think that's what a "pull request" is but from what I've read, a "pull" request is how one "pushes" their changes... (Shouldn't a pull request be called push request?)

I did a practice commit a few days ago to see if I was doing it right
https://github.com/CalculusWZ/warzone21 ... 86b02c2137

Did you get notified of that?
Cyp
Evitcani
Evitcani
Posts: 784
Joined: 17 Jan 2010, 23:35

Re: Enhanced Balance Mod for 3.x

Post by Cyp »

Oh, yes, I had actually seen that test commit. I didn't get notified of it, but I happened to have seen via https://github.com/Warzone2100/warzone2100/network .

You keep your version up-to-date by pulling from the main repository or from other people. With a command line, one would usually do «git fetch origin» followed by «git rebase origin/master» or «git merge origin/master». Rebasing keeps the history cleaner, but merging is better if other people are also working on your branch. For now, I think rebasing is probably better.

You can push changes to a server (you → server), and pull changes from a server (you ← server). A “pull request” is a GitHub term which means to request that someone pulls from your server (from your GitHub repository, that is).

After someone pulls your changes to their computer, they might then push to their public server/repository, so maybe they should be called “pull then push request”s. Although I think GitHub does something a bit weird, where GitHub does the pulling via the web interface, instead of your computer pulling and pushing. Anyway, I don't really know of a better word to describe whatever it is GitHub does.
MIH-XTC
Trained
Trained
Posts: 368
Joined: 31 Jan 2014, 07:06

Re: Enhanced Balance Mod for 3.x

Post by MIH-XTC »

I have to stop here for now, I'm back in school full-time until Christmas and won't have time to do anything with WZ. I just wanted to post the deliverables I have for the time being.

On a side note, I'm taking 2 data analytics classes, one using Excel and the other is advanced analytics using R studio and Python. Last week we were analyzing data from .json files and I was the only one in the class who knew what .json was so at least my WZ experience has a little bit of carry over in the real world :).
Attachments
Stats Editor.zip
Editor used for making mod
(1.38 MiB) Downloaded 250 times
10c-EB-Sample.wz
Sample Map with mod
(78.3 KiB) Downloaded 234 times
EB.wz
Modded Files (13 text files)
(44.93 KiB) Downloaded 243 times
MIH-XTC
Trained
Trained
Posts: 368
Joined: 31 Jan 2014, 07:06

Re: Enhanced Balance Mod for 3.x

Post by MIH-XTC »

I've still been working on this over the past 6 months and wanted to post an update.

Thus far I haven't touched the templates.json file because I didn't think there was much to be done there but after trying to figure out how to get the AI to make the newly implemented Helicopter propulsion I got really detoured and now I'm working on making an AI.

WOW what a difference it makes when the AI makes the best units available... it's no wonder the AI plays so bad, they're currently making silly units. They're making viper flamer when they could be making cobra minipod... I didn't know telling the AI which units to make was as simple as listing them in the tmp[] array and adjusting the MAX_RANDOM_TEMPLATES as necessary. So I used the stats editor to make an additional 70 templates in templates.json and then ordered them from worst to best. It's now much easier to showcase changes to the stats when the AI can demonstrate them for you :lol2:
Spoiler:
I also created the sensorDroid event in Nexus.slo. I see someone created the array in the .vlo file but there wasn't a corresponding event in .slo. It has a 50/50 chance of picking from the two best sensor choices so that AI can make CB turret and wide sensor at same time.

So now I'm going off in this direction...

I also wasn't aware that non-fatal errors were being logged in the log files... I just assumed if WZ had a problem it would crash. I found that the map I was using to test was causing some infinite loops, I think from excessive research centers but I fixed all errors with this mod (not sure if it was throwing any before).

I just wanted to give an update because working on the AI I feel that someone may be working on similar things or might have advice.

This is where I'm currently at with .slo and .vlo files:

https://www.diffchecker.com/KrNKqT3Y
https://www.diffchecker.com/yDwuEsym
Attachments
nexus.vlo
(19.85 KiB) Downloaded 209 times
nexus.slo
(116.5 KiB) Downloaded 203 times
MIH-XTC
Trained
Trained
Posts: 368
Joined: 31 Jan 2014, 07:06

Re: Enhanced Balance Mod for 3.x

Post by MIH-XTC »

Elaborating a little bit further… I’m going to create a test AI that

• spams cyborgs/tanks in groups of 10 and eliminate any notion of defending (just for the time being. ). When the AI spams sensor droids and turrets with good range they can be challenging to play and it seems like simple behavior to default to.

• Get rid of this behavior where AI runs past enemy droids and suicides. All combat AI units should move in “patrol” mode but attack towards enemy base. They should stop or maintain proper attacking distance.

• There isn’t a buildResearchCenter event like there is buildPowerGenerators so I’ll create one and ensure num_resCenters >= (num_derricks / 3). The AI needs to have good researching behavior. Researching should also be the only cost inducing activity when current power is below LOW_POWER with the exception of a few scenario’s when building a base.

• Need to figure out how to make VTOL’s attack anything and everything in sight (namely droids) or add DROIDs to the vtolTarget[] array. Just like ground units I only want to spam bomb VTOL’s.

• Import and order all of the missing structure and research stats into the tech[], structs[], defStructs[], and wallWeaps[] arrays in the .vlo file.

• Set the research order for all weapon lines and import into arrays.
MIH-XTC
Trained
Trained
Posts: 368
Joined: 31 Jan 2014, 07:06

Re: Enhanced Balance Mod for 3.x

Post by MIH-XTC »

Status update:

Nexus AI can play very well in all circumstances but is slightly susceptible to rush. I’m very happy with the performance of the AI though, just by doing tests in large games you can see a huge difference in simulation.

Now that Nexus AI is fully updated I can say I’m finally done with this mod, the only thing left to do is update the research messages if there is consensus about adding range upgrades and cyborg engine upgrades to the stats.

I’m not even going to try and explain the specific changes because explaining the logic is way too verbose and I think we can rely on empirical observations from testing. I’ll just summarize by saying that base building is more costly and lengthy, research is more costly, the tech tree is “thicker” (more choices at any given time) and the speed of the game is more progressive.

Testing can be done by playing with Nexus on any map/settings. I’ve attached one sample map with the mod.

This took me a long time to perfect over the past 14 months, I think it’s the best version of WZ gameplay I can make. I basically audited every aspect of the stats and Nexus AI to ensure things are optimized. I’m intimately familiar with every line in every file and have ran thousands of manual tests. I’m still kind of adamant about using these stats for mp because I think the current stats are too deterministic in the sense that it’s too easy to identify the optimal strategy decisions. I think what I have is more complex while preserving the traditional WZ feel. Please tell me what you think.


MOD is only compatible with version 3.2.x
There are no known bugs.
Attachments
10c-AAAA.wz
GPL 2.0
A sample map used for testing and observing balance changes
(114.77 KiB) Downloaded 196 times
EB-v2.wz
GPL 2.0
EB Mod
(92.63 KiB) Downloaded 236 times
MIH-XTC
Trained
Trained
Posts: 368
Joined: 31 Jan 2014, 07:06

Re: Enhanced Balance Mod for 3.x

Post by MIH-XTC »

Attaching the stats editor I used to make the stats above. It's an Excel spreadsheet that generates the .json stat files (for those who haven't seen yet). It essentially contains the change log if you want to reference the specific values I changed or how to go about creating your own stats. I never did post a functioning version of the editor for the base campaign, only mp and by then it already contained my own changes. It would take a couple of hours to get a clean functioning version for the base campaign but not sure if anyone is interested in it. Here's a sample screenshot of weapons.json to give you an idea of how much easier it is to modify the stats in a spreadsheet then it is in a text editor.

Image
Attachments
WZ Stats Editor for v3_2.zip
Stats Editor for version 3.2.x only
(1.64 MiB) Downloaded 196 times
MIH-XTC
Trained
Trained
Posts: 368
Joined: 31 Jan 2014, 07:06

Re: Enhanced Balance Mod for 3.x

Post by MIH-XTC »

Maybe taking side-by-side screenshots of mod vs no mod is the best way to demonstrate changes. I just simulated two games with the same settings mod vs no mod and took screenshots when one of them approached the end. I think I'll be taking a lot more of these because it's easier to explain things.

Game settings were 5v5 NTW, T1 no base, shared research

Before: Original Nexus AI
Image

After: Updated Nexus AI + stats
Image

After2:
Image

I think I can get rid of cheat research for Nexus AI now. It's not needed if it has intelligible research objectives.
MIH-XTC
Trained
Trained
Posts: 368
Joined: 31 Jan 2014, 07:06

Re: Enhanced Balance Mod for 3.x

Post by MIH-XTC »

Maybe an array of screenshots is even better.

This game was rubber T1, no base, no shared research, Nexus AI's playing vs each other.

Accidentally finished one of the games and missed the last screenshot

Image
User avatar
Prot
Trained
Trained
Posts: 242
Joined: 29 Nov 2010, 12:41

Re: Enhanced Balance Mod for 3.x

Post by Prot »

Cannot testing this mod.
Trying this mod on 3.2.1, 3.2.2 and latest master git, i allways getting sigfault after loading map.

Code: Select all

$ ./src/warzone2100 
info    |02:27:12: [realmain:938] Using /home/prot64/.warzone2100-master/logs/WZlog-0412_142712.txt debug file
*** Error in `./src/warzone2100': free(): invalid pointer: 0x0000000005100022 ***
MIH-XTC
Trained
Trained
Posts: 368
Joined: 31 Jan 2014, 07:06

Re: Enhanced Balance Mod for 3.x

Post by MIH-XTC »

Prot wrote:Cannot testing this mod.
Trying this mod on 3.2.1, 3.2.2 and latest master git, i allways getting sigfault after loading map.

Code: Select all

$ ./src/warzone2100 
info    |02:27:12: [realmain:938] Using /home/prot64/.warzone2100-master/logs/WZlog-0412_142712.txt debug file
*** Error in `./src/warzone2100': free(): invalid pointer: 0x0000000005100022 ***
I had no idea this mod did not work for unix users, I use Windows for modding. Thanks for letting me know of this error. Berg was kind enough to test this mod for me and he also got segfault on munmap_chunk() which has to do with unix OS not WZ. I'll have to investigate why this mod does not work for linux. I only use linux VM in VirtualBox to work on source code.

I like playing with your bot because it's good to train with and improve mine. I simulated 30 - 40 T1 no base 3v3 games with your bot on 7c-Lowlife map. Your bot almost always wins because it's designed for rush strategy but this is good because I can keep tweaking mine until it's rush proof without compromising long game strategies. I started looking at your code for the first time a couple of days ago to see how you build fortifications on furthest oil first using sortByDistance(), it's nice behavior. It's impressive if you were able to make your bot from scratch. Your bot also has good repair behavior, one time I saw your bot use 10 - 15 mg wheels + repair droids to beat 15-20 grenadiers because they repaired faster than they took damage. It was really cool to see an AI use a strategy how it's supposed to work. I want to play 5v5 with your bot on big maps but it lags too much :(.
MIH-XTC
Trained
Trained
Posts: 368
Joined: 31 Jan 2014, 07:06

Re: Enhanced Balance Mod for 3.x

Post by MIH-XTC »

The below mod should work now for UNIX users.

I just found the scripting manual for the first time last week...


Why didn't someone point this out earlier?

You guys are crazy for trying to convert WZscript to Javascript. I understand that you're trying to make the game more extensible but there are so many things that are obviously broken with Nexus that if you just fixed them then you wouldn't have the perceived problems. There's not much point to make WZ extensible but rather it's more like you just fix it and be done with it. Anyways it's already too late, I already fixed most of the Nexus behavior flaws in < 1 month. This bot will smash all other current and foreseeable bots most of the time with the exception of certain small map, low oil rush games. It's designed to be a generic bot capable of playing all scenarios using a variety of research paths. I removed cheating for Nexus, it doesn't need cheat now that it knows how to research, repair, build a base and attack properly.

for quick reference to AI changes
Nexus.slo
https://www.diffchecker.com/XN2GOqxM

Nexus.vlo
https://www.diffchecker.com/gJ6GQgC2

This is the best AI and stats this game will ever see, worthy of a release itself. Please let me know.
Attachments
EB.wz
(96.71 KiB) Downloaded 193 times
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Enhanced Balance Mod for 3.x

Post by NoQ »

To me, some of the biggest flaws of Nexus included inability to counter spam (tank spam, cyborg spam, tower spam, machinegun spam, rocket spam) by countering them with tech and production choices, and also inability to group up units before engaging in combat. Most of NullBot's complexity is about these features. Note that the former is quite useless in AI vs AI matches, because AIs already avoid spam strategies, but newbie humans don't, and the primary sense of having good AIs is to teach humans to play better. At the same time, winning AI vs AI matches is a good achievement, but i suspect i could easily provide a NullBot personality (~100 lines of code) that would be better than your AI on your test cases (given the test cases); if i was younger and had more time, maybe i would even try to bet that i could have done it on a weekend. Note also that NullBot, with all these features and many other human-oriented tweaks (eg. varied gameplay, and also chat support) has less lines of code than the current Nexus AI, and you are already adding 2000 more lines of code with your patch. From just that i'd conclude that my language choice was correct, and it is a consistent observation that javascript code is generally ~4 times shorter for the same amount of features (we notice it in the campaign as well).

That said, i appreciate your work and i'd approve adding your AI to the game (as long as it's using the base game's data and works without your data mods), probably as an extra AI alongside Nexus if we want to keep Nexus available as a nostalgic "like the old times" option (i personally don't enjoy having Nexus around, so i'd approve replacement as well).
User avatar
Prot
Trained
Trained
Posts: 242
Joined: 29 Nov 2010, 12:41

Re: Enhanced Balance Mod for 3.x

Post by Prot »

Did i understand correctly, you nexus now playing in normal game, without modifying researches and units stats?
User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 938
Joined: 26 Sep 2016, 19:56

Re: Enhanced Balance Mod for 3.x

Post by Berserk Cyborg »

MIH-XTC wrote:This bot will smash all other current and foreseeable bots most of the time with the exception of certain small map, low oil rush games.
Naturally. How can you expect other AI, which are only 'balanced' in regards to the base game, to be anywhere near as good as your bot when introduced to all of your changes? It is totally unfair to make that judgement unless the other bots are tweaked for your balance. Anyway, the modified Nexus AI you included is amazing none the less.
Post Reply