Hi
I've been working on my own TCG and found a link an article discussing the Duel of the Planeswalkers AI.
http://www.wizards.com/Magic/Magazine/Article.aspx?x=mtg/daily/feature/44
I really liked the concept of an instanced-based engine for each AI which can basically "simulate" turns. I re-wrote a lot of my engine in an attempt to get a similar setup. From the article, each computer player has an AI with it's own copy of a game instance. However, in trying to implement this, I am not sure how to isolate the player list, AI, and engine to prevent circular references during initialization of the engine.
For example if I have the following class structure
class cGameEngine
{
cPlayer* _plrList;
}
class cPlayer
{
cAI* _ai;
}
class cAI
{
cGameEngine* _engInstance;
}
1) When the game engine instance is created, it will create a copy of the player list.
2) Each NPC player will create an AI.
3) Each AI will create another game engine instance copy.
4) This game engine instance copy will create another copied player list, and the cycle will continue....
Where is the best place to break this circularity?
?Thanks in advance for any input!