Question

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 overwhelming 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.

Was it helpful?

Solution

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.

OTHER TIPS

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...

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. :)

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.

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?

I once made a Game in PHP, A strategy game, I combined JQuery (JS) and PHP, Im still working on it though but I would start making Classes and Functions (TIP: Use OOP), After finish, Make the Game.

  1. OOP Framework (Classes and Functions) - 1 Day / 2 Months
  2. Graphics - 2 Days / 5 Months
  3. Timeline and Game interfaces - 1 Month / 1 Year

--------- TOTAL: MAX. 1 Year and 7 Months - MIN. 1 Month and 3 Days ---------

The time is just the Average time it takes to make the System.

Good luck :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top