Jump to content

How to design a pulgin architecture


Recommended Posts



I am thinking to develop a strategic game and I want to develop or use an existing plugin architecture to make my game extensible by other developers.


I will use PHP/Mysql for the backend, front end with jQuery for the site structure and Phaser for the game section.


Any idea where to found information, docs, fameworks, etc ?





Link to comment
Share on other sites

There are probably a million different ways to achieve what you want and it is very specific to how your app works.


For example, what do you mean by extensible? Developers can make plugins and attach them somehow to your game? How do you envisage them doing so? How is your game distributed? Or is it just available via one url? Or do players have to download the game and set it up on their machine/server somehow?


All these questions need answers before you get any decent answers.


The most generic plugin architecture involves specifying modules to use pre-build. If we simplify and assume your plugins only affect your client code i.e. your JS, and that PHP is simply serving data to allow the client to run, then you'll need some way to either inject the scripts at run-time or have a build step that incorporate the JS right into the rest of your code, build it, then serve up the combined bundle/s. Even if the core logic of your game lives in PHP and is exposed via your API, you still need to find a way to mesh your core game code and the module code you're allowing users to add.


All of this is very complex and involves many different aspects of programming and deploying programs.


I guess it comes down to this: What is your initial (naive) idea for solving this problem for your game?


If you have no answer for the above question then you're a long way off fulfilling your desire for an extensible modular game.


You have to work out firstly how to get module code into your core game code (either before or after build/serve) and then work out which areas of your game code are exposed to modules.

Link to comment
Share on other sites

Yeah, sorry, havent found any articles about it. It would be fairly hard to write as it touches a broad spectrum of knowledge and is usually very application-specific.


I'm trying to write in some extensibility into my next project, once I've got that up and working I'd be happy to share my experiences.


If it helps you at all—it'll be pre build most likely. I'm planning on having a web-only client, i.e. you just hit a url and play, but you can also fire up a server to play and that is the extensible bit i.e. add your modules, run a few build scripts (they reference the custom modules), fire up the server, play. I could, in theory (and maybe in practise, not sure yet), add additional scripts to the page during the initial load (i.e. during app lifetime) but I think, in my case, that'll be more troublesome than the pros. Might be an avenue though if I want people to be able to play without firing up their own server or downloading the app (I'd wrap it in node and chromium via Electron).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...