Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm trying to develop a multi player game web app which basically should be able to achieve the following goals:

  • Provide a game engine + framework/toolkit to let third party corporation integrate their own developed games.
  • Games must run realtime and multiplayer.

So the idea is to develop some kind of framework or toolkit to easily accomplish above goals.

As long as I don't want to reinvent the wheel and I need to validate each client action, and while following the premises below, I would like to know your opinion:

  • Web app is going to be developed using PHP language.
  • Clients connections are going to be managed through socket.io.js
  • Server validations will run on Node.js
  • I need to adopt a game engine that can run on top in order to let third party develop their custom games, which one?

As I'm no expert I'm looking some kind of advice or feedback based on your experience and also to let me know if I'm going in the right direction.

share|improve this question

1 Answer 1

Currently I've been developing a game, which is an implementation of my application state management system - similar to how a game would be developed in C++.

Basically. The entire game is run through index.php - and the Program class sets and changes the program state. Each state is its own abstract class with two primary functions.

      /* State Keys: List of States */
      class States
      {
          const MyState = 0;
      }

      /* A custom program state. */
      class MyState extends State
      {
          public function Permissions()
          {
                global $User;

                /* User Required to be logged in to view state. */
                if ( !$User->LoggedIn ) return false;

                /* Permissions Okay! */
                return true;
          }

          public function Run()
          {
                printf( "MyState is Running." );
          }
      } $MyState = new MyState;

      /* Add State to Stack - assigned to Key States::MyState */
      /* Now this state can be called by... */
      /* $Program->ChangeState( States::MyState ); */
      $Program->AddState( States::MyState, $MyState );

Now the program sets the DefaultActiveState to something like a login page, then login calls...

      /* After login... */
      $Program->ChangeState( States::MyState );

Now when index.php is loaded, the program determines what state to run by bassing ActiveState off of a session - this way we don't lose what state is currently supposed to be running.

      /* index.php : Main Program */
      include "template header";

      /* This function... */
      $Program->Run();

      /* ... Calls $Program[$_SESSION["ActiveStateKey"]]->Run(); */

      include "template footer";

When ChangeState is called, it simply sets the ActiveState function and then redirects page (reloads index) and Runs ActiveState->Permissions, and if returns true, runs ActiveState->Run.

Just an idea.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.