mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-16 16:46:07 +09:00
worldgen estimation update
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
package net.torvald.terrarum.modulebasegame.worldgenerator
|
package net.torvald.terrarum.modulebasegame.worldgenerator
|
||||||
|
|
||||||
import com.jme3.math.Vector2f
|
|
||||||
import com.jme3.math.Vector3f
|
import com.jme3.math.Vector3f
|
||||||
import com.sudoplay.joise.Joise
|
import com.sudoplay.joise.Joise
|
||||||
import com.sudoplay.joise.module.*
|
import com.sudoplay.joise.module.*
|
||||||
@@ -18,7 +17,6 @@ import net.torvald.terrarum.realestate.LandUtil
|
|||||||
import net.torvald.terrarum.realestate.LandUtil.CHUNK_H
|
import net.torvald.terrarum.realestate.LandUtil.CHUNK_H
|
||||||
import net.torvald.terrarum.realestate.LandUtil.CHUNK_W
|
import net.torvald.terrarum.realestate.LandUtil.CHUNK_W
|
||||||
import kotlin.experimental.and
|
import kotlin.experimental.and
|
||||||
import kotlin.math.ln
|
|
||||||
import kotlin.math.pow
|
import kotlin.math.pow
|
||||||
import kotlin.math.roundToLong
|
import kotlin.math.roundToLong
|
||||||
|
|
||||||
@@ -84,6 +82,7 @@ object Worldgen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun generateMap(loadscreen: LoadScreenBase) {
|
fun generateMap(loadscreen: LoadScreenBase) {
|
||||||
|
val t1 = System.nanoTime()
|
||||||
val jobs = getJobs()
|
val jobs = getJobs()
|
||||||
|
|
||||||
|
|
||||||
@@ -120,8 +119,8 @@ object Worldgen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
printdbg(this, "Generation job finished")
|
val tDiff = System.nanoTime() - t1
|
||||||
|
printdbg(this, "Generation job finished; time took: ${tDiff / 1000000000.0} seconds, bogoflops: ${App.bogoflops}")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Point2iMod(x: Int, y: Int) = Point2i(x fmod (world.width / CHUNK_W), y)
|
private fun Point2iMod(x: Int, y: Int) = Point2i(x fmod (world.width / CHUNK_W), y)
|
||||||
@@ -152,13 +151,17 @@ object Worldgen {
|
|||||||
data class Work(val loadingScreenName: String, val theWork: Gen, val tags: List<String>)
|
data class Work(val loadingScreenName: String, val theWork: Gen, val tags: List<String>)
|
||||||
|
|
||||||
fun getEstimationSec(width: Int, height: Int): Long {
|
fun getEstimationSec(width: Int, height: Int): Long {
|
||||||
val testMachineBogoFlops = 48000000
|
// test method: fresh new instance every worldgen
|
||||||
val testMachineThreads = 32
|
// test machine is loaded with the IDE and Web Browser (Firefox) running 1 Twitch stream and 1 YouTube video, both at 1080p
|
||||||
val eqMult = 0.0214 // use google sheet to get trend line equation
|
|
||||||
val eqPow = 0.396 // use google sheet to get trend line equation
|
|
||||||
|
|
||||||
val f = eqMult * (width.toDouble() * height).pow(eqPow)
|
val testMachineBogoFlops = 47518464.58
|
||||||
return (1.3 * (testMachineBogoFlops.toDouble() / bogoflops) * f * (testMachineThreads.toDouble() / THREAD_COUNT)).roundToLong()
|
val testMachineThreads = 32
|
||||||
|
// eq: ax^b
|
||||||
|
val a = 0.05 // use google sheet to get trend line equation
|
||||||
|
val b = 0.343 // use google sheet to get trend line equation
|
||||||
|
|
||||||
|
val f = a * (width.toDouble() * height).pow(b)
|
||||||
|
return (1.25 * (testMachineBogoFlops / bogoflops) * f * (testMachineThreads.toDouble() / THREAD_COUNT)).roundToLong()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user