tuning and void safety prediction better functioning
This commit is contained in:
parent
052dcd2789
commit
cecec88df0
@ -64,7 +64,7 @@ public class AudioAnalyzer {
|
|||||||
int tasksDone = 0;
|
int tasksDone = 0;
|
||||||
int totalTasks = audioData.getSampleCount()/audioData.getReadWindowSize();
|
int totalTasks = audioData.getSampleCount()/audioData.getReadWindowSize();
|
||||||
|
|
||||||
bassThresholdMultiplier = 1.7f;
|
bassThresholdMultiplier = 1.5f;
|
||||||
umThresholdMultiplier = 1.5f;
|
umThresholdMultiplier = 1.5f;
|
||||||
|
|
||||||
bassBinBegin = 1;
|
bassBinBegin = 1;
|
||||||
|
@ -5,12 +5,10 @@ import zero1hd.polyjet.entity.Entities;
|
|||||||
public class EntitySpawnInfo {
|
public class EntitySpawnInfo {
|
||||||
private Entities entityType;
|
private Entities entityType;
|
||||||
private float[] parameters;
|
private float[] parameters;
|
||||||
private int spawnWindowID;
|
|
||||||
|
|
||||||
public EntitySpawnInfo(Entities entityType, int spawnWindowID, float... parameters) {
|
public EntitySpawnInfo(Entities entityType, float... parameters) {
|
||||||
this.entityType = entityType;
|
this.entityType = entityType;
|
||||||
this.parameters = parameters;
|
this.parameters = parameters;
|
||||||
this.spawnWindowID = spawnWindowID;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Entities getEntityType() {
|
public Entities getEntityType() {
|
||||||
@ -25,8 +23,4 @@ public class EntitySpawnInfo {
|
|||||||
public float[] getParameters() {
|
public float[] getParameters() {
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSpawnWindowID() {
|
|
||||||
return spawnWindowID;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@ public class GamePlayMap {
|
|||||||
private Array<MapWindowData> spawnList;
|
private Array<MapWindowData> spawnList;
|
||||||
private boolean building;
|
private boolean building;
|
||||||
private int index;
|
private int index;
|
||||||
private int absoluteIndex;
|
|
||||||
/**
|
/**
|
||||||
* GamePlayMap is what the game area will use to generate entities and judge current audio data
|
* GamePlayMap is what the game area will use to generate entities and judge current audio data
|
||||||
* @param audioData audio data
|
* @param audioData audio data
|
||||||
@ -46,7 +45,6 @@ public class GamePlayMap {
|
|||||||
spawnList.clear();
|
spawnList.clear();
|
||||||
spawnList.add(new MapWindowData());
|
spawnList.add(new MapWindowData());
|
||||||
index = 0;
|
index = 0;
|
||||||
absoluteIndex = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,7 +53,6 @@ public class GamePlayMap {
|
|||||||
public void endBuild() {
|
public void endBuild() {
|
||||||
building = false;
|
building = false;
|
||||||
index = 0;
|
index = 0;
|
||||||
absoluteIndex = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -68,6 +65,9 @@ public class GamePlayMap {
|
|||||||
|
|
||||||
public void addToMap(Entities entityType, float... parameters) {
|
public void addToMap(Entities entityType, float... parameters) {
|
||||||
if (building && entityType != null && parameters != null) {
|
if (building && entityType != null && parameters != null) {
|
||||||
|
if (spawnList.get(index) == null) {
|
||||||
|
spawnList.set(index, new MapWindowData());
|
||||||
|
}
|
||||||
spawnList.get(index).addEntity(new EntitySpawnInfo(entityType, parameters));
|
spawnList.get(index).addEntity(new EntitySpawnInfo(entityType, parameters));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -76,10 +76,9 @@ public class GamePlayMap {
|
|||||||
* Moves onto the next window of the map for the song
|
* Moves onto the next window of the map for the song
|
||||||
*/
|
*/
|
||||||
public void nextWindow() {
|
public void nextWindow() {
|
||||||
absoluteIndex++;
|
|
||||||
resetIndex();
|
|
||||||
if (building) {
|
if (building) {
|
||||||
spawnList.add(new MapWindowData());
|
spawnList.add(new MapWindowData());
|
||||||
|
resetIndex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,8 +86,26 @@ public class GamePlayMap {
|
|||||||
* moves to the previous window to make edits to that frame.
|
* moves to the previous window to make edits to that frame.
|
||||||
*/
|
*/
|
||||||
public void previousWindow() {
|
public void previousWindow() {
|
||||||
absoluteIndex--;
|
if (building) {
|
||||||
resetIndex();
|
index--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int goBack(int amount) {
|
||||||
|
if (index-amount < 0) {
|
||||||
|
int howMuchLess = -(index - amount);
|
||||||
|
index = 0;
|
||||||
|
return howMuchLess;
|
||||||
|
}
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void goForward(int amount) {
|
||||||
|
if (index+amount > spawnList.size-1) {
|
||||||
|
index += amount;
|
||||||
|
} else {
|
||||||
|
index += amount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* use this to add rest for current index position
|
* use this to add rest for current index position
|
||||||
@ -98,11 +115,9 @@ public class GamePlayMap {
|
|||||||
spawnList.set(index, null);
|
spawnList.set(index, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapWindowData nextWindowData() {
|
public MapWindowData nextWindowData() {
|
||||||
if (index != musicData.getReadIndex()) {
|
if (index != musicData.getReadIndex()) {
|
||||||
absoluteIndex = musicData.getReadIndex();
|
index = musicData.getReadIndex();
|
||||||
resetIndex();
|
|
||||||
return spawnList.get(index);
|
return spawnList.get(index);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -120,7 +135,12 @@ public class GamePlayMap {
|
|||||||
return spawnList.get(index) == null ? true : false;
|
return spawnList.get(index) == null ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sets the current index to the end of the array
|
||||||
|
*/
|
||||||
public void resetIndex() {
|
public void resetIndex() {
|
||||||
index = absoluteIndex;
|
if (building) {
|
||||||
|
index = spawnList.size-1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,18 +56,20 @@ public class RhythmMapAlgorithm implements Runnable {
|
|||||||
map.beginBuild();
|
map.beginBuild();
|
||||||
for (int index = 0; index < bassPeaks.size; index++) {
|
for (int index = 0; index < bassPeaks.size; index++) {
|
||||||
if (bassPeaks.get(index) != 0 || UMPeaks.get(index) != 0) {
|
if (bassPeaks.get(index) != 0 || UMPeaks.get(index) != 0) {
|
||||||
int warningTime = (int) ((3/speedMod)*windowPerSecond);
|
if (bassPeaks.get(index) >= avgBass) {
|
||||||
if ((index+warningTime < bassPeaks.size) && bassPeaks.get(index + warningTime) != 0) {
|
|
||||||
//TODO basic void circle spawning
|
//TODO basic void circle spawning
|
||||||
float endRadius = (bassPeaks.get(index + warningTime)/bassMax)*(Polyjet.GAME_AREA_HEIGHT/2f);
|
int warningTime = (int) (map.goBack((int) (windowPerSecond*1.5f))/windowPerSecond);
|
||||||
|
|
||||||
|
float endRadius = (bassPeaks.get(index)/bassMax)*(Polyjet.GAME_AREA_HEIGHT/2f);
|
||||||
map.addToMap(Entities.VOID_CIRCLE,
|
map.addToMap(Entities.VOID_CIRCLE,
|
||||||
endRadius,
|
endRadius,
|
||||||
rand.nextFloat()*Polyjet.GAME_AREA_WIDTH,
|
rand.nextFloat()*Polyjet.GAME_AREA_WIDTH,
|
||||||
rand.nextFloat()*Polyjet.GAME_AREA_HEIGHT,
|
rand.nextFloat()*Polyjet.GAME_AREA_HEIGHT,
|
||||||
endRadius/(avgSPB*0.6f),
|
endRadius/(avgSPB*0.7f),
|
||||||
3f/speedMod
|
warningTime
|
||||||
);
|
);
|
||||||
|
|
||||||
|
map.resetIndex();
|
||||||
}
|
}
|
||||||
if (bassPeaks.get(index) != 0) {
|
if (bassPeaks.get(index) != 0) {
|
||||||
map.addToMap(Entities.BAR,
|
map.addToMap(Entities.BAR,
|
||||||
|
@ -111,41 +111,41 @@ public class EntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntitySpawnInfo spawnEntity(Stage stage, EntitySpawnInfo entitySpawnInfo) {
|
public Entity spawnEntity(Stage stage, EntitySpawnInfo entitySpawnInfo) {
|
||||||
if (entitySpawnInfo != null) {
|
if (entitySpawnInfo != null) {
|
||||||
float[] param = entitySpawnInfo.getParameters();
|
float[] param = entitySpawnInfo.getParameters();
|
||||||
Gdx.app.debug("Spawning Entity", entitySpawnInfo.toString() + " parameters: " + Arrays.toString(param) + "Attributed spawn window: " + entitySpawnInfo.getSpawnWindowID());
|
Gdx.app.debug("Spawning Entity", entitySpawnInfo.toString() + " parameters: " + Arrays.toString(param));
|
||||||
switch (entitySpawnInfo.getEntityType()) {
|
switch (entitySpawnInfo.getEntityType()) {
|
||||||
case VOID_CIRCLE:
|
case VOID_CIRCLE:
|
||||||
VoidCircle voidCircle = voidCirclePool.obtain();
|
VoidCircle voidCircle = voidCirclePool.obtain();
|
||||||
voidCircle.init(param[0], param[1], param[2], param[3], param[4]);
|
voidCircle.init(param[0], param[1], param[2], param[3], param[4]);
|
||||||
activeEnemies.add(voidCircle);
|
activeEnemies.add(voidCircle);
|
||||||
stage.addActor(voidCircle);
|
stage.addActor(voidCircle);
|
||||||
break;
|
return voidCircle;
|
||||||
case LASER:
|
case LASER:
|
||||||
Laser laser = laserPool.obtain();
|
Laser laser = laserPool.obtain();
|
||||||
laser.init(param[0], param[1], param[2]);
|
laser.init(param[0], param[1], param[2]);
|
||||||
activeAllies.add(laser);
|
activeAllies.add(laser);
|
||||||
stage.addActor(laser);
|
stage.addActor(laser);
|
||||||
break;
|
return laser;
|
||||||
case PELLET:
|
case PELLET:
|
||||||
Pellet pellet = pelletPool.obtain();
|
Pellet pellet = pelletPool.obtain();
|
||||||
pellet.init(param[0], param[1], param[2], param[3]);
|
pellet.init(param[0], param[1], param[2], param[3]);
|
||||||
activeEnemies.add(pellet);
|
activeEnemies.add(pellet);
|
||||||
stage.addActor(pellet);
|
stage.addActor(pellet);
|
||||||
break;
|
return pellet;
|
||||||
case SHARD:
|
case SHARD:
|
||||||
Shard shard = shardPool.obtain();
|
Shard shard = shardPool.obtain();
|
||||||
shard.init(param[0], param[1], param[2], param[3], (int) param[4]);
|
shard.init(param[0], param[1], param[2], param[3], (int) param[4]);
|
||||||
activeEnemies.add(shard);
|
activeEnemies.add(shard);
|
||||||
stage.addActor(shard);
|
stage.addActor(shard);
|
||||||
break;
|
return shard;
|
||||||
case BAR:
|
case BAR:
|
||||||
Bar bar = barPool.obtain();
|
Bar bar = barPool.obtain();
|
||||||
bar.init(param[0], param[1]);
|
bar.init(param[0], param[1]);
|
||||||
activeEnemies.add(bar);
|
activeEnemies.add(bar);
|
||||||
stage.addActor(bar);
|
stage.addActor(bar);
|
||||||
break;
|
return bar;
|
||||||
case FLAKE:
|
case FLAKE:
|
||||||
Flake flake = flakePool.obtain();
|
Flake flake = flakePool.obtain();
|
||||||
Shard[] shards = new Shard[(int) param[0]];
|
Shard[] shards = new Shard[(int) param[0]];
|
||||||
@ -157,10 +157,13 @@ public class EntityController {
|
|||||||
flake.init(param[1], param[2], param[3], param[4], param[5], shards);
|
flake.init(param[1], param[2], param[3], param[4], param[5], shards);
|
||||||
activeEnemies.add(flake);
|
activeEnemies.add(flake);
|
||||||
stage.addActor(flake);
|
stage.addActor(flake);
|
||||||
break;
|
return flake;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
return entitySpawnInfo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void free(Entity entity) {
|
public void free(Entity entity) {
|
||||||
|
@ -66,7 +66,7 @@ public class AudioGraph extends Actor {
|
|||||||
audioGraph.drawLine(x, audioGraph.getHeight(), x, (int) (audioGraph.getHeight()-(mainGraph.get(dataIndex+x-audioGraph.getWidth()/2)/normalDataG1)*scale));
|
audioGraph.drawLine(x, audioGraph.getHeight(), x, (int) (audioGraph.getHeight()-(mainGraph.get(dataIndex+x-audioGraph.getWidth()/2)/normalDataG1)*scale));
|
||||||
} catch (NullPointerException | IndexOutOfBoundsException e) {
|
} catch (NullPointerException | IndexOutOfBoundsException e) {
|
||||||
}
|
}
|
||||||
audioGraph.drawLine(0,audioGraph.getHeight() - MathUtils.round(scale*(avgG1/normalDataG1)), audioGraph.getWidth(), audioGraph.getHeight() - MathUtils.round(scale*(avgG1/normalDataG1)));
|
audioGraph.drawLine(0, audioGraph.getHeight() - MathUtils.round(scale*(avgG1/normalDataG1)), audioGraph.getWidth(), audioGraph.getHeight() - MathUtils.round(scale*(avgG1/normalDataG1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -4,6 +4,7 @@ import java.io.DataInputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.security.InvalidParameterException;
|
import java.security.InvalidParameterException;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.files.FileHandle;
|
import com.badlogic.gdx.files.FileHandle;
|
||||||
|
|
||||||
public class WavDecoder {
|
public class WavDecoder {
|
||||||
|
Loading…
Reference in New Issue
Block a user