Explore Courses Blog Tutorials Interview Questions
0 votes
in AI and Deep Learning by (50.2k points)

It could be part of the model because it's part of the business logic of the game.

It could be part of the controller because it could be seen as simulating player input, which would be considered part of the controller, right? Or would it?

What about a normal enemy, like a goomba in Mario?

UPDATE: Wow, that's really not the answer I was expecting. As far as I could tell, A.I. is an internal part of the autonomous game system, hence model. I'm still not convinced.

1 Answer

0 votes
by (108k points)

MVC works very well as an architecture for a large number of applications. Some applications may find that MVC works well for the external interfaces, especially User Interfaces as part of more complex architecture.

If you find yourself trying to "force fit" a problem into a pattern, it probably isn't the right pattern. Use MVC for the UI - use other patterns (Message Bus, or Observer/Listener, etc...) or other OO techniques for the AI like think of a simple game like tic-tac-toe where you would want different computer difficulty levels to play against. If you make each difficulty level a Strategy, it's easy to drop in different implementations.

Browse Categories