open/cave mix control via tile survey

This commit is contained in:
minjaesong
2023-11-29 00:48:55 +09:00
parent 544024c282
commit bbfd3cf881
7 changed files with 65 additions and 34 deletions

View File

@@ -18,7 +18,7 @@
"MENU_IO_WORLDGEN_GROWING_MINERALS": "광물을 키우는 중...",
"MENU_IO_WORLDGEN_POSITIONING_ROCKS": "바위들의 위치 조정 중...",
"MENU_IO_WORLDGEN_RETICULATING_SPLINES": "망상 구조 결합 중...",
"MENU_LABEL_AUDIO_BUFFER_INSTRUCTION": "오디오 끊김이 들리지 않는 선에서 가장 작은 값으로 설정해주십시오.\n오디오에 끊김이 있다면 더 큰 값으로 설정하고 게임을 재시작하십시오.\n더 큰 값은 오디오 처리의 안정성을 증가시키지만 딜레이도 더 늘어나게 합니다.",
"MENU_LABEL_AUDIO_BUFFER_INSTRUCTION": "오디오 끊김이 들리지 않는 선에서 가장 작은 값으로 설정해주십시오.\n오디오에 끊김이 있다면 더 큰 값으로 설정하고 게임을 재시작하십시오.\n더 큰 값은 오디오 처리의 안정성을 증가시키지만 처리 지연도 더 늘립니다.",
"MENU_LABEL_KEYCONFIG_HELP1": "키캡을 클릭해 컨트롤을 배정하십시오",
"MENU_LABEL_SAVE_WILL_BE_DELETED": "선택된 세이브가 삭제됩니다.",
"MENU_LABEL_UNSAVED_PROGRESS_WILL_BE_LOST": "저장하지 않은 진행 상황을 잃게 됩니다.",

View File

