Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My question relates to procedural content generation and data management of the emerging objects in a database.

I assume a networked game, with a server-client model. Unspecified objects in the game world are generated while the game is running with procedural algorithms (for example perlin noise). The players (/clients) can modify the properties of these objects, but have to notify the server of these changes. How could this communication address unique objects, so that both the server and the client know of which object they are speaking?

Not only the inner properties of the objects can differ, but also visible, such as the position. When the player wants to select one of these objects the game has to find out the id - does anyone know which methods or algorithms can accomplish that?

share|improve this question
up vote 1 down vote accepted

To simplify the discussion lets assume a 2d - world. Let us also decide the world is divided into sectors, a gird of squares.

We wish to prevent cheating so all objects are generated on the server side.

When a player reaches a certain area, the server informs the client of all relevent objects in his sector and adjacent sectors. When the player is informed of the objects, it also receives their position which is needed for rendering and their visual data which type of image or model should be rendered to represent them, as well as their bounding boxes (the space they take in the world).

When a player is near one of these objects, since the client has already received the object collection from the server, it knows their 'index' or unique id and sends a packet to the server with an object id and an action. since each movement by the player has to be authorized by the server (to prevent cheating) the server also knows where the player is standing and if she is close enough to interact with the object. If these conditions are met, the action is authorized and the object data is modified on the server side Data Model.

The object you are interacting with could be decided based on proximity and the angle in which you are facing.

share|improve this answer
You only need to send data relating to objects in the same sector as the player or nearby sectors. – zehelvion Oct 1 '12 at 13:57
But wouldn't it be enough to send only the id if all other properties were based on it (including the position?) I started with the thought that the server would only need to send one number and the world boundaries to the client, would generate its own representation of the world with the same parameters and then would be able to communicate It may seem crazy and impractical, but I just ask myself if this is possible... – 2080 Oct 1 '12 at 13:57
Well, how else would you make a world that offers an experience shared and participated by multiple players unless they all know that 'x' is a bush and 'y' is a pond. You need all the information that was randomized. You could send the positioning and object types in advance (as a patch) unless you are planning to generate them in real-time upon demand. – zehelvion Oct 1 '12 at 13:59
So it would be impracticable because the world would be too random and therefore boring and partly unmodifiable. That clarified it. I will close that question now as it has been answered. Thank you very much for your help today! (I cannot vote you up because I need more reputation, but I will, when I can :) ) – 2080 Oct 1 '12 at 14:09
You do not have to close it :) We close questions that are off-topic. And there is nothing wrong with random, roguelikes have been applying this concept for many years. I don't understand what you mean by partly unmodifiable. – zehelvion Oct 1 '12 at 14:13

In a client-server model, all procedural generation should be performed on the server. When your server generates an object, it gives it an UID, which is then used in all client-server communications.

If you're doing procedural generation on the client, then this isn't only a client.

share|improve this answer
But is it really necessary to send all data to the client, including object data that could also be generated dynamically? Because all changes are still made on the server, and the server defines the parameters for these objects i can not imagine that... The server could still set boundaries for created objects – 2080 Oct 1 '12 at 13:49
The data has already been generated dynamically. At lease the required data such as object position and type(needed for rendering) – zehelvion Oct 1 '12 at 13:56
I understand it now - I was a little bit inept, although the question below is also interesting - Thank you very much :) – 2080 Oct 1 '12 at 14:01
Basically, the player cannot see anything that has not been generated yet. If the player is close enough to interact with some objects, they have been generated and delivered to the client during gameplay or beforehand as an automated patch. – zehelvion Oct 1 '12 at 14:04
@2080 How? You want some kind of magic that packs everything about an object in one unsigned integer? You said client-server. I'm giving you client-server. You might need to do client-side prediction at some point but this is probably real YAGNI. – Laurent Couvidou Oct 1 '12 at 14:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.