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
|
- Normal outline pipeline use draw accumulator
|
||||||
- Reduced the visual LOD cutoff
|
- Reduced the visual LOD cutoff
|
||||||
- Multiple visual LOD levels
|
- Multiple visual LOD levels
|
||||||
|
- AI does not simulate for low-lod server entities
|
||||||
Lod emitter service checker function
|
Lod emitter service checker function
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -427,6 +427,7 @@ public class Mesh {
|
|||||||
Globals.renderingEngine.checkError();
|
Globals.renderingEngine.checkError();
|
||||||
|
|
||||||
if(renderPipelineState.getUseMeshShader()){
|
if(renderPipelineState.getUseMeshShader()){
|
||||||
|
Globals.profiler.beginAggregateCpuSample("Mesh shader");
|
||||||
VisualShader selectedProgram = null;
|
VisualShader selectedProgram = null;
|
||||||
switch(renderPipelineState.getSelectedShader()){
|
switch(renderPipelineState.getSelectedShader()){
|
||||||
case PRIMARY: {
|
case PRIMARY: {
|
||||||
@ -440,6 +441,7 @@ public class Mesh {
|
|||||||
selectedProgram = shader;
|
selectedProgram = shader;
|
||||||
}
|
}
|
||||||
openGLState.setActiveShader(renderPipelineState, selectedProgram);
|
openGLState.setActiveShader(renderPipelineState, selectedProgram);
|
||||||
|
Globals.profiler.endCpuSample();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(renderPipelineState.getUseLight()){
|
if(renderPipelineState.getUseLight()){
|
||||||
@ -464,13 +466,14 @@ public class Mesh {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(renderPipelineState.getUseMaterial() && textureMask == null){
|
if(renderPipelineState.getUseMaterial() && textureMask == null){
|
||||||
Globals.renderingEngine.checkError();
|
Globals.profiler.beginAggregateCpuSample("applyMaterial");
|
||||||
if(material == null){
|
if(material == null){
|
||||||
Globals.renderingEngine.getDefaultMaterial().applyMaterial(openGLState);
|
Globals.renderingEngine.getDefaultMaterial().applyMaterial(openGLState);
|
||||||
} else {
|
} else {
|
||||||
material.applyMaterial(openGLState);
|
material.applyMaterial(openGLState);
|
||||||
}
|
}
|
||||||
Globals.renderingEngine.checkError();
|
Globals.renderingEngine.checkError();
|
||||||
|
Globals.profiler.endCpuSample();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -507,12 +510,14 @@ public class Mesh {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(renderPipelineState.getUseShadowMap()){
|
if(renderPipelineState.getUseShadowMap()){
|
||||||
|
Globals.profiler.beginAggregateCpuSample("Shadow map");
|
||||||
int shadowMapTextureUnit = 3;
|
int shadowMapTextureUnit = 3;
|
||||||
openGLState.glActiveTexture(GL45.GL_TEXTURE0 + shadowMapTextureUnit);
|
openGLState.glActiveTexture(GL45.GL_TEXTURE0 + shadowMapTextureUnit);
|
||||||
Globals.renderingEngine.checkError();
|
Globals.renderingEngine.checkError();
|
||||||
openGLState.glBindTexture(GL45.GL_TEXTURE_2D, RenderingEngine.lightBufferDepthTexture.getTexturePointer());
|
openGLState.glBindTexture(GL45.GL_TEXTURE_2D, RenderingEngine.lightBufferDepthTexture.getTexturePointer());
|
||||||
Globals.renderingEngine.checkError();
|
Globals.renderingEngine.checkError();
|
||||||
openGLState.getActiveShader().setUniform(openGLState, "shadowMap", shadowMapTextureUnit);
|
openGLState.getActiveShader().setUniform(openGLState, "shadowMap", shadowMapTextureUnit);
|
||||||
|
Globals.profiler.endCpuSample();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package electrosphere.server.ai;
|
package electrosphere.server.ai;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import electrosphere.data.entity.creature.ai.AITreeData;
|
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.data.entity.creature.ai.StandardCharacterTreeData;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.EntityDataStrings;
|
import electrosphere.entity.EntityDataStrings;
|
||||||
|
import electrosphere.entity.state.lod.ServerLODComponent;
|
||||||
import electrosphere.entity.state.movement.groundmove.ServerGroundMovementTree;
|
import electrosphere.entity.state.movement.groundmove.ServerGroundMovementTree;
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.creature.CreatureUtils;
|
||||||
import electrosphere.logger.LoggerInterface;
|
import electrosphere.logger.LoggerInterface;
|
||||||
@ -25,40 +25,30 @@ import electrosphere.server.ai.trees.test.BlockerAITree;
|
|||||||
*/
|
*/
|
||||||
public class AI {
|
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
|
* The entity this ai is associated with
|
||||||
*/
|
*/
|
||||||
Entity parent;
|
private Entity parent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The root node of the behavior tree
|
* The root node of the behavior tree
|
||||||
*/
|
*/
|
||||||
AITreeNode rootNode;
|
private AITreeNode rootNode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The blackboard for the tree
|
* The blackboard for the tree
|
||||||
*/
|
*/
|
||||||
Blackboard blackboard = new Blackboard();
|
private 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>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tracks whether this should apply even if there is a controlling player
|
* Tracks whether this should apply even if there is a controlling player
|
||||||
*/
|
*/
|
||||||
boolean applyToPlayer = false;
|
private boolean applyToPlayer = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The status of the ai
|
* 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
|
* 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
|
* Checks if the ai should simulate or not
|
||||||
* @return true if should simulate, false otherwise
|
* @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);
|
return this.applyToPlayer || !CreatureUtils.hasControllerPlayerId(this.parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -80,9 +80,12 @@ public class AIManager {
|
|||||||
Globals.profiler.beginCpuSample("AIManager.simulate");
|
Globals.profiler.beginCpuSample("AIManager.simulate");
|
||||||
lock.lock();
|
lock.lock();
|
||||||
//exec the services
|
//exec the services
|
||||||
|
Globals.profiler.beginCpuSample("AIManager.simulate - services");
|
||||||
this.execServices();
|
this.execServices();
|
||||||
|
Globals.profiler.endCpuSample();
|
||||||
|
|
||||||
//simulate each tree
|
//simulate each tree
|
||||||
|
Globals.profiler.beginCpuSample("AIManager.simulate - ai logic");
|
||||||
if(this.isActive()){
|
if(this.isActive()){
|
||||||
for(AI ai : aiList){
|
for(AI ai : aiList){
|
||||||
try {
|
try {
|
||||||
@ -92,6 +95,7 @@ public class AIManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Globals.profiler.endCpuSample();
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
Globals.profiler.endCpuSample();
|
Globals.profiler.endCpuSample();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,9 @@ public class NearbyEntityService implements AIService {
|
|||||||
@Override
|
@Override
|
||||||
public void exec(){
|
public void exec(){
|
||||||
for(AI ai : Globals.serverState.aiManager.getAIList()){
|
for(AI ai : Globals.serverState.aiManager.getAIList()){
|
||||||
|
if(!ai.shouldExecute()){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Entity entity = ai.getParent();
|
Entity entity = ai.getParent();
|
||||||
Realm realm = Globals.serverState.realmManager.getEntityRealm(entity);
|
Realm realm = Globals.serverState.realmManager.getEntityRealm(entity);
|
||||||
if(realm != null){
|
if(realm != null){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user