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 totalTasks = audioData.getSampleCount()/audioData.getReadWindowSize();
|
||||
|
||||
bassThresholdMultiplier = 1.7f;
|
||||
bassThresholdMultiplier = 1.5f;
|
||||
umThresholdMultiplier = 1.5f;
|
||||
|
||||
bassBinBegin = 1;
|
||||
|
@ -5,12 +5,10 @@ import zero1hd.polyjet.entity.Entities;
|
||||
public class EntitySpawnInfo {
|
||||
private Entities entityType;
|
||||
private float[] parameters;
|
||||
private int spawnWindowID;
|
||||
|
||||
public EntitySpawnInfo(Entities entityType, int spawnWindowID, float... parameters) {
|
||||
public EntitySpawnInfo(Entities entityType, float... parameters) {
|
||||
this.entityType = entityType;
|
||||
this.parameters = parameters;
|
||||
this.spawnWindowID = spawnWindowID;
|
||||
}
|
||||
|
||||
public Entities getEntityType() {
|
||||
@ -25,8 +23,4 @@ public class EntitySpawnInfo {
|
||||
public float[] getParameters() {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
public int getSpawnWindowID() {
|
||||
return spawnWindowID;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ public class GamePlayMap {
|
||||
private Array<MapWindowData> spawnList;
|
||||
private boolean building;
|
||||
private int index;
|
||||
private int absoluteIndex;
|
||||
/**
|
||||
* GamePlayMap is what the game area will use to generate entities and judge current audio data
|
||||
* @param audioData audio data
|
||||
@ -46,7 +45,6 @@ public class GamePlayMap {
|
||||
spawnList.clear();
|
||||
spawnList.add(new MapWindowData());
|
||||
index = 0;
|
||||
absoluteIndex = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -55,7 +53,6 @@ public class GamePlayMap {
|
||||
public void endBuild() {
|
||||
building = false;
|
||||
index = 0;
|
||||
absoluteIndex = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -68,6 +65,9 @@ public class GamePlayMap {
|
||||
|
||||
public void addToMap(Entities entityType, float... parameters) {
|
||||
if (building && entityType != null && parameters != null) {
|
||||
if (spawnList.get(index) == null) {
|
||||
spawnList.set(index, new MapWindowData());
|
||||
}
|
||||
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
|
||||
*/
|
||||
public void nextWindow() {
|
||||
absoluteIndex++;
|
||||
resetIndex();
|
||||
if (building) {
|
||||
spawnList.add(new MapWindowData());
|
||||
resetIndex();
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,8 +86,26 @@ public class GamePlayMap {
|
||||
* moves to the previous window to make edits to that frame.
|
||||
*/
|
||||
public void previousWindow() {
|
||||
absoluteIndex--;
|
||||
resetIndex();
|
||||
if (building) {
|
||||
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
|
||||
@ -98,11 +115,9 @@ public class GamePlayMap {
|
||||
spawnList.set(index, null);
|
||||
}
|
||||
}
|
||||
|
||||
public MapWindowData nextWindowData() {
|
||||
if (index != musicData.getReadIndex()) {
|
||||
absoluteIndex = musicData.getReadIndex();
|
||||
resetIndex();
|
||||
index = musicData.getReadIndex();
|
||||
return spawnList.get(index);
|
||||
}
|
||||
return null;
|
||||
@ -120,7 +135,12 @@ public class GamePlayMap {
|
||||
return spawnList.get(index) == null ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the current index to the end of the array
|
||||
*/
|
||||
public void resetIndex() {
|
||||
index = absoluteIndex;
|
||||
if (building) {
|
||||
index = spawnList.size-1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,18 +56,20 @@ public class RhythmMapAlgorithm implements Runnable {
|
||||
map.beginBuild();
|
||||
for (int index = 0; index < bassPeaks.size; index++) {
|
||||
if (bassPeaks.get(index) != 0 || UMPeaks.get(index) != 0) {
|
||||
int warningTime = (int) ((3/speedMod)*windowPerSecond);
|
||||
if ((index+warningTime < bassPeaks.size) && bassPeaks.get(index + warningTime) != 0) {
|
||||
if (bassPeaks.get(index) >= avgBass) {
|
||||
//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,
|
||||
endRadius,
|
||||
rand.nextFloat()*Polyjet.GAME_AREA_WIDTH,
|
||||
rand.nextFloat()*Polyjet.GAME_AREA_HEIGHT,
|
||||
endRadius/(avgSPB*0.6f),
|
||||
3f/speedMod
|
||||
endRadius/(avgSPB*0.7f),
|
||||
warningTime
|
||||
);
|
||||
|
||||
map.resetIndex();
|
||||
}
|
||||
if (bassPeaks.get(index) != 0) {
|
||||
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) {
|
||||
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()) {
|
||||
case VOID_CIRCLE:
|
||||
VoidCircle voidCircle = voidCirclePool.obtain();
|
||||
voidCircle.init(param[0], param[1], param[2], param[3], param[4]);
|
||||
activeEnemies.add(voidCircle);
|
||||
stage.addActor(voidCircle);
|
||||
break;
|
||||
return voidCircle;
|
||||
case LASER:
|
||||
Laser laser = laserPool.obtain();
|
||||
laser.init(param[0], param[1], param[2]);
|
||||
activeAllies.add(laser);
|
||||
stage.addActor(laser);
|
||||
break;
|
||||
return laser;
|
||||
case PELLET:
|
||||
Pellet pellet = pelletPool.obtain();
|
||||
pellet.init(param[0], param[1], param[2], param[3]);
|
||||
activeEnemies.add(pellet);
|
||||
stage.addActor(pellet);
|
||||
break;
|
||||
return pellet;
|
||||
case SHARD:
|
||||
Shard shard = shardPool.obtain();
|
||||
shard.init(param[0], param[1], param[2], param[3], (int) param[4]);
|
||||
activeEnemies.add(shard);
|
||||
stage.addActor(shard);
|
||||
break;
|
||||
return shard;
|
||||
case BAR:
|
||||
Bar bar = barPool.obtain();
|
||||
bar.init(param[0], param[1]);
|
||||
activeEnemies.add(bar);
|
||||
stage.addActor(bar);
|
||||
break;
|
||||
return bar;
|
||||
case FLAKE:
|
||||
Flake flake = flakePool.obtain();
|
||||
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);
|
||||
activeEnemies.add(flake);
|
||||
stage.addActor(flake);
|
||||
break;
|
||||
return flake;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return entitySpawnInfo;
|
||||
}
|
||||
|
||||
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));
|
||||
} 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:
|
||||
|
@ -4,6 +4,7 @@ import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.security.InvalidParameterException;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
|
||||
public class WavDecoder {
|
||||
|
Loading…
Reference in New Issue
Block a user