[3.1+] NullBot: an adaptive skirmish AI

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!
themac
Trained
Trained
Posts: 415
Joined: 17 Jul 2009, 19:14
Location: Germany

Re: [3.1+] NullBot: an adaptive skirmish AI

Post by themac »

You are my hero today ^^
cue
Trained
Trained
Posts: 59
Joined: 06 Nov 2011, 00:12

Re: [3.1+] NullBot: an adaptive skirmish AI

Post by cue »

We are 3 humans vs 4 AIs in a very open oil rich map.
But the AI units keep getting stuck as can be seen on the screen shot.
They start out with heavy attacks but then they kinda stop because they are all stuck.

I have not seen any slowdowns even if there are that many units.
wz2100-20120826_212342-DesertNew-T1.jpg
wz2100-20120826_212350-DesertNew-T1.jpg
wz2100-20120826_212400-DesertNew-T1.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: [3.1+] NullBot: an adaptive skirmish AI

Post by NoQ »

I cannot fix stuck units, it needs to be fixed on the game side (unit movement/pathfinder micro-ai). I do have some limited workarounds, but themac will rape me for sure if i try to improve them further. Well, i could have a look again ...
I have not seen any slowdowns even if there are that many units.
Heh, with the amount of units in themac's savegame i have slowdowns even without any AIs at all (:
cue
Trained
Trained
Posts: 59
Joined: 06 Nov 2011, 00:12

Re: [3.1+] NullBot: an adaptive skirmish AI

Post by cue »

NoQ wrote:I cannot fix stuck units, it needs to be fixed on the game side (unit movement/pathfinder micro-ai). I do have some limited workarounds, but themac will rape me for sure if i try to improve them further. Well, i could have a look again ...
I have not seen any slowdowns even if there are that many units.
Heh, with the amount of units in themac's savegame i have slowdowns even without any AIs at all (:
We will rape you if you dont! :)
Lets hope the developers find a way to fix this. Should I report this to someone?

Our hardware is good, i7, i5 and a good AMD. perhaps that is why we dont have slowdowns?
What does hardware does themac have?
themac
Trained
Trained
Posts: 415
Joined: 17 Jul 2009, 19:14
Location: Germany

Re: [3.1+] NullBot: an adaptive skirmish AI

Post by themac »

My iMac is an Intel Core i7 CPU that works between 2.8 and 3.8 Ghz. When the choppy play begins, the overall fps shown by Warzone are still high (>100)!
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: [3.1+] NullBot: an adaptive skirmish AI

Post by NoQ »

Should I report this to someone?
It was already reported a lot. It annoys human players as well: units just don't move out of the way when they meet other units.
the overall fps shown by Warzone are still high
Frames are not drawn, and the game doesn't proceed at all when the AI is thinking.
themac
Trained
Trained
Posts: 415
Joined: 17 Jul 2009, 19:14
Location: Germany

Re: [3.1+] NullBot: an adaptive skirmish AI

Post by themac »

Ah, yes, I remember. ^^

Maybe calculating 30 forces on the whole map doesn´t hurt the game much, but the more of them are on the war zone, the more the delay increases.

To keep WZ running smooth it would probably be an idea not to calculate all forces in the game every time every moment, but a decent maximum of them each second. After an hour there may be 300 units lurking around, so calculate 30 (for example only) in a second and the next 30 in the next second and so on. It will of course take 10 seconds until all units have been calculated, but stuttering will probably be avoided. :)
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: [3.1+] NullBot: an adaptive skirmish AI

Post by NoQ »

not to calculate all forces in the game every time every moment, but a decent maximum of them each second
I'm already doing it in quite a few places. But in some places the whole picture needs to be seen anyway.
themac
Trained
Trained
Posts: 415
Joined: 17 Jul 2009, 19:14
Location: Germany

Re: [3.1+] NullBot: an adaptive skirmish AI

Post by themac »

As far as I understood it is hard to make NullBot Multithreading? So maybe it would be possible to make two seperate NullBot files that can each use its own thread of the CPU. One works on the half map, and the other one on the other half. One of them (or a third one) can then take both results together. :)
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: [3.1+] NullBot: an adaptive skirmish AI

Post by NoQ »

It won't help cause every piece of lag is still produced by a single piece of AI, while others are not doing anything during this time. Also, i don't think multi-threading is possible at all in JavaScript.

I've got a rough idea on what to do though, so when i release the next version, i'll be looking forward to analyzing another savegame (:
User avatar
Duha
Trained
Trained
Posts: 287
Joined: 25 Mar 2012, 20:05
Location: SPb, Russia

Re: [3.1+] NullBot: an adaptive skirmish AI

Post by Duha »

NoQ wrote:It won't help cause every piece of lag is still produced by a single piece of AI, while others are not doing anything during this time. Also, i don't think multi-threading is possible at all in JavaScript.
May be some of multithreading is inside queue
I've got a rough idea on what to do though, so when i release the next version, i'll be looking forward to analyzing another savegame (:
All optimization should be done after bottle neck found.

Just add log "time-name" of start and end to you event functs.
and see ho often they triggered and how long its work.
I can help with log parsing.
http://addons.wz2100.net/ developer
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: [3.1+] NullBot: an adaptive skirmish AI

Post by NoQ »

We're already having function execution time checks on the c++ side, this info is available via --debug=script (only in master, but easy enough to patch 3.1 to do that as well). For instance, right now i see the newly added (a couple versions ago) harass code to cause half of the problems, and it seems to be relatively easy to improve.
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: [3.1+] NullBot: an adaptive skirmish AI

Post by NoQ »

v1.37.

Changes:
  • Certain cpu usage optimizations in attack, harass, and repair code.
  • Invisible internal tweaks required to support WZ Mini Mod AI.
In fact, in the savegame posted above i no longer have choppy sound, even though my machine is still not good enough to get more than 5fps in it. So i'm waiting for more feedback (:
themac
Trained
Trained
Posts: 415
Joined: 17 Jul 2009, 19:14
Location: Germany

Re: [3.1+] NullBot: an adaptive skirmish AI

Post by themac »

Tnx NoQ! :)
cue
Trained
Trained
Posts: 59
Joined: 06 Nov 2011, 00:12

Re: [3.1+] NullBot: an adaptive skirmish AI

Post by cue »

This forum needs a "like" button :)
Thank you NoQ