NYCPHP Meetup

NYPHP.org

[nycphp-talk] online games

Alberto dos Santos yournway at gmail.com
Sat Nov 5 09:31:29 EST 2005


Then you have things like Evolution, which have an universal clock
that ticks like a regular  clock, meaning 1 tick is 1 hour.
Every action is based on that assumption and this allows, for example
for users to group and plan attacks, bcause everybody has the sime
time, a little like Swatch time.

On 05/11/05, Michael Haszprunar <michaelhasz at gmx.net> 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
>


--
Alberto dos Santos
Consultor em TI
IT Consultant

http://www.yournway.com
A internet à sua maneira.
The Internet your own way.



More information about the talk mailing list