ProvencalLeGaullois Posted December 7, 2013 Report Share Posted December 7, 2013 Hi,I would like to write a small AI. Instead of having an AI who collects resources to build unist&structures, I would like to create some units&structures by event/timeExamples:Harresment : I would like to generate 10 skirmishers near the limit of the visibility of the human, and give to them the order to attack all workers. For this one, I read how to send an attack in the tutorial bot. For creating unit I didn't saw how to spawn somewhere on the map (for now I consider the human doesn't build wall).Creating a challenging city : instead of building a functionnal city, I would like to build a blob,(remeber it's an example) 10 houses + a temple + a barracks + a trade center, surronded by a wall. For this one I want to create the structure by script (for now I consider a full flat map).Creating a small fortress : building somewhere on the map a new civic center + 2 fortresses (full garisonned), surounded by walls and towers (full garisonned). The aim of that small fortress are just to occupy some terrain. Can also used to beseiged the human player by creating a small fortress near the limit of visibility of the player.burn ouposts : since this AI needs fog to create these small fortress, some cavalry unit would be spawn out of the field of view of an oupost, and attack it.Do you think it would be possible to create a such AI with the present API ? there is somewhere a full documentation of all functions present in the AI API ? 1 Quote Link to comment Share on other sites More sharing options...
Loki1950 Posted December 7, 2013 Report Share Posted December 7, 2013 ATM there is no support for events/triggers the only one is at a particular time into the session IIRCEnjoy the Choice 1 Quote Link to comment Share on other sites More sharing options...
historic_bruno Posted December 7, 2013 Report Share Posted December 7, 2013 Do you think it would be possible to create a such AI with the present API ? there is somewhere a full documentation of all functions present in the AI API ?The AIs receive lots of updates about the gamestate, but not everything. However, they are designed to run asynchronously to the simulation, so they don't directly modify it, but send commands instead. Currently, AIs are restricted to the same commands that a human player could send, with most of the same checks in place. They can't arbitrarily place units and buildings, though I think this would be a useful feature for some AIs. The available commands aren't really documented anywhere, but they are handled in the big switch block in /binaries/data/mods/public/simulation/helpers/Commands.js. 1 Quote Link to comment Share on other sites More sharing options...
ProvencalLeGaullois Posted December 8, 2013 Author Report Share Posted December 8, 2013 I had already read all helpers files, saddly there is not all the commands I would need... if the AI was coded in C++ I would be able to implement by myself what I need. But I don't know how to make C++ interacting with javascript...about the Commands.js, I see it's a big switch, I don't know how js works, but it would maybe a good thing to rearange all cases from the most used (I guess walk) to the less used case.in few words... my AI will not for tomorrow. Quote Link to comment Share on other sites More sharing options...
feneur Posted December 8, 2013 Report Share Posted December 8, 2013 I don't know the code, so take my words with more than a grain of salt, but shouldn't the AI be able to generate units (and possibly buildings as well?) the same way a human can use cheats? And I certainly recall reading about the AI doing things after a set amount of time, so that should at least be possible. Quote Link to comment Share on other sites More sharing options...
wraitii Posted December 8, 2013 Report Share Posted December 8, 2013 I'm fairly sure it can cheat, but I'm not sure you can plot buildings using this.However we could just add some cheats for that as a workaround. Quote Link to comment Share on other sites More sharing options...
ProvencalLeGaullois Posted December 8, 2013 Author Report Share Posted December 8, 2013 you can spwan unit and kill by script, but for what I know you have to select a building to spawn. So you can't spawn on the map far of a building (maybe I'm wrong). And I didn't found a way to spawn a building.I don't want to kill the unit, I want to remove it. Killing means corpse on the ground and maybe (i didin't check this) change the number of lost units... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.