Determinism

Off topic discussion. Talk about gaming and life in general. Be awesome to each other.
Post Reply
User avatar
pango
Posts: 3347
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Determinism

Post by pango »

Hi all,
I wonder if you're aware of the use of determinism in games, and what's your take on it. Let me try to explain what I have in mind.

Daggerfall uses randomness for many things, like who will give you quests, what random quests a quest giver will provide, the exact monsters you'll find in dungeons, their loot, etc.
But not everything is random either; For example the way each dungeon looks is stored in the game files, so everybody playing Daggerfall, today or ten years from now, going to the same place, will get lost in the same corridors, with the same textures, furnitures, etc. (obviously talking about non altered game here)

But there's something in between. Since in computers we're usually using pseudo-random generators instead of real random numbers, if we force a specific seed value in a generator we'll get the same sequence of numbers every time. In other words, the generated sequences will look just as random, except they're a function of the seed value.

This can have several uses, to give some examples:
- terrain generator: if we seed the random generator used for height with its absolute (X, Y) coordinates in the world, then the same location will always be created/altered the same way, without having to store anything. That's basically what's used to generate very large or even infinite universes;
- weather (as an example of time based world property): imagine saving your game, traveling to some remote place, and finding an heavy fog on arrival. If you don't like it, a cheap way around is to reload and hope a different weather will be drawn. But if the weather is deterministic, the only way to get a different weather after reload is to go somewhere else, or at a different time.
- NPCs/monsters behavior: if after saving you fail to sneak past a monster whose unperturbed behavior is deterministic, then after reload you'll have to try something different: go another route, distract the monsters instead,... You can't rely so much on luck, but on the other hand each time you retry you have more information and make better decisions. I think this is an interesting way to make game mechanics deeper.
I'm sure they're other interesting uses I didn't think of...
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Determinism

Post by Interkarma »

It's a really fascinating concept! Daggerfall Unity uses this to generate consistent elevations and foliage layouts per terrain tile by seeding generators with the world coordinates, as you mention above.

Building names also use determinism for generation in Daggerfall. You might be interested in the article I wrote about this a couple of years back. In order to get this right, I actually had to dig up the source code for an old version of the C compiler used to build Daggerfall to ensure my random number generator would match Daggerfall perfectly no matter the platform. There's other deterministic processes in Daggerfall as well (e.g. NPC names, dungeon textures, spell costs).

One of the things that attracted me to Daggerfall initially was the range of random and procedural processes to make the world tick. Even now with most of those systems re-implemented in Daggerfall Unity, it's still fascinating to me.

BTW, I'll move this up to Community as it's more of a general tech discussion than related to modding specifically. :)

Al-Khwarizmi
Posts: 177
Joined: Sun Mar 22, 2015 9:52 am

Re: Determinism

Post by Al-Khwarizmi »

pango wrote: Sun Aug 26, 2018 3:23 pm I'm sure they're other interesting uses I didn't think of...
Another example where they're interesting: the roguelike Brogue, as roguelikes tend to do, generates a different dungeon and different challenges for you in each new game. But it provides you with the seed it has used, and you can manually enter that seed to get that very same dungeon.

This is used for example in competitions: a random seed is drawn, and everyone has to play the dungeon generated from that seed. That way, you get the randomness and unpredictability of a roguelike (you are playing a dungeon that you have never seen before), but at the same time the competition is fair because everyone is playing the exact same dungeon.

It's also nice to share experiences or give challenges: "Wow, I got this level with seed 1294190 which is phenomenally hard, try if you can steal the sword from the vault in the NW", etc.

User avatar
pango
Posts: 3347
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Determinism

Post by pango »

I'm glad to hear it's something already in use.
Yeah, I forgot about names generation, another good use case.

@Al-Khwarizmi: another excellent use of this idea, even if I can't think of a way to translate that into Daggerfall context...
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

Post Reply