MVC architecture with Photon

markharoldr
edited September 2011 in Photon Server
Hello everyone,

I'm just starting with Photon and I have a question regarding implementing an MVC like structure with the application I'm planning to create.

Based from the things I read from the net, I plan to have this following setup for my project.

Unity3d- will be the view part of the application and will request some data from the controller.
Photon - will be the controller part, which will handle request from the view, and will also give a response (containing data from the database).
Castle ActiveRecord ORM - will be used for the model and database handling

Based from the setup above, I have these questions:
1. Did I correctly understood Photon? Since it says from the documentation that it contains the game logic can it be used as a controller for handing request and response of data from a database? Is the setup correct?
2. Is there an easier or better way to implement an MVC architecture with Photon?

Yours,
Mark

Comments

  • 1. Sure, no problem there :)
    Where you put the game logic btw is your thing, but there is nothing that prevents you to use the server for "request relaying" from clients for example :)
  • Hi dreamora,

    If my game logic is not on Photon Server, what are the alternative places where I can put it?

    Yours,
    Mark
  • You could for example have a "master client", a special client you have on the server for example.
    Or you could have it on each client and really use the photon server only as "secure database lookup and message relay service" or whever else you want. its fully up to you as photon does not enforce it to be at a specific point. depending on where you have it it might just become more tricky to get it going as you need to implement a corresponding core first.
  • Mark,

    I see the MVC architecture differently. The way I have it setup is as follows - Unity3d has its own View, Models, and the Controller is the connection to Photon. On the server side, you have models, controllers - which talks to the DB, and the View is the output to Unity3d. It looks confusing because you have a view feeding a controller, but that is the easiest way to think about it.

    Christian