ai lod work
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
f29638ad00
commit
935ee0e416
@ -1969,6 +1969,7 @@ Performance improvements
|
||||
- Normal outline pipeline use draw accumulator
|
||||
- Reduced the visual LOD cutoff
|
||||
- Multiple visual LOD levels
|
||||
- AI does not simulate for low-lod server entities
|
||||
Lod emitter service checker function
|
||||
|
||||
|
||||
|
||||
@ -427,6 +427,7 @@ public class Mesh {
|
||||
Globals.renderingEngine.checkError();
|
||||
|
||||
if(renderPipelineState.getUseMeshShader()){
|
||||
Globals.profiler.beginAggregateCpuSample("Mesh shader");
|
||||
VisualShader selectedProgram = null;
|
||||
switch(renderPipelineState.getSelectedShader()){
|
||||
case PRIMARY: {
|
||||
@ -440,6 +441,7 @@ public class Mesh {
|
||||
selectedProgram = shader;
|
||||
}
|
||||
openGLState.setActiveShader(renderPipelineState, selectedProgram);
|
||||
Globals.profiler.endCpuSample();
|
||||
}
|
||||
|
||||
if(renderPipelineState.getUseLight()){
|
||||
@ -464,13 +466,14 @@ public class Mesh {
|
||||
}
|
||||
|
||||
if(renderPipelineState.getUseMaterial() && textureMask == null){
|
||||
Globals.renderingEngine.checkError();
|
||||
Globals.profiler.beginAggregateCpuSample("applyMaterial");
|
||||
if(material == null){
|
||||
Globals.renderingEngine.getDefaultMaterial().applyMaterial(openGLState);
|
||||
} else {
|
||||
material.applyMaterial(openGLState);
|
||||
}
|
||||
Globals.renderingEngine.checkError();
|
||||
Globals.profiler.endCpuSample();
|
||||
}
|
||||
|
||||
|
||||
@ -507,12 +510,14 @@ public class Mesh {
|
||||
}
|
||||
|
||||
if(renderPipelineState.getUseShadowMap()){
|
||||
Globals.profiler.beginAggregateCpuSample("Shadow map");
|
||||
int shadowMapTextureUnit = 3;
|
||||
openGLState.glActiveTexture(GL45.GL_TEXTURE0 + shadowMapTextureUnit);
|
||||
Globals.renderingEngine.checkError();
|
||||
openGLState.glBindTexture(GL45.GL_TEXTURE_2D, RenderingEngine.lightBufferDepthTexture.getTexturePointer());
|
||||
Globals.renderingEngine.checkError();
|
||||
openGLState.getActiveShader().setUniform(openGLState, "shadowMap", shadowMapTextureUnit);
|
||||
Globals.profiler.endCpuSample();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package electrosphere.server.ai;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import electrosphere.data.entity.creature.ai.AITreeData;
|
||||
@ -9,6 +8,7 @@ import electrosphere.data.entity.creature.ai.BlockerTreeData;
|
||||
import electrosphere.data.entity.creature.ai.StandardCharacterTreeData;
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.EntityDataStrings;
|
||||
import electrosphere.entity.state.lod.ServerLODComponent;
|
||||
import electrosphere.entity.state.movement.groundmove.ServerGroundMovementTree;
|
||||
import electrosphere.entity.types.creature.CreatureUtils;
|
||||
import electrosphere.logger.LoggerInterface;
|
||||
@ -25,40 +25,30 @@ import electrosphere.server.ai.trees.test.BlockerAITree;
|
||||
*/
|
||||
public class AI {
|
||||
|
||||
/**
|
||||
* The error checking threshold for ai mutation
|
||||
*/
|
||||
static final float ERROR_CHECK_ROT_THRESHOLD = 0.999f;
|
||||
|
||||
/**
|
||||
* The entity this ai is associated with
|
||||
*/
|
||||
Entity parent;
|
||||
private Entity parent;
|
||||
|
||||
/**
|
||||
* The root node of the behavior tree
|
||||
*/
|
||||
AITreeNode rootNode;
|
||||
private AITreeNode rootNode;
|
||||
|
||||
/**
|
||||
* The blackboard for the tree
|
||||
*/
|
||||
Blackboard blackboard = new Blackboard();
|
||||
|
||||
/**
|
||||
* Internal usage, used to track the nodes that have been evaluated and ensure we're not looping
|
||||
*/
|
||||
List<AITreeNode> evaluatedNodes = new LinkedList<AITreeNode>();
|
||||
private Blackboard blackboard = new Blackboard();
|
||||
|
||||
/**
|
||||
* Tracks whether this should apply even if there is a controlling player
|
||||
*/
|
||||
boolean applyToPlayer = false;
|
||||
private boolean applyToPlayer = false;
|
||||
|
||||
/**
|
||||
* The status of the ai
|
||||
*/
|
||||
String status = "Idle";
|
||||
private String status = "Idle";
|
||||
|
||||
/**
|
||||
* Constructs an AI from a list of trees that should be present on the ai
|
||||
@ -150,7 +140,12 @@ public class AI {
|
||||
* Checks if the ai should simulate or not
|
||||
* @return true if should simulate, false otherwise
|
||||
*/
|
||||
private boolean shouldExecute(){
|
||||
public boolean shouldExecute(){
|
||||
if(ServerLODComponent.hasServerLODComponent(this.parent)){
|
||||
if(ServerLODComponent.getServerLODComponent(this.parent).getLodLevel() == ServerLODComponent.LOW_RES){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return this.applyToPlayer || !CreatureUtils.hasControllerPlayerId(this.parent);
|
||||
}
|
||||
|
||||
|
||||
@ -80,9 +80,12 @@ public class AIManager {
|
||||
Globals.profiler.beginCpuSample("AIManager.simulate");
|
||||
lock.lock();
|
||||
//exec the services
|
||||
Globals.profiler.beginCpuSample("AIManager.simulate - services");
|
||||
this.execServices();
|
||||
Globals.profiler.endCpuSample();
|
||||
|
||||
//simulate each tree
|
||||
Globals.profiler.beginCpuSample("AIManager.simulate - ai logic");
|
||||
if(this.isActive()){
|
||||
for(AI ai : aiList){
|
||||
try {
|
||||
@ -92,6 +95,7 @@ public class AIManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
Globals.profiler.endCpuSample();
|
||||
lock.unlock();
|
||||
Globals.profiler.endCpuSample();
|
||||
}
|
||||
|
||||
@ -25,6 +25,9 @@ public class NearbyEntityService implements AIService {
|
||||
@Override
|
||||
public void exec(){
|
||||
for(AI ai : Globals.serverState.aiManager.getAIList()){
|
||||
if(!ai.shouldExecute()){
|
||||
continue;
|
||||
}
|
||||
Entity entity = ai.getParent();
|
||||
Realm realm = Globals.serverState.realmManager.getEntityRealm(entity);
|
||||
if(realm != null){
|
||||
|
||||
Loading…
Reference in New Issue
Block a user