Jump to content

AI API ideas


Recommended Posts

I have been thinking a bit about what I would find useful for AI's. There is basically one idea that I think would be helpful to have in C++ so it can run faster.

Basically it is the same method that testbot (and hence jubot/qbot) use to place buildings. So it is a set of image functions acting on a 16 bit one channel image. Useful functions would be:

addInfluence(position, radius, strength, type) which adds a circular spot to the map with the amount added depending on radius. See spoiler for example:

mLbGc.png

The parameters would be: radius (radius at which function drops to 0 strength), strength (increase amount at centre point), type (the type of drop off function).

If this was able to be calculated very rapidly I would use it for a large number of things in my AI. Building placement is already like this, adding an influence for each tree would allow efficient resource drop placement. Using enemy soldiers you could calculate the centres of enemy armies so working with groups of soldiers rather than individuals. Enemy villager concentrations would be useful for raiding. Negative influences could be used to create avoidance maps for attacking armies so my soldiers don't try to fight within range of a fortified position without siege. Basically everything where there are large numbers of entities on the map can be helped by using this to find concentrations of that thing.

Additional useful functions would be an equivalent of expand influences (see testbot for a sample implementation) which acts roughly like a blur. For reading the map findMaxima and findLocalMaxima would be helpful. They don't necessarily need to be perfectly precise, speed is a high priority.

The reason I suggest these to be added to the C++ api is that they are cpu intensive and for things like finding enemy armies it would be good to run them as frequently as possible.

Another separate thing which could be nice would be an API which tells the AI how much processing power it can have, so on fast computers it could compute things more frequency to get more up to date information and play a bit better but on slower computers it could not make the game lag. I was thinking that the current profiling code could be used for that. My current AI design will have a timer slowing certain things down anyway so it would be easy for me to handle (to some extent).

Finally I would like a promotion event, since currently it simply sends deletion and creation events.

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...