@@ -1,28 +1,31 @@
idst;tens;impf;dsty;fmod;endurance;tcond;reach;rcs;comments
WOOD;10;10;800;1;0.173;0.17;5;18;just a generic wood
ROCK;15;210;3000;1;0.42;2.9;5;48;data is that of marble
OORE;15;210;3000;1;0.42;2.9;5;100;data is that of marble
OGEM;15;210;3000;1;0.42;2.9;5;80;data is that of marble
CUPR;210;770;8960;2;1.00;401.0;5;120;copper
EGLS;33;1000;2325;4;0.82;1.0;6;10;elven glass/moldavite
IRON;350;1085;7874;5;1.42;80.4;6;120;not wrought iron,just natural iron
ARGN;170;595;10490;9;0.91;429.0;6;120;argentum/silver
AURM;120;350;19300;9;0.88;318.0;6;120;aurum/gold
STAL;531;2520;7874;14;1.73;26.0;7;120;steel
EAUR;768;0;8192;21;1.36;1.0;7;120;elven aurichalcum
TIAL;900;0;4420;33;2.16;1.0;8;120;titanium alloy (Ti6Al4V)
ADMT;2000;4090;2700;71;3.42;1.0;8;120;adamant
OOZE;20;0;1000;1;0.08;0.5;0;10;genetic ooze,data is about human skin
BONE;130;0;2000;1;0.23;0.55;4;10;data is that of bovine bone
BRAS;315;1015;8530;3;1.00;120;5;120;brass
BRNZ;310;843;8770;3;1.20;75;5;120;bronze
TINN;220;350;7310;2;1.00;69;5;120;tin
ZINC;90;525;7140;2;1.00;116;5;120;zinc
DIRT;1;1;1400;0.0;0.0;36;0;10;dirt
PLST;1;1;1400;0.0;0.0;36;0;16;TODO plastic (polyethylene)
AIIR;1;1;1;0.0;0.0;36;0;1;air
SAND;1;1;2400;0.0;0.0;36;0;36;sand
GRVL;1;1;2400;0.0;0.0;36;0;36;gravel
idst;tens;impf;dsty;fmod;endurance;tcond;reach;rcs;sondrefl;comments
WOOD;10;10;800;1;0.173;0.17;5;18;0.5;just a generic wood
ROCK;15;210;3000;1;0.42;2.9;5;48;1.0;data is that of marble
GLSS;15;210;3000;1;0.42;2.9;5;48;1.0;glass
OORE;15;210;3000;1;0.42;2.9;5;100;0.2;data is that of marble
OGEM;15;210;3000;1;0.42;2.9;5;80;0.2;data is that of marble
CUPR;210;770;8960;2;1.00;401.0;5;120;1.0;copper
EGLS;33;1000;2325;4;0.82;1.0;6;10;1.0;elven glass/moldavite
IRON;350;1085;7874;5;1.42;80.4;6;120;1.0;not wrought iron,just natural iron
ARGN;170;595;10490;9;0.91;429.0;6;120;1.0;argentum/silver
AURM;120;350;19300;9;0.88;318.0;6;120;1.0;aurum/gold
STAL;531;2520;7874;14;1.73;26.0;7;120;1.0;steel
EAUR;768;0;8192;21;1.36;1.0;7;120;1.0;elven aurichalcum
TIAL;900;0;4420;33;2.16;1.0;8;120;1.0;titanium alloy (Ti6Al4V)
ADMT;2000;4090;2700;71;3.42;1.0;8;120;1.0;adamant
OOZE;20;0;1000;1;0.08;0.5;0;10;0.0;genetic ooze,data is about human skin
BONE;130;0;2000;1;0.23;0.55;4;10;0.1;data is that of bovine bone
BRAS;315;1015;8530;3;1.00;120;5;120;1.0;brass
BRNZ;310;843;8770;3;1.20;75;5;120;1.0;bronze
TINN;220;350;7310;2;1.00;69;5;120;1.0;tin
ZINC;90;525;7140;2;1.00;116;5;120;1.0;zinc
DIRT;1;1;1400;0.0;0.0;36;0;10;0.25;dirt
SAND;1;1;2400;0.0;0.0;36;0;36;0.25;sand
GRVL;1;1;2400;0.0;0.0;36;0;36;0.25;gravel
PLST;1;1;1400;0.0;0.0;36;0;16;0.5;TODO plastic (polyethylene)
GRSS;1;1;1400;0.0;0.0;36;0;10;-0.03;dirt
AIIR;1;1;1;0.0;0.0;36;0;1;-0.03;air
NULL;1;1;1;0.0;0.0;36;0;1;-0.03;air
# idst: ID_STRING, ALL CAPS
#
@@ -46,6 +49,8 @@ GRVL;1;1;2400;0.0;0.0;36;0;36;gravel
#
# rcs: Radar Cross Section -- how well the material reflects the radio wave used by the Ground Penetrating Radar.
#
# sondrefl: Sound Reflective Power. Hard surface (glass) is 1.0
#
# Comments: do nothing;do not parse
#
1 idst tens impf dsty fmod endurance tcond reach rcs sondrefl comments
2 WOOD 10 10 800 1 0.173 0.17 5 18 0.5 just a generic wood
3 ROCK 15 210 3000 1 0.42 2.9 5 48 1.0 data is that of marble
4 OORE GLSS 15 210 3000 1 0.42 2.9 5 100 48 1.0 data is that of marble glass
5 OGEM OORE 15 210 3000 1 0.42 2.9 5 80 100 0.2 data is that of marble
6 CUPR OGEM 210 15 770 210 8960 3000 2 1 1.00 0.42 401.0 2.9 5 120 80 0.2 copper data is that of marble
7 EGLS CUPR 33 210 1000 770 2325 8960 4 2 0.82 1.00 1.0 401.0 6 5 10 120 1.0 elven glass/moldavite copper
8 IRON EGLS 350 33 1085 1000 7874 2325 5 4 1.42 0.82 80.4 1.0 6 120 10 1.0 not wrought iron,just natural iron elven glass/moldavite
9 ARGN IRON 170 350 595 1085 10490 7874 9 5 0.91 1.42 429.0 80.4 6 120 1.0 argentum/silver not wrought iron,just natural iron
10 AURM ARGN 120 170 350 595 19300 10490 9 0.88 0.91 318.0 429.0 6 120 1.0 aurum/gold argentum/silver
11 STAL AURM 531 120 2520 350 7874 19300 14 9 1.73 0.88 26.0 318.0 7 6 120 1.0 steel aurum/gold
12 EAUR STAL 768 531 0 2520 8192 7874 21 14 1.36 1.73 1.0 26.0 7 120 1.0 elven aurichalcum steel
13 TIAL EAUR 900 768 0 4420 8192 33 21 2.16 1.36 1.0 8 7 120 1.0 titanium alloy (Ti6Al4V) elven aurichalcum
14 ADMT TIAL 2000 900 4090 0 2700 4420 71 33 3.42 2.16 1.0 8 120 1.0 adamant titanium alloy (Ti6Al4V)
15 OOZE ADMT 20 2000 0 4090 1000 2700 1 71 0.08 3.42 0.5 1.0 0 8 10 120 1.0 genetic ooze,data is about human skin adamant
16 BONE OOZE 130 20 0 2000 1000 1 0.23 0.08 0.55 0.5 4 0 10 0.0 data is that of bovine bone genetic ooze,data is about human skin
17 BRAS BONE 315 130 1015 0 8530 2000 3 1 1.00 0.23 120 0.55 5 4 120 10 0.1 brass data is that of bovine bone
18 BRNZ BRAS 310 315 843 1015 8770 8530 3 1.20 1.00 75 120 5 120 1.0 bronze brass
19 TINN BRNZ 220 310 350 843 7310 8770 2 3 1.00 1.20 69 75 5 120 1.0 tin bronze
20 ZINC TINN 90 220 525 350 7140 7310 2 1.00 116 69 5 120 1.0 zinc tin
21 DIRT ZINC 1 90 1 525 1400 7140 0.0 2 0.0 1.00 36 116 0 5 10 120 1.0 dirt zinc
22 PLST DIRT 1 1 1400 0.0 0.0 36 0 16 10 0.25 TODO plastic (polyethylene) dirt
23 AIIR SAND 1 1 1 2400 0.0 0.0 36 0 1 36 0.25 air sand
24 SAND GRVL 1 1 2400 0.0 0.0 36 0 36 0.25 sand gravel
25 GRVL PLST 1 1 2400 1400 0.0 0.0 36 0 36 16 0.5 gravel TODO plastic (polyethylene)
26 GRSS 1 1 1400 0.0 0.0 36 0 10 -0.03 dirt
27 AIIR 1 1 1 0.0 0.0 36 0 1 -0.03 air
28 NULL 1 1 1 0.0 0.0 36 0 1 -0.03 air
29 # idst: ID_STRING, ALL CAPS
30 #
31 # tens: tensile strength (= ultimate stringth)
49 # rcs: Radar Cross Section -- how well the material reflects the radio wave used by the Ground Penetrating Radar.
50 #
51 # Comments: do nothing # sondrefl: Sound Reflective Power. Hard surface (glass) is 1.0
52 #
53 # Comments: do nothing do not parse
54 #
55 ## These values are being used by the phys simulator (blocks) and for attack power calculation (items)
56

