views:

721

answers:

5

Hi there,

I am currently working on 2D browser game.

After putting the ZendFramework away, my team and I decided to write our own framework.

Now we are helpless, because none of us has ever developed anything similar, except CMS frameworks etc.

The language is PHP and the database driver used for it is MySQL(i, PDO, etc)

Can you give us any tips about structuring the framework?

Thank you ;)

Example of the genre the should fit in

  • Ogame
  • Travian
  • Zarrenwar

(My) Requirements (to the framework)

  • Basic API
  • No oberwhelming amount of functionality, which I can not handle, and I do not need

My idea of (my) the framework

  • Some sort of "backe-end"
  • Managing the database
  • Handling registrations, HTTP requests
  • Generating chances that something ingame will or will not happen
  • no graphical mechanisms, just computing income, daytime, damage of tank xy, etc.

By the way, the frameworks I tested were not php game engines, because I never found any php game engine freely available.

+5  A: 

What are your reasons for writing an own framework? Are you sure you want to divert your energy to re-inventing the wheel (which is likely to become a messy process, as you do not seem to have much experience)? A clean, stable framework is the groundwork of any project and if you have to fix that all the time, the project relying on it will suffer horribly. Why not choose a well-supported open source framework for which you can get community support?

Believe me, you will have enough work to do with the actual browser game. :)

Pekka
...because I did not found any os framework matching to our conditions? The frameworks out there, are made for web-applications, well, but not for web-based games.
daemonfire300
Maybe you want to edit your question in that case and define what your needs are.
Pekka
I agree with this - you can't meaningfully write your own game framework until you have written a game and know what you need for it. Build the prototype before you construct the production line.
Kylotan
You can see the edit above.
daemonfire300
+1  A: 

I'm not quite sure what kind of game you have in mind, but PHP in itself is not the right programming language or technology for writing the 2D aspect of the game.

You claim to have experience with CMSes, which is good, because this can be used/adapted to CRUD game state and entities.

But for the graphics, consider using Flash or similar technologies. Mabye just plain javascript with the new html5 canvas, and a php backend.

And about frameworks, although i do not have experience with any of them, there are plenty for flash and a simple google search revaels lots of active experiments and research for javascript game engines.

Sander Versluys
+1  A: 

If you want to develop your own framework, I suggest you first develop a couple of games using existing frameworks, use your experiences about what works and what your needs really are, and then develop your framework using that knowledge. My guess is that that would be faster than developing a framework from scratch.

But I think what you really want is to develop a game, and you think that developing your own framework would be faster than finding an existing and tried framework and learning to use it. Am I right?

Zano
Yes, and no. I want to write my own engine to create a game on the one hand but on the other I want to achieve a higher level of programming through doing this.
daemonfire300
+1  A: 

PHP is not going to have any capability for doing a graphic game, as it could create sprites on the fly, but it runs on the server-side, and all the action is on the browser.

So, your game engine needs to be on the side where you are doing your graphics.

You may want to write a framework for the world, so that multiple users can experience the same world, and affect each other, in that case PHP would be fine, as it would just be keeping a model of the world and determining what happened.

So whatever you are using on the browser to show the graphics will most likely already have a game engine either developed or being developed for it, so you may want to write down your requirements for a game engine and you can then ask that question: I have these requirements, and having looked at these game engines, which I rejected for these reasons, what engine may be best for my needs.

It would be nice to know not only your requirements but why you rejected some of the engines out there before giving suggestions.

James Black
+4  A: 

i think what you are really looking for is a javascript game engine, as PHP alone isn't going to provide much to help with in-game 2D interaction (moving sprites, changing scores, etc). Maybe take a look at one of the several javascript game engines like:

and several others which are pretty easy to find...

Scott Evernden