Advertisement

AI in a game similar to Heroes of might and magic

Started by November 09, 2003 03:34 AM
2 comments, last by KriS-XK 21 years, 3 months ago
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?
--KriS
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
Old Username: Talroth
If your signature on a web forum takes up more space than your average post, then you are doing things wrong.
Advertisement
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.

/Apoztel
quote:
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

-b

This topic is closed to new replies.

Advertisement