View File

@@ -230,14 +230,14 @@ object AudioMixer: Disposable {
it.pan = (it.pan - 0.001f).coerceIn(-1f, 1f)
}
}*/
if (Gdx.input.isKeyPressed(Input.Keys.UP)) {
/*if (Gdx.input.isKeyPressed(Input.Keys.UP)) {
convolveBusOpen.volume = (convolveBusOpen.volume + 0.001).coerceIn(0.0, 1.0)
convolveBusCave.volume = 1.0 - convolveBusOpen.volume
}
else if (Gdx.input.isKeyPressed(Input.Keys.DOWN)) {
convolveBusOpen.volume = (convolveBusOpen.volume - 0.001).coerceIn(0.0, 1.0)
convolveBusCave.volume = 1.0 - convolveBusOpen.volume
}
}*/

View File

@@ -20,11 +20,11 @@ object TileSurvey {
val height: Int,
val spatialGranularity: Int, // 1: survey every (w*h) tile, 2: survey every other (w*h/4) tile ...
val temporalGranularity: Int, // 1: survey every frame, 2: every other frame ...
val predicate: (GameWorld, Int, Int) -> Boolean
val predicate: (GameWorld, Int, Int) -> Float
)
private val proposals = HashMap<String, SurveyProposal>()
private val results = HashMap<String, Pair<Double, Int>>() // (matching tiles/actually surveyed tiles)
private val results = HashMap<String, Pair<Double, Float>>() // (ratio of accumulated data to total tile count / raw accumulated data)
fun submitProposal(proposal: SurveyProposal) {
proposals[proposal.surveyIdentifier] = proposal
@@ -54,11 +54,11 @@ object TileSurvey {
val for_x_end = ceil(player.intTilewiseHitbox.centeredX + proposal.width / 2.0).toInt()
val for_y_end = ceil(player.intTilewiseHitbox.centeredY + proposal.height / 2.0).toInt()
var akku = 0
var akku = 0f
for (y in for_y_start until for_y_end step proposal.spatialGranularity) {
for (x in for_x_start until for_x_end step proposal.spatialGranularity) {
if (proposal.predicate(world, x, y)) akku += 1
akku += proposal.predicate(world, x, y)
}
}

View File

@@ -31,6 +31,8 @@ class Material {
var rcs: Int = 10
var sondrefl: Float = 0f
/**
* Mainly intended to be used by third-party modules
*/
@@ -73,6 +75,7 @@ class MaterialCodex {
prop.identifier = it.get("idst").toUpperCase()
prop.toolReach = it.intVal("reach")
prop.rcs = it.intVal("rcs")
prop.sondrefl = it.floatVal("sondrefl")
materialProps[prop.identifier] = prop

View File

@@ -278,6 +278,10 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
CREATE_NEW, LOAD_FROM
}
private val soundReflectiveMaterials = hashSetOf(
""
)
override fun show() {
//initViewPort(AppLoader.terrarumAppConfig.screenW, AppLoader.terrarumAppConfig.screenH)
@@ -295,6 +299,17 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
super.show() // this function sets gameInitialised = true
TileSurvey.submitProposal(
TileSurvey.SurveyProposal(
"basegame.Ingame.audioReflection", 72, 48, 2, 4
) { world, x, y ->
val tileProp = BlockCodex[world.getTileFromTerrain(x, y)]
val wallProp = BlockCodex[world.getTileFromWall(x, y)]
val prop = if (tileProp.isSolid && !tileProp.isActorBlock) tileProp else wallProp
MaterialCodex[prop.material].sondrefl
}
)
}
data class NewGameParams(
@@ -869,9 +884,17 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
oldCamX = WorldCamera.x
oldPlayerX = actorNowPlaying?.hitbox?.canonicalX ?: 0.0
// update audio mixer
val ratio = (TileSurvey.getRatio("basegame.Ingame.audioReflection") ?: 0.0).coerceIn(0.0, 1.0)
AudioMixer.convolveBusCave.volume = ratio
AudioMixer.convolveBusOpen.volume = 1.0 - ratio
WORLD_UPDATE_TIMER += 1
// run benchmark if F2 is on
if (KeyToggler.isOn(Input.Keys.F2)) {
deltaTeeBenchmarks.appendHead(1f / Gdx.graphics.deltaTime)

View File

@@ -33,12 +33,12 @@ object FeaturesDrawer {
TileSurvey.submitProposal(
TileSurvey.SurveyProposal(
"basegame.FeaturesDrawer.coldTiles", 72, 48, 2, 2
) { world, x, y -> BlockCodex[world.getTileFromTerrain(x, y)].hasTag("COLD") }
) { world, x, y -> BlockCodex[world.getTileFromTerrain(x, y)].hasTag("COLD").toInt().toFloat() }
)
TileSurvey.submitProposal(
TileSurvey.SurveyProposal(
"basegame.FeaturesDrawer.warmTiles", 72, 48, 2, 2
) { world, x, y -> BlockCodex[world.getTileFromTerrain(x, y)].hasTag("WARM") }
) { world, x, y -> BlockCodex[world.getTileFromTerrain(x, y)].hasTag("WARM").toInt().toFloat() }
)
}