Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7170441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:12:49+00:00 2026-05-28T15:12:49+00:00

For my browser based Flex game (for the Facebook platform), I am using PHP

  • 0

For my browser based Flex game (for the Facebook platform), I am using PHP and MySQL for the server side programing and for saving data (using amfPHP)

Since I was very new to both game development and PHP and I wanted to see my game running, I have wrote all server-side coding (amfPHP services) with very ugly and dirty code which hits the DB for fetch, update the game state (including the players stats and inventory).

Definitely its not efficient, so I have started to find the best way available in PHP for implementing the caching. By caching, I mean I don’t want to hit the DB all the time to save the latest game state of the player but just save at the end of the session (when player leaves the app).

Typically, my game/app flow is like this

  • Player launches the app/game from FB
  • Authentication
  • Load user session(previously saved game state).This includes fetching the user stats like how much energy, coins, experience etc., he has, his inventory, current active quests etc. and also static information like market items, offers, drops etc.
  • Update the game state as and when there is some change in the game, most commonly when a user clicks on some building to collect, consume energy, add coins, give experience or rewards and so on.

Now, there are few things which are common data to be yield to all the players, like “market items and their prices and graphic assets etc.,” and there are player specific data.

I have some ideas in my mind and I need experts help in what I am thinking is good or bad or if there’s any better way?

Save Static(common) data permanently in the cache and have an admin panel to clear/update
After authentication, retrieve the data and save in the cache (as JSON objects) and all read/writes until the session ends will be done to the cache, after the session ends, save the cache data into DB.

Here I want to use APC. Do you think it is reliable?

I guess, in worst case, when the webserver crashes all the cache data will be lost, so I was thinking to save them in the session, but I think PHP maintains them in files which means there will be lot of I/O which is again not recommended? Or would that be acceptable?

I am also thinking how good it is to save game state in serialized objects?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T15:12:50+00:00Added an answer on May 28, 2026 at 3:12 pm

    Did you profile your application and identified the DB as bottleneck? It seems like you’re trying to optimize things that are most likely not an issue at all.

    Fetching data from the DB is really fast. Writing to DB can be a bit slower, especially if you use transactions. But the DB can still handle lots of write/update calls per second easily.

    It looks like you’re doing some premature optimization which will lower the security and stability of your whole game.. which is simply not worth it, unless you really identified the writing to DB as a performance bottleneck. Then again you really don’t want to lose user progress, because your session gets destroyed. Better look at something like NoSQL then.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a browser-based game (MMO) with a server and client, all using PHP,
I'm planning on creating a browser based RTS game using ASP.NET and MySQL. I
I want to create a browser based 3D game using LWJGL with the Java
I am implementing a browser based game with a small group of friends using
It is possible to make a multiplayer browser based game using cocos2d-javascript + node.js?
In my browser based application,we have to encrypte the image in the server side,and
I run a browser based game at www.darknovagames.com. Recently, I've been working on reformatting
When debugging browser-based apps using Google Chrome's Developer Tools, is there a way to
Background I have an existing extension designed to accompany a browser-based game (The extension
Is it possible to have XML-embedded JavaScript executed to assist in client-side (browser-based) XSL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.