Sign in to follow this  
Spidey

Generic board game engine architecture/ MVC

Recommended Posts

Spidey    766
Hi, I'm creating a generic board game engine for my scripting class. The engine is coded in c++ whereas the board games are written in a high level scripting language. I've already set up the framework with a bridge between the code and script, but I'm having trouble conceptualizing the entire engine. I've researched and found that the MVC pattern makes the most sense, however I've never coded and MVC before and am not sure what the best implementation will be in this case. For the logic I will be using the minimax algorithm which I believe is part of the Model ? however I am not concerned about that right now. I just need some tips in setting up the MVC framework. I already have a few ideas but I just wanted to know the right way to do it, since this will be a large project and I don't want to add unnecessary complexities later on in the development process due to bad design choices. Another reason for choosing the MVC is that I want the logic completely separated from the view. The engine should be able to run in 3D, 2D or even using the Console(ascii). Let me know if anyone has any pointers on the best way to structure this. Thank you!

Share this post


Link to post
Share on other sites
alvaro    21246
I see you find patterns as confusing as I do. :)

I understand the problem you are talking about quite well, and you don't need MVC to solve it (although perhaps it can be solved that way: I wouldn't know). The cleanest architecture, and what chess programs eventually converged on, is having the engine and the GUI be two separate programs that communicate through a well-specified text protocol.

In order to design your protocol, you should probably start by reading the documentation that describes the chess protocol called UCI.

Share this post


Link to post
Share on other sites
Spidey    766
Yup, some patterns are definitely confusing!

Yes, your'e right, I definitely don't need an MVC but I was thinking it would fit well, since the entire engine could be split up into 3 main parts. The controller will read the script will and handle AI and player moves. The model will be the logic and the current state of the game. This will initially be set up through the controller after reading the script. I'm just not sure if that's the best way.

I'll definitely read the UCI docs and see how that works. Maybe it is better than what I have planned.

[Edited by - Spidey on May 29, 2010 6:34:15 AM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this