View topic - ** New AI ** Das Geändert Aggressiven Schwarm!



All times are UTC + 1 hour


Post new topic Reply to topic  [ 33 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: 09 Jun 2011, 03:44 

Joined: 10 Jul 2009, 22:34
(Title means: the modified aggressive swarm , according to Google Translate)

I've been tinkering with knorke's AI for Conflict Terra (Das Schwarm), and it produced this. New features are:

-Engineers walking around now reclaim any wreckage they see.

-Now uses factories instead of cloning (cloning had a tendency to paralyze the drone's economy, so I disabled it)

-Now patrols the map better

-Now has a better economy and stronger army, in terms of metal mining and unit numbers and build order.

-NOW HAS MILITARY LOGIC! The Schwarm will send it's army to any place it detects a drone under fire. (Note: this feature is currenly... hypersensitive. It often responds to slight damage from falling meteors with a full-on military offensive). In a test, the drones were able to find and destroy several dummy targets placed on the map.


I'm quite proud of my modifications, considering that I'd never seen Lua or Spring source code before starting on this.

Enjoy! Latest source is attached.


Attachments:
tp_schwarmAI.lua [21.38 KiB]
Downloaded 126 times
Top
 Offline Profile  
 
PostPosted: 09 Jun 2011, 03:47 
Conflict Terra Developer
User avatar

Joined: 21 Jan 2010, 06:21
Location: Tucson
How easy do you think it would be for a player to set up a trap, such as attack a drone at Point A, and then move into the drone base at far away Point B while the army scuttles to Point A?


Top
 Offline Profile  
 
PostPosted: 09 Jun 2011, 04:33 

Joined: 10 Jul 2009, 22:34
mmm.

army will auto-redirect to the most recent point of conflict. At least, it should. I'll do combat tests tomorrow.


Top
 Offline Profile  
 
PostPosted: 09 Jun 2011, 05:06 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
cool.
being able to "poke" the AI and see it react is definately nice.

at one point you do
Code:
for t in pairs(myTeam) do
  if (unitTeam == myTeam[t]) then
to find out if the AI controlls this unit.
I already made this as a function, better use this:
Code:
--is team controlled by me?
function isTeamCBM (teamID)

Quote:
-Now uses factories instead of cloning (cloning had a tendency to paralyze the drone's economy, so I disabled it)
Well yes, that happens but the real problem is something different:
knorke in other thread wrote:
Making better "stages-lists" is probally not much use right now as first the makeSomeUnits() would have to be fixed to follow the list more closely. Right now it often builds more units then defined.
So disabling cloneing is merely a workaround.
Shortterm it makes the AI play better but for real improvements all that stuff needs to be fixed/rewritten.

UnitDamaged() might get called very frequent, ie if a unit is attacked by a beam laser it gets called every frame. That is okay for small calculations (like the miner[unitid].cargo =miner[unitid].cargo +1 in the harvesting gadget) but if you loop through alot of units like the AI does, it can potentially use alot of CPU.

Quote:
army will auto-redirect to the most recent point of conflict.
If the units are send to wherever a unit just took damage, they might go nowhere if they are in the middle of two attacks.
I already made this unitOnMission thing to avoid units being given multiple tasks at once:
You can do
unitOnMission [unitID] = 30
(this counter will go down by 1 every frame and you can check if the unit is busy by if unitOnMission [unitID] > 0)
Currently it is only used by moveAway () and doesUnitWantBuildJob () to make sure that a unit that is moving away from the factory does not instantly start to build something. (because that would block the factory)

So just
Code:
UnitDamaged()
set_waypoint (location of attack)
is not enough for military logic. The economics are so easy to adjust because there is this stages thing where it all it takes is changing some numbers.
The miliatary side needs something similiar
ie rate map locations by danger/presence of enemy and then only near units react etc.
Otherwise it will quickly hit a barrier.

There is more but you will figure that out pretty quick yourself if you continue like this ;)
Still at this point I would not want to merge your changes into my version because imo they are "too hackish" and tinker with the symptomes instead of fixing the real problems.
Ok, that sounds stupid/arrogant when my code is far from perfect as well but dont know how else to say it, no offense ;)
blablablub

Did you talk to Sanada about commit acess to SVN?
I have no problem if you want to take over this AI (or AI in general), in fact I have too many open projects anyway.
For start we could have two seperate files (like schwarmAI_knorke.lua and schwarmAI_yanom.lua) (I want to test some things myself first.)
To do that, LuaAI.lua will have to be updated (just copy&like the existing entries) as well as the gadget:GetInfo() (name etc) at top of the AI script.


Top
 Offline Profile  
 
PostPosted: 09 Jun 2011, 15:43 

Joined: 10 Jul 2009, 22:34
Ill work on those improvemments when I get home


Top
 Offline Profile  
 
PostPosted: 09 Jun 2011, 17:29 

Joined: 10 Jul 2009, 22:34
knorke wrote:
cool.
being able to "poke" the AI and see it react is definately nice.


indeed it is.

Quote:

at one point you do
Code:
for t in pairs(myTeam) do
  if (unitTeam == myTeam[t]) then
to find out if the AI controlls this unit.
I already made this as a function, better use this:
Code:
--is team controlled by me?
function isTeamCBM (teamID)




fixed

Quote:
Well yes, that happens but the real problem is something different:

the makeSomeUnits() would have to be fixed to follow the list more closely. Right now it often builds more units then defined.

what exactly about it is broken that I must fix?

Quote:
UnitDamaged() might get called very frequent, ie if a unit is attacked by a beam laser it gets called every frame. ... if you loop through alot of units like the AI does, it can potentially use alot of CPU.
I noticed that, yes. What can I do about it?

Quote:
Did you talk to Sanada about commit acess to SVN?
I have no problem if you want to take over this AI (or AI in general), in fact I have too many open projects anyway.
For start we could have two seperate files (like schwarmAI_knorke.lua and schwarmAI_yanom.lua) (I want to test some things myself first.)
To do that, LuaAI.lua will have to be updated (just copy&like the existing entries) as well as the gadget:GetInfo() (name etc) at top of the AI script.


I guess I could start committing to SVN... but I've never used it before, so I don't know how it works, exactly. And I'm kinda afraid that I'll accidentally overwrite important things on the SVN or something.


Top
 Offline Profile  
 
PostPosted: 09 Jun 2011, 17:42 
Conflict Terra Developer
User avatar

Joined: 29 Aug 2009, 19:12
Location: Also Richmond
Oh, the svn is pretty simple stuff. Just PM me with your gmail and i'll give you access.


Top
 Offline Profile  
 
PostPosted: 09 Jun 2011, 18:32 
Kernel Panic Co-Developer
User avatar

Joined: 16 Nov 2004, 13:08
yanom wrote:
knorky wrote:
UnitDamaged() might get called very frequent, ie if a unit is attacked by a beam laser it gets called every frame. ... if you loop through alot of units like the AI does, it can potentially use alot of CPU.
I noticed that, yes. What can I do about it?
In the UnitDamaged, just store where the damage took place. Then, in the GameFrame, once every x second (use a modulo on the frame count), check if a unit was attacked recently, and decide there to mount a counterattack.


Top
 Offline Profile  
 
PostPosted: 09 Jun 2011, 19:07 

Joined: 10 Jul 2009, 22:34
ok, I solved the problem of unitDamaged sucking CPU by replacing it with unitDestroyed.

I watched it do more target practice, and it's pretty cool IMO. One little scout will wander in front of the target (an inert mobile-hq cruiser), the cruiser will blast it, and congrats cruiser, you just ticked off the hornets nest. The map will drain of drones as they all rush toward the cruiser and annihilate it. Then the engineers will reclaim the wreckage and the dead drones. (IDK why engineers get sent as part of the war group, but there pretty useful support units, as they repair in combat)

latest source is attached.


Attachments:
tp_schwarmAI.lua [21.03 KiB]
Downloaded 97 times
Top
 Offline Profile  
 
PostPosted: 09 Jun 2011, 20:09 
Conflict Terra Developer
User avatar

Joined: 21 Jan 2010, 06:21
Location: Tucson
I totally think a Knorke Schwarm and Yanom Schwarm AI would be cool, the more AI the better. It could be fun to see whose is better in the "end"

I'm guessing Snoop is or will get you up to speed on SVN stuff. We can revert to previous revisions if you do do something catastrophic, and know that your revisions will be checked by me :twisted:


Top
 Offline Profile  
 
PostPosted: 09 Jun 2011, 21:09 

Joined: 10 Jul 2009, 22:34
I'm having trouble getting both AI's in there. Currently, both the files tp_schwarmAI.lua and tp_YMSAI.lua are in the Gadgets directory and contain the same code (schwarm with my revisions), and the LuaAI.lua file says:

Code:

local listOfLuaAIs = {
    {
        name = "KTAI",
        desc = "knorkes TEST ai. CRASH DANGER. safer to watch on a video: http://www.youtube.com/watch?v=aOtnOEOtVTM",
    },
    {
        name = "SchwarmAI",
        desc = "Knorke's AI for the drone's faction",
    },
   {
      name = "YMSAI",
      desc = "Yanom's Modified Schwarm AI",
   },
}
return listOfLuaAIs


when I start up springlobby, I see both Schwarm and YMSAI in the "Add bot" window. However, upon running the game, the AI only works if you choose the "Schwarm" option, not the "YMSAI" option.

However, both files are exactly the same

does anyone know why this is happening?


Top
 Offline Profile  
 
PostPosted: 09 Jun 2011, 21:19 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
in the AI gadgets, at top in gadget:getInfo
change the name=
to the same value as in the LuaAI.lua


Top
 Offline Profile  
 
PostPosted: 09 Jun 2011, 22:16 

Joined: 10 Jul 2009, 22:34
oh, ok, it's fixed now.

Question is, how do I submit the 1 new file and 1 modified file to SVN?

I've never used SVN before.


Top
 Offline Profile  
 
PostPosted: 09 Jun 2011, 23:26 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
Have you installed a SVN programm? turtoise svn is ok.
After editing and saving a file it should have a red (!) symbol on its icon in windows explorer.
rightclick on file-> "SVN Commit" -> enter a message ("i changed this & that") -> ok


Top
 Offline Profile  
 
PostPosted: 10 Jun 2011, 01:06 

Joined: 10 Jul 2009, 22:34
knorke wrote:
windows explorer.


*vomits*

I'm on linux. I installed a SVN package, time to dig through the documentation....

I can comit just individual files, right, and not the whole package?


Top
 Offline Profile  
 
PostPosted: 10 Jun 2011, 01:52 

Joined: 10 Jul 2009, 22:34
ok, I got SVN working but the repository keeps rejecting my username and password:

Code:
Username: rothj1459@gmail.com
Password ***********************************



Also, I saw there was a thing on the googlecode website to commit files, but it kept saying "unknown server error"


Top
 Offline Profile  
 
PostPosted: 10 Jun 2011, 02:59 

Joined: 10 Jul 2009, 22:34
ok, I got the web interface going.... added my changes.


Top
 Offline Profile  
 
PostPosted: 10 Jun 2011, 20:32 
Zero-K Developer
User avatar

Joined: 10 Sep 2008, 02:11
Location: In search for TheTruth (TM)
NautilusSVN (I think they renamed to 'rabbit' or something) is good. Try that, if you want SVN/explorer integration.


Top
 Offline Profile  
 
PostPosted: 10 Jun 2011, 20:36 

Joined: 10 Jul 2009, 22:34
kk thx.

btw, what exactly about makeSomeUnits() is broken?


Top
 Offline Profile  
 
PostPosted: 10 Jun 2011, 22:15 

Joined: 10 Jul 2009, 22:34
combat trials are in. Results were... remarkable.

I'm not going to post the replay here, because it's quite embarrassing to have one's *** handed to him by one's own creation*.


*well, it's knorke's creation too. he wrote most of the code.


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 33 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.