procedural content generation

Does anyone know what specific knowledge I should have to create a 2d tile-based level generator, like the Diablo series? I want to use it in a networked game, so the server will generate the map using some input, such that the input can be sent to the clients and generate the same map.

Please let me know of some algorithms I can study that can open my mind in this area, and lead to the development of my own solution. Thanks in advance!

This might be a good algorithm to incorporate.
You could have a fixed distribution of tiles for the level and pull them in completely randomly.
You could also adjust the randomness a bit based on what tiles are adjacent to the new tile, even to the point of specifically prevent certain tiles from being next to one another.
If you want to have all walkable tiles of the level reachable, you will need to do some form of path finding (A*, etc.) to ensure that you can actually get to a newly placed walkable tile.

If the server has already made the entire map, why wouldn’t you simply push a small section of map to the corresponding user(s).

Sending a ‘seed’ to the client so that it can generate its own map is dangerous because your actually relying on trust with the client.

You can use the Drunkard’s Walk algorithm. I used it in a open source maze generator: http://www.otcsw.com/maze.php and I improved on the algorithm and used it in this game: http://www.otcsw.com/sinuosity.php

If you want the improved algorithm, I can send it to you. Basically by iteratively adding rooms it loses a bit of randomness, so I changed it to add rooms at random locations instead.

Well, actually, it’s no more dangerous than sending the entire map (or having it included with the client download).
If you want to limit the visible area to the player, send a unique seed for every n*n tiles.

Just make sure that the server double checks that the player really could pass that wall, and that the player really could reach that item. (But you have to check this regardless of if you send the seed or the actual map)

As for the original post:

I’ve been interested procedural content for a while now, and my best advice is probably to just draw a map on paper, looking roughly how you’d want the generated maps to look, but think about HOW you draw it. If you start by adding a huge room, then adding corridors from that and smaller rooms at the end, then that might be a good way for the algorithm to work.

There are some articles in the roguelike news archives, of varying quality.

Thanks for the replies everyone. I will post all of my developing ideas here.

Not too worried about this, since the server screens all the in-coming messages, and logs the potentially illegitimate requests(either a bug or malicious stuff). The only thing visible to the client is the collision information, to do client-side guessing stuff. :slight_smile: