Page 3 of 3
Re: AI for Drones Faction: Das Schwarm!
Posted: 06 Jun 2011, 16:21
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)?
Re: AI for Drones Faction: Das Schwarm!
Posted: 06 Jun 2011, 21:07
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.
Re: AI for Drones Faction: Das Schwarm!
Posted: 06 Jun 2011, 21:17
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)
Re: AI for Drones Faction: Das Schwarm!
Posted: 06 Jun 2011, 23:13
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.
Re: AI for Drones Faction: Das Schwarm!
Posted: 07 Jun 2011, 01:19
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.
Re: AI for Drones Faction: Das Schwarm!
Posted: 07 Jun 2011, 02:36
by yanom
knorke wrote: Would probally be better to make idle engineers also seek out rocks.
is there an easy way to do that?
Re: AI for Drones Faction: Das Schwarm!
Posted: 08 Jun 2011, 00:23
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
Re: AI for Drones Faction: Das Schwarm!
Posted: 08 Jun 2011, 00:46
by SanadaUjiosan
Definitely seems more aggressive. Incorporating reclaiming could really make this deadly I think.
Re: AI for Drones Faction: Das Schwarm!
Posted: 08 Jun 2011, 00:53
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
Re: AI for Drones Faction: Das Schwarm!
Posted: 08 Jun 2011, 01:03
by knorke
weee hooray, looks like i found somebody to take this over
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.
Re: AI for Drones Faction: Das Schwarm!
Posted: 08 Jun 2011, 01:24
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.
Re: AI for Drones Faction: Das Schwarm!
Posted: 08 Jun 2011, 01:25
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.
Re: AI for Drones Faction: Das Schwarm!
Posted: 08 Jun 2011, 02:31
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.
Re: AI for Drones Faction: Das Schwarm!
Posted: 08 Jun 2011, 03:44
by yanom
mmm. does anyone know how I could somehow detect when a unit is attacked?