Jump to content
  • Advertisement
Sign in to follow this  
ssjvucu

Duel of the Planeswalkers AI/Engine Architecture Question

This topic is 2142 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

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!

Share this post


Link to post
Share on other sites
Advertisement

Unfortunately I can't, as the premise of the "instanced"-based engine is the ability manipulate a copy of the engine to simulate player turns, combat targets, actions, etc (all in a separate thread) and not having it affect the game the player sees.

Share this post


Link to post
Share on other sites

Well you can do the copying of the player list in a function rather than in the constructor and only call that function for the original game engine, not the AI copies.

Also wouldn't you need a more specialized AI version of the game engine? Assuming that the game engine deals with player input, rendering, etc.. you don't need to have all that aswell. The AI, in the case of a card game, would only really need stats about the cards in play and other various aspects just relating to the card and gameplay element. It makes more sense to me atleast. Either through inheritance, class cAIEngine : public cGameEngine, or a class that just retrieves relative information from the game engine.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!