HomeWildfire Games

Remove references from the random mapgen library to terrain globals of maps.
AuditedrP20405

Description

Remove references from the random mapgen library to terrain globals of maps.
Maps should not be required to define all these globals and use them with the connotation implied by these utilities.

Split utilityfunctions.js to gaia_entities.js and gaia_terrain.js to make it more transparent what files contain, refs #4804.
Document these functions #4831.

Refactor stoneMine placing and use for...of loops.
Fix Extinct Volcano call.
Forest utilities will be handled separately.

Details

Auditors
temple
Committed
elexisNov 4 2017, 12:17 PM
Parents
rP20404: Remove duplicated builder list.
Branches
Unknown
Tags
Unknown
Build Status
Buildable 3603
Build 6254: Post-Commit BuildJenkins

Event Timeline

elexis added inline comments.Nov 4 2017, 12:19 PM
/ps/trunk/binaries/data/mods/public/maps/random/extinct_volcano.js
270

It used clDirt (which happened to be 5) as the count argument.

temple raised a concern with this commit.Nov 26 2017, 9:30 PM
temple added a subscriber: temple.

Mainland pizza, before:

And after:

/ps/trunk/binaries/data/mods/public/maps/random/mainland.js
223

no constraint or tileclass here

/ps/trunk/binaries/data/mods/public/maps/random/rmgen/utilityfunctions.js
218–219

these two lines weren't moved over

This commit now has outstanding concerns.Nov 26 2017, 9:30 PM
elexis added inline comments.Nov 26 2017, 9:40 PM
/ps/trunk/binaries/data/mods/public/maps/random/mainland.js
223

Thanks for finding out the revision, understanding what this does. I'll reread all calls to test if I missed a second one!

elexis added a comment.EditedNov 27 2017, 1:18 AM

Bug was hard rarely noticeable on normal map sizes, because animals self-correct collisions after some seconds of moving.
Only on tiny maps we get such a messed up situation because of the mapsize independent animal count and missing constraint.
The constraint was missing in < 5 cases but the clFood class in many places, which resulted in more animals.
I will verify the other calls tomorrow (as in later today).

Edit: ah, the constraint was forgotton because it was almost everywhere present before and missed in the place that didnt have it. Screw defaults.

elexis requested verification of this commit.Nov 27 2017, 2:35 AM

Read through all createFood, createDecoration, createMines calls again, but not the other functions.

This commit now requires verification by auditors.Nov 27 2017, 2:35 AM
temple accepted this commit.Nov 27 2017, 5:06 AM

Mainland looks fixed, thanks. I didn't go through all the files.

I'm sure you're on top of this elexis, but I thought I'd mention it anyway: For example on mainland, the create food avoid classes don't contain the metal or rock classes, so we can get berries insides mines. Then the straggler trees don't check against the food class, so we can get trees inside elephants.

All concerns with this commit have now been addressed.Nov 27 2017, 5:06 AM

Mainland looks fixed, thanks. I didn't go through all the files.

I'm sure you're on top of this

Code > people

but I thought I'd mention it anyway

You are obligated ;-)

For example on mainland, the create food avoid classes don't contain the metal or rock classes, so we can get berries insides mines. Then the straggler trees don't check against the food class, so we can get trees inside elephants.

I only looked for regressions in this commit. The berry inside stone collision on mainland you mentioned exists since introduction in rP14161.
Resource collisions are a running gag in rmgen. I believe FeXoR wishes for a mechanism to test against Footprint sizes everywhere, but that will be a bit of work, especially when intending to keep the looks of current maps.
I can fix the reported ones, but I have things to do before I can proofread all the other possible resorce collisions. In case you want to dig out some, I'll wait with committing the reported ones.

Mainland looks fixed, thanks. I didn't go through all the files.

I'm sure you're on top of this

Code > people

but I thought I'd mention it anyway

You are obligated ;-)

For example on mainland, the create food avoid classes don't contain the metal or rock classes, so we can get berries insides mines. Then the straggler trees don't check against the food class, so we can get trees inside elephants.

I only looked for regressions in this commit. The berry inside stone collision on mainland you mentioned exists since introduction in rP14161.
Resource collisions are a running gag in rmgen. I believe FeXoR wishes for a mechanism to test against Footprint sizes everywhere, but that will be a bit of work, especially when intending to keep the looks of current maps.
I can fix the reported ones, but I have things to do before I can proofread all the other possible resorce collisions. In case you want to dig out some, I'll wait with committing the reported ones.

I tested a bit (with 300x food and stragglers) and collisions happened but they were rarer than I expected, so maybe there's other stuff going on that I'm not aware of. Anyway, I don't want to interfere with or duplicate your work, so I'll wait until you're "done" before seeing if I can find any improvements.

The missing clFood in the straggler tree constraint sems like a systematic error, because most if not all calls appear to be affected.
I've added the task to #4600.
That issue might even be caused by the hiding of the clFood class that this commit reverted.
Berries inside trees were likely not reported as a major issue because of the missing obstruction of berries.
Just make sure to not forget your ungarrisonable regicide hero on tiny 50 pop danubius anymore.