Is the MVC architecture worth it?

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Is the MVC architecture worth it?

Post by 3DModelerMan »

I'm writing a game engine around Irrlicht. I read Game Coding complete and liked the architecture of their engine, but I noticed a few things that would be difficult. Animation for example: if you communicate with the game view using events, then the animation system is seperated from the game. Some things might depend on the animation system though (headshot detection for example). Is there anyone who has worked with it before, and can tell me whether it's a good idea or not?
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
ACE247
Posts: 704
Joined: Tue Mar 16, 2010 12:31 am

Re: Is the MVC architecture worth it?

Post by ACE247 »

MVC is pretty generic...
I think MVC is only about keeping external input separate from internal engine workings and functions to allow for independant development thereof, such as with a GUI layout only passing event codes to an event manager that then triggers an appropriate function or not if there is no function yet associated with the event code.

You could make a 'headshot' event occur in game, then let it be sent to the animation event manager, then have the animation event manager call an appropriate animation function. You could also add other 'shot area' type events and so on like this.

Its pretty simple, but can often become unesseccarily complicated. So consider where you really need it.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Is the MVC architecture worth it?

Post by hendu »

I think he means he can't make a headshot event without asking the animation where the head is?
ACE247
Posts: 704
Joined: Tue Mar 16, 2010 12:31 am

Re: Is the MVC architecture worth it?

Post by ACE247 »

Well, he will have to ask the animation. Or have the Animation always say where its head is by sending events to manager when there is a bullet.
Get current character animation-> get current character frame->get position of pre-set marker bone for head in frame->check if bullet vector intersects.
Or: [there is a bullet] event sent: head is here in current animation frame-> bullet vector is this -> does bullet vector collide?

I usually just use whatever I need, to do to make it work, but keep simple things simple and only have complex systems need to interact via an event messenger.
Post Reply