AI for Drones Faction: Das Schwarm! - Page 3

AI for Drones Faction: Das Schwarm!

A fresh perspective on battle for control of Earth, brought to you by Sanada and Snoop.

Moderators: Moderators, Content Developer

yanom
Posts: 323
Joined: 10 Jul 2009, 23:34

Re: AI for Drones Faction: Das Schwarm!

Post by yanom »

mm. good idea, having them guard the engineers.

Anyway, I had great fun last night, tinkering with the Lua of Schwarm, namely the unit numbers it maintains. But I have some questions about the stages:

-Once the AI gets to a stage, it can't leave that stage until it gets the unit numbers required of it in that stage, right?
-Why does it sometimes drop from a high stage back to a much lower one?
-Umm... how exactly does it progress from stage to stage?

Thanks.

EDIT: Also, it looks like the AI will stop mining for metal at some point, even if it still needs metal to produce more units. Is there a way to make it really metal-hungry so it keeps mining and mining and mining and getting more metal (and more miners)?
yanom
Posts: 323
Joined: 10 Jul 2009, 23:34

Re: AI for Drones Faction: Das Schwarm!

Post by yanom »

Well, I tinkered with it a bit, should work a tiny bit better now. .lua file's attatched. Still curious about the stage stuff though.
Attachments
tp_schwarmAI.lua
(18.92 KiB) Downloaded 38 times
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: AI for Drones Faction: Das Schwarm!

Post by knorke »

-Once the AI gets to a stage, it can't leave that stage until it gets the unit numbers required of it in that stage, right?
yes.
-Why does it sometimes drop from a high stage back to a much lower one?
If it is at, say stage 6 but the requirements for stage 1 are no longer met (ie stage 1 requirement is a factory and it gets destroyed) it will drop all the way down to stage 1.
-Umm... how exactly does it progress from stage to stage?
by building the units it is missing and assigning the task to units who can do it. (function makeSomeUnits)
Also, it looks like the AI will stop mining for metal at some point, even if it still needs metal to produce more units.
Yeah, thats half bug of ai and half of game.
ie sometimes mining towers are in range of rocks but can not mine because something is in the way. (like a wreck blocks their laser)
yanom
Posts: 323
Joined: 10 Jul 2009, 23:34

Re: AI for Drones Faction: Das Schwarm!

Post by yanom »

Oh good.
knorke wrote: ie sometimes mining towers are in range of rocks but can not mine because something is in the way. (like a wreck blocks their laser)
I was talking about when sometimes there's mining towers sitting around but they won't go move rocks, or when theres engineers sitting around and they won't go mine.

Also, if I put ["kdroneminingtower"]=x in one of the stages, and it doesn't have enough engineers to morph into x towers, will it build the necessary engineers?

Anyway, did you like the modifications I made? The major one is that instead of machGo() on building a tridroneroller, any military units built will automatically go to random place on map.


Thanks for all your help with my edits of Schwarm.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: AI for Drones Faction: Das Schwarm!

Post by knorke »

sorry, could not yet test out your changes.
sometimes there's mining towers sitting around but they won't go move rocks, or when theres engineers sitting around and they won't go mine.
Yes, thats a problem. It happens because the AI might fall back to stage 1 and then it "is ok" with just having 2 mining towers because thats what stage 1 is. Slowly the other engineers should then morph too as it progress through the stages. Would probally be better to make idle engineers also seek out rocks.
Also, if I put ["kdroneminingtower"]=x in one of the stages, and it doesn't have enough engineers to morph into x towers, will it build the necessary engineers?
yes.
yanom
Posts: 323
Joined: 10 Jul 2009, 23:34

Re: AI for Drones Faction: Das Schwarm!

Post by yanom »

knorke wrote: Would probally be better to make idle engineers also seek out rocks.
is there an easy way to do that?
yanom
Posts: 323
Joined: 10 Jul 2009, 23:34

