incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leszek Lach <leszekl...@gmail.com>
Subject Re: Couch + desktop game?
Date Sat, 12 Feb 2011 18:46:40 GMT
You can try to make it like an online game and instead - run it locally.
This way - the player won't be able to modify the data, directly.. Unless he
will know how the data is computed server-side and how it is stored in the
couchdb.

When it comes to the online games - the client can't send or put ANY
information that would trigger the updates server-side.
It should just send the INPUT information events (keyboard/mouse, etc). It
shouldnt be even able to know if the server has received it or not.
Its up to server-side software to parse the incoming data and to decide if
it's complete, correct (you need to check if the player hasn't changed the
packets), to recompute (for example) the position of the player on the map
based on these discrete values that have been received over time  and then -
to inform inform the client about his CHANGE in position, status
(hp/ammo/whatever), etc.

In short: client should only be able to GET the data from the server and
display it - thats all.
All the operation, math should be done server-side.

Pattern:
1. client is sending discrete values over the time and listening for server
data to update the visual representation
2. server is receiving the discrete values from the client (registered
events. for example - which buttons were pushed/un-pushed plus the time
stamps, etc and based on this information - it's doing all the math like
calculating the [x,y,z] position based on the last direction vector, etc).
Then - the server is sending the information to the client.
3. Client is changing the visual representation, based on the solution that
has been received from the server. And then - sending a new information
about events triggered by the user.. Again - back to the point 1.

-- 
Leszek Lach

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message