Page 1 of 1

Shared objects between several pages on Apache

Posted: Tue May 31, 2005 4:35 am
by patoch74
Hello,
I am trying to set up a little game, using php and flash.
I built a "Map" objects where players can run their figure.
Now I would like to have this Map in a global variable / shared objects persistent in memory, to avoid storing all that in a database...
Daoes Anyone has an idea about how to do that ?
Many thanks for your help !
Patrick :?:

Posted: Tue May 31, 2005 1:26 pm
by Skara
take a look at classes.

Posted: Tue May 31, 2005 1:32 pm
by timvw
and read up about http://www.php.net/shmop (shared memory operations)

Posted: Wed Jun 01, 2005 2:54 am
by patoch74
Thanks for your support !
Actually, in the classes section, I could not find any relevant information concerning this problem.
The shared memory section is interesting, but it seems that you will only be able to use it as a file. In the present case, I would like to store a complete object, which means that I would need to serialize it before storing it in shared memory.
To make it more simple, I wished I could use some global variable ($_ENV for example) to store it or create a "game session" accessible by all user sessions ...
If anyone has a clue ... your guiding is appreciated !
Patrick

Posted: Wed Jun 01, 2005 4:28 am
by timvw
php doesn't have application/script wide variables...

So you are forced to implement it yourself using shmop/database/file/whatever...