View Single Post
Old May 5, 2022, 18:56   #4
Quirk
Swordsman
 
Join Date: Mar 2016
Posts: 462
Quirk is on a distinguished road
Quote:
Originally Posted by Nick View Post
  • Chests;
  • Object and monster creation and management;
  • Dungeon generation.
I would recommend adopting a different approach than Sil does here, but there will be some consequences which are tricky to predict or debug.

Sil's object/dungeon generation approach is to throw stuff at the wall and see if it sticks. Probabilistically, eventually it will. See for instance the while(TRUE) loop in generate_cave() in generate.c.

This is bad; it's an algorithm not guaranteed to terminate. It would be preferable to throw the entire thing away and use a deterministic algorithm.

For dungeon generation it's unlikely people will notice a difference. With object generation (one infinite loop here being in place_object in object2.c) the critical question has to do with mapping the way rarity works across, so the rarest items don't become significantly more or less rare. Understanding the failure cases from get_obj_num and how they actually impact the rarity calculations will be necessary if approximation of Sil 1.3 behaviour is desired.

Both of these are pieces of work I have long put off. It's possible they're not as gnarly as they look. From a Beleriand perspective it is probably more important to have comprehensible object generation and rarities that map to real percentages, so it may not be not worth devoting too much effort to replicating 1.3 behaviour unless you anticipate people playing this instead of original 1.3; this is a constraint I have that you possibly don't.
Quirk is offline   Reply With Quote