mardi 17 février 2015

Choosing design pattern for AI of collectible card games (Hearthstone) [on hold]

I'd like to write an AI for games like hearthstone. Preferably using C#.


In Hearthstone there are hundreds of cards, each card will have a unique ability, for example the "Abusive Sergeant" card increases the attack of another card in the current turn.


The usual way is to use a base class "Card", and make a subclass for every individual card, but this would require me to write hundreds of subclass definitions and involve a lot of copy-pasting. It also doesn't make sense to make the abilities (such as Deathrattle) as interfaces, because the ability could be granted to cards at run time, but I cannot make the classes implement a different interface at run time.


I've also looked at entity-component systems, but I find it unsuitable for the purpose. In the AI system it is often required to search through board states. In the entity system the components are often not stored in the entities, but scattered in ComponentMgrs, and it would make copying the board state very troublesome to do, not to mention the entity bookkeeping.


I'm wondering what is the best design pattern to use in such a project?


Aucun commentaire:

Enregistrer un commentaire