Okay, the idea of the AI balancing itself against your econ? That's really, really cool. I totally agree that the "easy/medium/hard" thing is silly, so this kind of auto-adjusting AI concept is brilliant.
I'm surprised it didn't come into Spring AI earlier, I think I talked to Boirunner or possibly Felix The Cat about challenge scaling related to ingame factors a long time past.
personally I think an AI should be as good at the game as possible, the challenge is what makes it fun
The challenge of overcoming is important, but if you cannot overcome it ceases to be a challenge, and instead is revealed to be a bore. Then again, you must be playing an AI for a reason...
Anyway, do we have AI modoptions yet? It's a little untidy to have two AIs, the unrestrained one and the autoleveling one, would be cool to be able to merge them, and even cooler if the looseness of the restraint could be tweaked by a slider. Then considering lobbies don't support yet player and team mod options so long after they've been implemented in the engine, I'm afraid I'm dreaming.
SL does support them, though it is a bit unintuitively (you have to double click on items in a list). Last time i tries TASClient, they were not in .. but could be Satirik did it and i just forgot about it again.
How can I check how many of a specific unit type the player has currently? I'd like to use that to control how much factories the econ can support based on the number of extractors (and maybe a few other things).
Edit: found how to do that myself - game:GetFriendly() helps there. Unless there is some other way that doesn't need a lua-side loop through all the units?
Edit2: that's a really great AI! With some simple functions I can control things like ratio of facs to extractors, those were impossible with AAI. Now one thing I want that is lacking is the ability to return a nil or empty string instead of a unit name if I don't want to build that unit right now. Currently AI needs a valid unit name in all cases and there doesn't seem to be a way to just skip to the next item in the list (or at least I haven't found it), so if I don't want to build another factory, I have to return something other (like a mex).
As a warning, I intend to change the nature of GetFriendlies and similar types of API methods to instead return a table, as it works better, especially since at the moment your stuck with calling it once and polling for each unit, eurgh its messy
so rather than:
local enemyCount = game:GetEnemies() for i,enemyCount do local enemy = game:GetEnemy(i) end
it would be:
local enemies = game:GetEnemies() local enemyCount = #enemies for i,enemy in ipairs(enemies) do -- hurrah end
I've been taking some well earned rest after the Uni crunch.
Also what your trying to do would require a loop of some kind anyway, its just a matter of where that loop goes. I'd like to put it in Shard but there's always the benefits of doing other things during the loop for efficiency gains.
Efficiency optimizations can come at a later stage, when I'm sure my AI setup works the way I want. So far I made a function to count all friendly units which match a given name using a loop, and it works (though when there are 2 Shards in game, periodic slowdowns are noticeable).
As for nils or empty strings or whatever returned instead of a unit name: currently they seem to crash lua and the AI stops (or at least the unit the queue of which contains that stops). So I have something like that (only build another factory if there are more than 3 times as much extractors as there are factories):
local function ground_factory() if countOwnUnits("mine")>(countOwnUnits("l_fact")*3) then return "l_fact" else return "mine" end end
If I don't want to build the factory, I have to return some other valid unit name. I'd like to be able to return a nil or "" instead so the builder can just skip the item when it's not wanted. Currently I return the extractor which seems to be skipped if there are no unused metal spots anymore, but that doesn't seem like the best solution to me.
Last edited by yuritch on 26 Apr 2010, 16:20, edited 1 time in total.
Yeah that's probably right, the most damning defect in the current API is if you insert a second loop inside, because unless you copy each entry and then loop over, your modifying the set of data your working on each time you call GetEnemies etc
It's more a sign of me implementing it one way because I needed it, realising how I could do it the way I originally wanted, but never getting around to it.
Is there a way to find out how much metal an extractor is producing? As far as I see the API functions do not provide this (or any other) info about how much resource individual units are making/consuming (except for avg wind value). While for some units I can just use constants, metal extraction depends on map (and can even be different on different metal spots on the same map), so it can only be calculated per-unit.
I need that info because now my AI config uses the number of extractors to decide if it can support more factories or not. Using actual metal income instead would be much better.
I'm sorry I haven't been as prolific lately, Ive been working on a rebuild of the darkstars theme to fix up a few errors.
Right now I haven't added much of anything in the way of determining resources to the API, and it's something I will need to sort out, so at the moment, there isn't any, a kind of glaring flaw I know =(
time spent watching my drunken friend get beaten by shard over and over again after talking shit about how good he was going to be at a game he hadn't yet played and AI opponents in general : priceless
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