Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: rechronicle on May 08, 2019, 05:40:38 AM

Title: Implementing MVC in your Playmaker design pattern?
Post by: rechronicle on May 08, 2019, 05:40:38 AM
Hello,
I was reading about MVC pattern today, and still quite unsure about how to use it in my Unity project with Playmaker.
Can anyone explain it in a simple and understandable way for non-coder?


Maybe a Unity sample package as an example of the design pattern will help a lot.
Thank you!
Title: Re: Implementing MVC in your Playmaker design pattern?
Post by: djaydino on May 08, 2019, 08:02:40 AM
Hi.
Here is a good explanation for unity : https://www.toptal.com/unity-unity3d/unity-with-mvc-how-to-level-up-your-game-development

you could compare the scripts a bit as fsms.

for example have a separate fsm handling button presses.
When a button is pressed send an event to a different fsm, or on another fsm you can do a bool test to check if a button is pressed.

have separate fsms for horizontal/vertical movement, jump/crouch shoot, etc.

To Get/Set variable from/to other fsms : there are several Get/Set Fsm actions that you can use, and there are a bunch more on the Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181)

Also have a look at this wiki page : https://hutonggames.fogbugz.com/default.asp?W1462
Title: Re: Implementing MVC in your Playmaker design pattern?
Post by: rechronicle on May 09, 2019, 02:18:18 PM
Hello,
thank you for the article about MVC. Need to re-read it before I can understand most of the parts.

One question,

Is the responder/receiver of the sender always have to know what type of data it received? Or at least, already have a container to store the data it will receive. (In the case of 'Model' mostly updated by 'Controller').

Sorry for the trouble.
Title: Re: Implementing MVC in your Playmaker design pattern?
Post by: djaydino on May 09, 2019, 07:32:02 PM
Hi.
I am not sure what you mean, but an fsm will need some preset variables to receive data in ti.