Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


AI in a game similar to Heroes of might and magic

This topic is 5503 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m new to AI and i''d like to add one to my game, which is similar to homm. I''m thinking of creating some hi level AI, which will handle diplomacy (should we attack our neighbour and similar). It will use some variables from a script - for example how agressive AI should be. Later I think of using an influence map and depending on it, move to different locations. And the last one is battle view - here i think of using some scripts and a simple influence map. Maybe there''s a better way to do it? And is it good to use scripts, maybe it''s better to hardcode ai and load from file only some variables, describing how this ai should behave?

Share this post

Link to post
Share on other sites
I haven''t actually coded my AI, (Or any part of my game yet actually,...) but I must say a changeable script would be more flexable than a hardcoded AI. If you release your game, then updating the AI as a standalone file script is easier than a new .exe

Share this post

Link to post
Share on other sites
Well If I were you, I would make a two-part non-battle AI, one for each opponent and one for each of his heroes. Then the big un can just tell the little uns what they should do in general terms and they can execute it.

For example:

big uns analyse influence maps and thief reports :

Notable Circumstances Impact
Opponent get resources at higher rate High
Many unclaimed resources Medium
Needed resource unclaimed High
Hero uncharacteristicly far away from opponent but close to me VERY HIGH

etc and give orders to his heros, weighing in amount of troops each task would demand

Stalk and Kill Hero
Defend city
Collect Free Resources
Collect Free Resources towards opponent
Claim new resource
Claim new city

which would be translated to prety much goto(x,y)

just an idea. think it would be easy to get to scale better with few-many heroes than just one AI.


Share this post

Link to post
Share on other sites
Original post by KriS-XK
is it good to use scripts, maybe it''s better to hardcode ai and load from file only some variables

The big question is, what do you want coders to do, what do you want game designers to do and what do you want users to be able to do?

If you hardcode the AI and load some variables, well, that makes sense and is efficient. But it doesn''t let your users be able to write their own AI. Which is either neat or, if your built-in AI stinks, essential

In Baldur''s Gate, one of the most popular features was being able to change the AI. And that probably requires scripts

If you go the script route, the important question for you is, what infrastructure do you need to put in place to make writing AI scripts easy?

For example, you have to decide if you''re going to have a per-Hero level AI, player-level AI or both. If the latter, how are they going to talk - what can they say to each other?

Suppose i want to learn from experience. That means storing certain player moves and outcomes, at run time, being able to retrieve those moves and figure out how these things play out. Is he using the "quick, invisible thief who steals all your resources" strategy, the "make lots of money with a lord" strategy or the "chaos wizard coming to kill you" strategy? To let things like that influence your AI scripts, you need to build in a mechanism to read from a database or do something similar

There''s an art to deciding what to build in and what do let others script. Takes some tweaking and users'' requesting features

Good luck


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!