Page 1 of 1

Is the MVC architecture worth it?

Posted: Sun Jan 08, 2012 1:06 am
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?

Re: Is the MVC architecture worth it?

Posted: Sun Jan 08, 2012 1:08 pm
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.

Re: Is the MVC architecture worth it?

Posted: Sun Jan 08, 2012 2:33 pm
by hendu
I think he means he can't make a headshot event without asking the animation where the head is?

Re: Is the MVC architecture worth it?

Posted: Sun Jan 08, 2012 3:12 pm
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.