Re: AI for Drones Faction: Das Schwarm!

Post by yanom »

My latest revision:

-Removed cloning from the AI behavior, because the AI had a tendancy to clone all units at once and paralyze it's entire army.
-More economy improvements
Attachments
tp_schwarmAI.lua
(19.03 KiB) Downloaded 123 times
User avatar
SanadaUjiosan
Conflict Terra Developer
Posts: 907
Joined: 21 Jan 2010, 06:21

Re: AI for Drones Faction: Das Schwarm!

Post by SanadaUjiosan »

Definitely seems more aggressive. Incorporating reclaiming could really make this deadly I think.
yanom
Posts: 323
Joined: 10 Jul 2009, 23:34

Re: AI for Drones Faction: Das Schwarm!

Post by yanom »

SanadaUjiosan wrote: Incorporating reclaiming could really make this deadly I think.
Is there an easy way to do that?

I still want knorke to make it attack the enemy, with large groups, like a player would. My spring-lua skills aren't really up to that task.

Are there any small improvements I could make?

Thanks for your feedback
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: AI for Drones Faction: Das Schwarm!

Post by knorke »

weee hooray, looks like i found somebody to take this over ;)
Image
Are there any small improvements I could make?
if you make engineers use fight-move instead of move when going to rocks, they should reclaim any wreckage in their way.
That is just be a matter of replacing CMD.MOVE with CMD.FIGHT

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 that would be the next step I guess.
yanom
Posts: 323
Joined: 10 Jul 2009, 23:34

Re: AI for Drones Faction: Das Schwarm!

Post by yanom »

knorke wrote:weee hooray, looks like i found somebody to take this over ;)
Well, I really like tweaking and improving this AI, but I don't have the Lua skills atm to add lots of new code or anything..... Is there a good spring-lua tutorial anywhere?

Please keep working on this AI (add attacking, etc) if you can, or if you can't, can some other good lua coder help me with this?

Anyway, I'll do the CMD.FIGHT thing.
User avatar
SanadaUjiosan
Conflict Terra Developer
Posts: 907
Joined: 21 Jan 2010, 06:21

Re: AI for Drones Faction: Das Schwarm!

Post by SanadaUjiosan »

Well, you just admitted to a weakness in Spring-lua (which I respect, as mine is even less) but I think a "better" clone function would be better than no clone function. Example:

Instead of "clone whole army" it checks its current resources and will clone enough units to maintain half of the resources it has, or use all of them, or a quarter, something like that.

Also, not sure if this falls under revisions you did, but snoop and I noticed that if a rock is unobtainable, they will build mining towers around it trying to get it, until there's a ton and the rock of course is not being mined. Maybe try a "if cannot mine in a minute or two, give up" sort of deal.
yanom
Posts: 323
Joined: 10 Jul 2009, 23:34

Re: AI for Drones Faction: Das Schwarm!

Post by yanom »

SanadaUjiosan wrote:Well, you just admitted to a weakness in Spring-lua (which I respect, as mine is even less) but I think a "better" clone function would be better than no clone function. Example:

Instead of "clone whole army" it checks its current resources and will clone enough units to maintain half of the resources it has, or use all of them, or a quarter, something like that.

Also, not sure if this falls under revisions you did, but snoop and I noticed that if a rock is unobtainable, they will build mining towers around it trying to get it, until there's a ton and the rock of course is not being mined. Maybe try a "if cannot mine in a minute or two, give up" sort of deal.
ehhhehhhheh.... all of that's above me. Probably. First time I ever saw Lua was opening up knorke's Schwarm. but i'd done a little Java and Python before that. So I need to learn all of this spring-lua and just lua stuff somewhere.
yanom
Posts: 323
Joined: 10 Jul 2009, 23:34

Re: AI for Drones Faction: Das Schwarm!

Post by yanom »

mmm. does anyone know how I could somehow detect when a unit is attacked?
Post Reply

Return to “Conflict Terra”