1
0
Fork 0

Improve balancing for early game

This commit is contained in:
ancientmarinerdev 2023-01-31 18:04:01 +00:00 committed by Gitea
parent cfa276f722
commit b817c079ba
2 changed files with 11 additions and 14 deletions

View File

@ -26,7 +26,6 @@ local table_copy = table.copy
local table_remove = table.remove local table_remove = table.remove
local pairs = pairs local pairs = pairs
-- TODO Set logger to false as default
local LOGGING_ON = minetest.settings:get_bool("mcl_logging_mobs_spawning", false) local LOGGING_ON = minetest.settings:get_bool("mcl_logging_mobs_spawning", false)
local function mcl_log (message) local function mcl_log (message)
if LOGGING_ON then if LOGGING_ON then
@ -34,7 +33,6 @@ local function mcl_log (message)
end end
end end
local dbg_spawn_attempts = 0 local dbg_spawn_attempts = 0
local dbg_spawn_succ = 0 local dbg_spawn_succ = 0
local dbg_spawn_counts = {} local dbg_spawn_counts = {}
@ -59,15 +57,15 @@ local SPAWN_MAPGEN_LIMIT = mcl_vars.mapgen_limit - 150
local mob_cap = { local mob_cap = {
hostile = tonumber(minetest.settings:get("mcl_mob_cap_monster")) or 70, hostile = tonumber(minetest.settings:get("mcl_mob_cap_monster")) or 70,
passive = tonumber(minetest.settings:get("mcl_mob_cap_animal")) or 10, passive = tonumber(minetest.settings:get("mcl_mob_cap_animal")) or 13,
ambient = tonumber(minetest.settings:get("mcl_mob_cap_ambient")) or 15, ambient = tonumber(minetest.settings:get("mcl_mob_cap_ambient")) or 15,
water = tonumber(minetest.settings:get("mcl_mob_cap_water")) or 10, water = tonumber(minetest.settings:get("mcl_mob_cap_water")) or 8,
water_ambient = tonumber(minetest.settings:get("mcl_mob_cap_water_ambient")) or 20, --currently unused water_ambient = tonumber(minetest.settings:get("mcl_mob_cap_water_ambient")) or 20, --currently unused
player = tonumber(minetest.settings:get("mcl_mob_cap_player")) or 75, player = tonumber(minetest.settings:get("mcl_mob_cap_player")) or 75,
total = tonumber(minetest.settings:get("mcl_mob_cap_total")) or 500, total = tonumber(minetest.settings:get("mcl_mob_cap_total")) or 500,
} }
local peaceful_percentage_spawned = tonumber(minetest.settings:get("mcl_mob_peaceful_percentage_spawned")) or 30 local peaceful_percentage_spawned = tonumber(minetest.settings:get("mcl_mob_peaceful_percentage_spawned")) or 35
local peaceful_group_percentage_spawned = tonumber(minetest.settings:get("mcl_mob_peaceful_group_percentage_spawned")) or 15 local peaceful_group_percentage_spawned = tonumber(minetest.settings:get("mcl_mob_peaceful_group_percentage_spawned")) or 15
local hostile_group_percentage_spawned = tonumber(minetest.settings:get("mcl_mob_hostile_group_percentage_spawned")) or 20 local hostile_group_percentage_spawned = tonumber(minetest.settings:get("mcl_mob_hostile_group_percentage_spawned")) or 20
@ -850,8 +848,7 @@ if mobs_spawn then
local spawning_position = find_spawning_position(pos, FIND_SPAWN_POS_RETRIES) local spawning_position = find_spawning_position(pos, FIND_SPAWN_POS_RETRIES)
if not spawning_position then if not spawning_position then
-- TODO do we log to user minetest.log("action", "[Mobs spawn] Cannot find a valid spawn position after retries: " .. FIND_SPAWN_POS_RETRIES)
--mcl_log("abandon this")
return return
end end
@ -898,7 +895,7 @@ if mobs_spawn then
-- Spawn caps for animals and water creatures fill up rapidly. Need to throttle this somewhat -- Spawn caps for animals and water creatures fill up rapidly. Need to throttle this somewhat
-- for performance and for early game challenge. We don't want to reduce hostiles though. -- for performance and for early game challenge. We don't want to reduce hostiles though.
local spawn_hostile = (mob_spawn_class == "hostile") local spawn_hostile = (mob_spawn_class == "hostile")
local spawn_passive = (mob_spawn_class == "passive" or mob_spawn_class == "water") and math.random(100) < peaceful_percentage_spawned local spawn_passive = (mob_spawn_class ~= "hostile") and math.random(100) < peaceful_percentage_spawned
-- or not hostile -- or not hostile
--mcl_log("Spawn_passive: " .. tostring(spawn_passive)) --mcl_log("Spawn_passive: " .. tostring(spawn_passive))
--mcl_log("Spawn_hostile: " .. tostring(spawn_hostile)) --mcl_log("Spawn_hostile: " .. tostring(spawn_hostile))

View File

@ -115,8 +115,8 @@ mobs_griefing (Mobs change blocks) bool true
# If enabled, mobs won't damage particles when they got hurt. # If enabled, mobs won't damage particles when they got hurt.
mobs_disable_blood (Disable mob damage particles) bool false mobs_disable_blood (Disable mob damage particles) bool false
#Percentage of peaceful spawn attempts that succeed (default:30) #Percentage of peaceful spawn attempts that succeed (default:40)
mcl_mob_peaceful_percentage_spawned (Peaceful percentage success) int 30 0 100 mcl_mob_peaceful_percentage_spawned (Peaceful percentage success) int 35 0 100
#Percentage of peaceful spawn attempts that are group spawns (default:15) #Percentage of peaceful spawn attempts that are group spawns (default:15)
mcl_mob_peaceful_group_percentage_spawned (Peaceful group percentage) int 15 0 100 mcl_mob_peaceful_group_percentage_spawned (Peaceful group percentage) int 15 0 100
@ -133,11 +133,11 @@ mcl_mob_cap_player (Mob cap per player) int 75 0 2048
#Maximum amount of monsters that will spawn near a player (default:70) #Maximum amount of monsters that will spawn near a player (default:70)
mcl_mob_cap_monster (Mob cap monsters) int 70 0 2048 mcl_mob_cap_monster (Mob cap monsters) int 70 0 2048
#Maximum amount of animals that will spawn near a player (default:10) #Maximum amount of animals that will spawn near a player (default:13)
mcl_mob_cap_animal (Mob cap animals) int 10 0 1024 mcl_mob_cap_animal (Mob cap animals) int 13 0 1024
#Maximum amount of water mobs that will spawn near a player (default:10) #Maximum amount of water mobs that will spawn near a player (default:8)
mcl_mob_cap_water (Mob cap water) int 10 0 1024 mcl_mob_cap_water (Mob cap water) int 8 0 1024
#Maximum amount of ambient mobs that will spawn near a player (default:15) #Maximum amount of ambient mobs that will spawn near a player (default:15)
mcl_mob_cap_ambient (Mob cap ambient mobs) int 15 0 1024 mcl_mob_cap_ambient (Mob cap ambient mobs) int 15 0 1024