Friday, January 8, 2010

Looking ahead

Once you have a procedurally generated world of any kind, you have to ask yourself how it's going to be used. Sure, we know in my case it's going to be used for a rogue-like roleplaying game, but beyond that I mean how the player is going to play through it.

Once a dungeon is built and the player delves into it, clears out all the monsyers and grabs all the treasure laying around; what happens to it? Should the dungeon fade away to be replaced by another one later? Should the dungeon get refilled with more random monsters and treasure? If so, how long should it take? Instantly, so the player never needs to go looking for a new place? After a predetemined, or even random length of in-game time forcing the player to go back to town? After a year so only after the player has cleared a hundred other dungeons can they come back?

A solution on another blog I read inspired me to the solution I offer. Every map has two states of information - who currently 'owns' the map, an who is supposed to own the map. Thus, a map within orcish territory is supposed to be owned by the orcs, although it could be actually owned by the humans, or the elves, or even nobody if the player just ran through and killed everything. That part's simple.

Next, each map knows who is currently owning the maps adjacent to it, and for simplicity's sake we'll say there are four of those, one in each compass direction. So, each map has six crucial peices of information to be used in the next step - spawning.

Every map is constantly (if slowly) spawning creatues based on those four peices of information. Each group represented in the six areas (supposed to own, actually own, and owns north, owns east, owns south, owns west) spawns slowly into the map - probably at an even rate, with the group supposed to own the map highest of all. Obviously, this will probably lead to a conflict in who actually owns the map, if more than one group is represented, but that's fine - conflict is what makes the engine easy. You see, if humans own a square, and strong human units spawn into the adjacent square, eventually they will take over that adjacent square, having lots of spare units there, though they will constantly be under attack. Then,a single strong orc unit could spawn into it, and then the map would be quickly owned by orcs again - changing the power balance.

This way, the player could pass through a village one day (which normally only spawns peasants) and two days later pass through to find it overrun by orcs. The player kills them all, goes away, and comes back later to find the town once again filled by peasants, respawned once there were no orcs to kill them.

Dynamic background information makes the player feel a lot stronger about their influence in the world, but also that it doesn't seem like the world is totally at their control. A player who kills everyone in a town then comes back three weeks later to see everyone still laying in the street knows that nothing will happen they don't control. A player who walks into a town they like and finds they have to save it from monsters feels like they make a difference, and that the world is more real. Which,of course, is something we really want.

No comments:

Post a Comment