NYCPHP Meetup

NYPHP.org

[nycphp-talk] online games

Marcin Szkudlarek d126099 at atos.wmid.amu.edu.pl
Sun Nov 6 07:00:28 EST 2005


Thanks, for all replies. Michael, I understand your concept very 
well. Actually, I thought about similar solution before posting my 
question on the list. But I thought about the same thing you had mention - 
complexity. Now I have to think about it once again.

Marcin (from Poland :)

On Sat, 5 Nov 2005, Michael Haszprunar wrote:

> Marcin Szkudlarek wrote:
>> Hi!
>>
>> I'm thinking about developing online game in php  like:
>> http://games.swirve.com/utopia
>> or
>> http://ogame.org
>>
>> Both of them are real-time strategy  games. This means that if you make
>> some action in this games, you have to wait for a certain amout of time to
>> see the result. For  example sending an army to attack another province
>> takes few hours of a real-world time.
>> My question is , how can I update periodically these kind of data in the
>> database? I think I can do it using cron, updating game database every
>> hour for example. Is there any other way? Usually you don't have access
>> to tool like cron..
>>
>> Marcin
>
> Hi,
>
> I'm just doing the same and had to do the same thinking. Our solution:
> Each dataset (for example the users credits) get a timestamp (last
> update). If a function manipulates this value, the timestamp gets
> updated. Every time another player accesses this value (for example he
> sends our a spy to see the opponents agent) the game has to check if the
> value is still correct (maybe tax were paid in the meantime and the user
> has not yet logged in to calculate) and if the value is outdated, the
> value has to be calculated correct, updated and a net timestamp is given.
> The advantage is, that you don't have to calculate ALL new values at the
> same time (which can be very complex and long running, depending on the
> users), but you just calculate the new value on access. The second
> advantage is, that you don't need a cron, which is not availiable in any
> hosting environment.
> The disadvantage is, that you need a more complex data storage and a
> on-access data consistency check.
>
> We tried it and it works great (although the final test is still to come
> because our project is about 0.1% complete).
> Hope you understand my point, my english is not very good ...
>
> Michael from Germany
> _______________________________________________
> New York PHP Talk Mailing List
> AMP Technology
> Supporting Apache, MySQL and PHP
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.nyphp.org
>



More information about the talk mailing list