** New AI ** Das Geändert Aggressiven Schwarm!
Moderators: Moderators, Content Developer
** New AI ** Das Geändert Aggressiven Schwarm!
(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.
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 157 times
- SanadaUjiosan
- Conflict Terra Developer
- Posts: 907
- Joined: 21 Jan 2010, 06:21
Re: ** New AI ** Das Geändert Aggressiven Schwarm!
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?
Re: ** New AI ** Das Geändert Aggressiven Schwarm!
mmm.
army will auto-redirect to the most recent point of conflict. At least, it should. I'll do combat tests tomorrow.
army will auto-redirect to the most recent point of conflict. At least, it should. I'll do combat tests tomorrow.
Re: ** New AI ** Das Geändert Aggressiven Schwarm!
cool.
being able to "poke" the AI and see it react is definately nice.
at one point you doto find out if the AI controlls this unit.
I already made this as a function, better use this:
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.
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 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.
being able to "poke" the AI and see it react is definately nice.
at one point you do
Code: Select all
for t in pairs(myTeam) do
if (unitTeam == myTeam[t]) then
I already made this as a function, better use this:
Code: Select all
--is team controlled by me?
function isTeamCBM (teamID)
Well yes, that happens but the real problem is something different:-Now uses factories instead of cloning (cloning had a tendency to paralyze the drone's economy, so I disabled it)
So disabling cloneing is merely a workaround.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.
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.
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.army will auto-redirect to the most recent point of conflict.
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: Select all
UnitDamaged()
set_waypoint (location of attack)
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.
Re: ** New AI ** Das Geändert Aggressiven Schwarm!
Ill work on those improvemments when I get home
Re: ** New AI ** Das Geändert Aggressiven Schwarm!
indeed it is.knorke wrote:cool.
being able to "poke" the AI and see it react is definately nice.
fixed
at one point you doto find out if the AI controlls this unit.Code: Select all
for t in pairs(myTeam) do if (unitTeam == myTeam[t]) then
I already made this as a function, better use this:Code: Select all
--is team controlled by me? function isTeamCBM (teamID)
what exactly about it is broken that I must fix?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.
I noticed that, yes. What can I do about it?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 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.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.
Re: ** New AI ** Das Geändert Aggressiven Schwarm!
Oh, the svn is pretty simple stuff. Just PM me with your gmail and i'll give you access.
Re: ** New AI ** Das Geändert Aggressiven Schwarm!
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.yanom wrote:I noticed that, yes. What can I do about it?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.
Re: ** New AI ** Das Geändert Aggressiven Schwarm!
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.
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 124 times
- SanadaUjiosan
- Conflict Terra Developer
- Posts: 907
- Joined: 21 Jan 2010, 06:21
Re: ** New AI ** Das Geändert Aggressiven Schwarm!
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
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

Re: ** New AI ** Das Geändert Aggressiven Schwarm!
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:
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?
Code: Select all
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
However, both files are exactly the same
does anyone know why this is happening?
Re: ** New AI ** Das Geändert Aggressiven Schwarm!
in the AI gadgets, at top in gadget:getInfo
change the name=
to the same value as in the LuaAI.lua
change the name=
to the same value as in the LuaAI.lua
Re: ** New AI ** Das Geändert Aggressiven Schwarm!
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.
Question is, how do I submit the 1 new file and 1 modified file to SVN?
I've never used SVN before.
Re: ** New AI ** Das Geändert Aggressiven Schwarm!
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
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
Re: ** New AI ** Das Geändert Aggressiven Schwarm!
*vomits*knorke wrote:windows explorer.
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?
Re: ** New AI ** Das Geändert Aggressiven Schwarm!
ok, I got SVN working but the repository keeps rejecting my username and password:
Also, I saw there was a thing on the googlecode website to commit files, but it kept saying "unknown server error"
Code: Select all
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"
Re: ** New AI ** Das Geändert Aggressiven Schwarm!
ok, I got the web interface going.... added my changes.
Re: ** New AI ** Das Geändert Aggressiven Schwarm!
NautilusSVN (I think they renamed to 'rabbit' or something) is good. Try that, if you want SVN/explorer integration.
Re: ** New AI ** Das Geändert Aggressiven Schwarm!
kk thx.
btw, what exactly about makeSomeUnits() is broken?
btw, what exactly about makeSomeUnits() is broken?
Re: ** New AI ** Das Geändert Aggressiven Schwarm!
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.
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.