Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: Mapgen elements "density" and "roof" of "terrain". #33284

Merged
merged 2 commits into from
Aug 17, 2019
Merged

doc: Mapgen elements "density" and "roof" of "terrain". #33284

merged 2 commits into from
Aug 17, 2019

Conversation

free-coffee
Copy link
Contributor

@free-coffee free-coffee commented Aug 16, 2019

Summary

SUMMARY: None

(documentation, density is in mapgen.cpp/139-193)

@ZhilkinSerg ZhilkinSerg added <Documentation> Design documents, internal info, guides and help. [Markdown] Markdown issues and PRs Map / Mapgen Overmap, Mapgen, Map extras, Map display labels Aug 16, 2019
@Hirmuolio
Copy link
Contributor

Hirmuolio commented Aug 16, 2019

I too have tried to dechipher the meaning of these for the pull I have.

It is pretty strange and I don't think I understand it all yet. But I am pretty sure that density and chance are independent. If the !one_in( chance ) ) is false everything ends and no spawn is done.

As far as I can see the number of spawned monsters comes from something like this
num = probabilistic_round( density * spawn_density * rng_float( 10.0f, 50.0f ) )

After each spawn cost_multiplier * pack_size is subtracted from num
Once num is not positive anymore the spawning stops.

So I think the total spawns is (with roundings removed) about number_of_monsters = density * spawn_density * rng_float( 10.0f, 50.0f ) / cost_multiplier but this may be wrong.

@ZhilkinSerg ZhilkinSerg merged commit a09aa8b into CleverRaven:master Aug 17, 2019
@free-coffee
Copy link
Contributor Author

free-coffee commented Aug 17, 2019

@Hirmulolio: Maybe i missed the float multiplication? Im certain the overmap densities (spawn_density) were added and not multiplied though. And /cost_multiplier would be wrong, since different monsters with different costs can spawn & subtract from the pool.
I won't look at this for some time - feel free to update after #33256.

@Hirmuolio
Copy link
Contributor

Hirmuolio commented Aug 17, 2019

Edit: Oh it is different code that looks similar and does kind of the same thing but is actually different.

map::generate VS class jmapgen_monster_group with map::place_spawns

misterprimus pushed a commit to misterprimus/Cataclysm-DDA that referenced this pull request Sep 21, 2019
…#33284)

* doc: Mapgen elements "density" and "roof" of "terrain".

* doc: the implementation is roll (float<1) in 1, so it is confusing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Documentation> Design documents, internal info, guides and help. Map / Mapgen Overmap, Mapgen, Map extras, Map display [Markdown] Markdown issues and PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants