performance improvements
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
2f58d38a1f
commit
bdcdc266cd
@ -148,8 +148,8 @@
|
||||
"movementSystems" : [
|
||||
{
|
||||
"type" : "GROUND",
|
||||
"acceleration" : 400.0,
|
||||
"maxVelocity" : 80.5,
|
||||
"acceleration" : 800.0,
|
||||
"maxVelocity" : 120.0,
|
||||
"strafeMultiplier" : 1.0,
|
||||
"backpedalMultiplier" : 0.5,
|
||||
"footstepFirstAudioOffset" : 0.2,
|
||||
|
||||
Binary file not shown.
@ -1,3 +1,3 @@
|
||||
#maven.buildNumber.plugin properties file
|
||||
#Sat May 24 23:29:15 EDT 2025
|
||||
buildNumber=633
|
||||
#Sun May 25 09:48:39 EDT 2025
|
||||
buildNumber=634
|
||||
|
||||
@ -1984,6 +1984,9 @@ Upgrade target framerate
|
||||
Flag to enable/disable opengl error checking calls
|
||||
Performance improvements
|
||||
- Foliage cell quits earlier
|
||||
- Behavior tree addition/subtraction from scene optimization
|
||||
- Reduce bones on LOD human model
|
||||
Increase human move speed
|
||||
|
||||
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ import electrosphere.logger.LoggerInterface;
|
||||
import electrosphere.util.annotation.Exclude;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
@ -25,22 +26,32 @@ public class Scene {
|
||||
/**
|
||||
* The map of id -> entity
|
||||
*/
|
||||
Map<Integer,Entity> entityIdMap;
|
||||
private Map<Integer,Entity> entityIdMap;
|
||||
|
||||
/**
|
||||
* The map of tag -> set of entities corresponding to that tag
|
||||
*/
|
||||
Map<String,Set<Entity>> tagEntityMap;
|
||||
private Map<String,Set<Entity>> tagEntityMap;
|
||||
|
||||
/**
|
||||
* The map of entity -> tags that entity is registered to
|
||||
*/
|
||||
Map<Entity,List<String>> entityTagMap;
|
||||
private Map<Entity,List<String>> entityTagMap;
|
||||
|
||||
/**
|
||||
* The list of behavior trees
|
||||
*/
|
||||
List<BehaviorTree> behaviorTreeList;
|
||||
private List<BehaviorTree> behaviorTreeList;
|
||||
|
||||
/**
|
||||
* Accumulator for new behavior trees
|
||||
*/
|
||||
private List<BehaviorTree> additionList;
|
||||
|
||||
/**
|
||||
* The list of trees to remove
|
||||
*/
|
||||
private List<BehaviorTree> removalList;
|
||||
|
||||
@Exclude
|
||||
/**
|
||||
@ -52,29 +63,31 @@ public class Scene {
|
||||
* Constructor
|
||||
*/
|
||||
public Scene(){
|
||||
entityIdMap = new HashMap<Integer,Entity>();
|
||||
tagEntityMap = new HashMap<String,Set<Entity>>();
|
||||
behaviorTreeList = new LinkedList<BehaviorTree>();
|
||||
entityTagMap = new HashMap<Entity,List<String>>();
|
||||
tagEntityMap.put(EntityTags.BONE_ATTACHED, new HashSet<Entity>());
|
||||
tagEntityMap.put(EntityTags.COLLIDABLE, new HashSet<Entity>());
|
||||
tagEntityMap.put(EntityTags.SPRINTABLE, new HashSet<Entity>());
|
||||
tagEntityMap.put(EntityTags.MOVEABLE, new HashSet<Entity>());
|
||||
tagEntityMap.put(EntityTags.ATTACKER, new HashSet<Entity>());
|
||||
tagEntityMap.put(EntityTags.TARGETABLE, new HashSet<Entity>());
|
||||
tagEntityMap.put(EntityTags.LIFE_STATE, new HashSet<Entity>());
|
||||
tagEntityMap.put(EntityTags.CREATURE, new HashSet<Entity>());
|
||||
tagEntityMap.put(EntityTags.UI, new HashSet<Entity>());
|
||||
tagEntityMap.put(EntityTags.DRAWABLE, new HashSet<Entity>());
|
||||
tagEntityMap.put(EntityTags.DRAW_INSTANCED, new HashSet<Entity>());
|
||||
tagEntityMap.put(EntityTags.DRAW_VOLUMETIC_SOLIDS_PASS, new HashSet<Entity>());
|
||||
tagEntityMap.put(EntityTags.DRAW_VOLUMETIC_DEPTH_PASS, new HashSet<Entity>());
|
||||
tagEntityMap.put(EntityTags.DRAW_CAST_SHADOW, new HashSet<Entity>());
|
||||
tagEntityMap.put(EntityTags.LIGHT, new HashSet<Entity>());
|
||||
tagEntityMap.put(EntityTags.ITEM, new HashSet<Entity>());
|
||||
tagEntityMap.put(EntityTags.GRAVITY, new HashSet<Entity>());
|
||||
tagEntityMap.put(EntityTags.PARTICLE, new HashSet<Entity>());
|
||||
tagEntityMap.put(EntityTags.TRANSFORM_ATTACHED, new HashSet<Entity>());
|
||||
this.entityIdMap = new HashMap<Integer,Entity>();
|
||||
this.tagEntityMap = new HashMap<String,Set<Entity>>();
|
||||
this.behaviorTreeList = new LinkedList<BehaviorTree>();
|
||||
this.entityTagMap = new HashMap<Entity,List<String>>();
|
||||
this.additionList = new LinkedList<BehaviorTree>();
|
||||
this.removalList = new LinkedList<BehaviorTree>();
|
||||
this.tagEntityMap.put(EntityTags.BONE_ATTACHED, new HashSet<Entity>());
|
||||
this.tagEntityMap.put(EntityTags.COLLIDABLE, new HashSet<Entity>());
|
||||
this.tagEntityMap.put(EntityTags.SPRINTABLE, new HashSet<Entity>());
|
||||
this.tagEntityMap.put(EntityTags.MOVEABLE, new HashSet<Entity>());
|
||||
this.tagEntityMap.put(EntityTags.ATTACKER, new HashSet<Entity>());
|
||||
this.tagEntityMap.put(EntityTags.TARGETABLE, new HashSet<Entity>());
|
||||
this.tagEntityMap.put(EntityTags.LIFE_STATE, new HashSet<Entity>());
|
||||
this.tagEntityMap.put(EntityTags.CREATURE, new HashSet<Entity>());
|
||||
this.tagEntityMap.put(EntityTags.UI, new HashSet<Entity>());
|
||||
this.tagEntityMap.put(EntityTags.DRAWABLE, new HashSet<Entity>());
|
||||
this.tagEntityMap.put(EntityTags.DRAW_INSTANCED, new HashSet<Entity>());
|
||||
this.tagEntityMap.put(EntityTags.DRAW_VOLUMETIC_SOLIDS_PASS, new HashSet<Entity>());
|
||||
this.tagEntityMap.put(EntityTags.DRAW_VOLUMETIC_DEPTH_PASS, new HashSet<Entity>());
|
||||
this.tagEntityMap.put(EntityTags.DRAW_CAST_SHADOW, new HashSet<Entity>());
|
||||
this.tagEntityMap.put(EntityTags.LIGHT, new HashSet<Entity>());
|
||||
this.tagEntityMap.put(EntityTags.ITEM, new HashSet<Entity>());
|
||||
this.tagEntityMap.put(EntityTags.GRAVITY, new HashSet<Entity>());
|
||||
this.tagEntityMap.put(EntityTags.PARTICLE, new HashSet<Entity>());
|
||||
this.tagEntityMap.put(EntityTags.TRANSFORM_ATTACHED, new HashSet<Entity>());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -164,7 +177,10 @@ public class Scene {
|
||||
* @return The list of tags this entity is registered to
|
||||
*/
|
||||
public List<String> extractTags(Entity e){
|
||||
return this.entityTagMap.get(e);
|
||||
lock.lock();
|
||||
List<String> rVal = this.entityTagMap.get(e);
|
||||
lock.unlock();
|
||||
return rVal;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -224,7 +240,7 @@ public class Scene {
|
||||
*/
|
||||
public void registerBehaviorTree(BehaviorTree tree){
|
||||
lock.lock();
|
||||
behaviorTreeList.add(tree);
|
||||
this.additionList.add(tree);
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
@ -246,9 +262,7 @@ public class Scene {
|
||||
*/
|
||||
public void deregisterBehaviorTree(BehaviorTree tree){
|
||||
lock.lock();
|
||||
while(behaviorTreeList.contains(tree)){
|
||||
behaviorTreeList.remove(tree);
|
||||
}
|
||||
this.removalList.add(tree);
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
@ -258,8 +272,18 @@ public class Scene {
|
||||
public void simulateBehaviorTrees(float deltaTime){
|
||||
lock.lock();
|
||||
Globals.profiler.beginAggregateCpuSample("Scene.simulateBehaviorTrees");
|
||||
List<BehaviorTree> trees = new LinkedList<BehaviorTree>(behaviorTreeList);
|
||||
for(BehaviorTree tree : trees){
|
||||
//remove all trees that were queued to be removed
|
||||
this.behaviorTreeList.removeAll(this.removalList);
|
||||
|
||||
//add all trees that were queued to be added
|
||||
this.behaviorTreeList.addAll(this.additionList);
|
||||
|
||||
//clear both the lists that are accumulating
|
||||
this.removalList.clear();
|
||||
this.additionList.clear();
|
||||
|
||||
//simulate all trees
|
||||
for(BehaviorTree tree : this.behaviorTreeList){
|
||||
tree.simulate(deltaTime);
|
||||
}
|
||||
Globals.profiler.endCpuSample();
|
||||
@ -283,7 +307,19 @@ public class Scene {
|
||||
*/
|
||||
public Collection<BehaviorTree> getBehaviorTrees(){
|
||||
lock.lock();
|
||||
Collection<BehaviorTree> rVal = new LinkedList<BehaviorTree>(this.behaviorTreeList);
|
||||
Collection<BehaviorTree> rVal = Collections.unmodifiableList(this.behaviorTreeList);
|
||||
lock.unlock();
|
||||
return rVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of behavior trees that will execute next frame
|
||||
* @return The number of trees
|
||||
*/
|
||||
public int getNumBehaviorTrees(){
|
||||
int rVal = 0;
|
||||
lock.lock();
|
||||
rVal = this.behaviorTreeList.size() + this.additionList.size();
|
||||
lock.unlock();
|
||||
return rVal;
|
||||
}
|
||||
|
||||
@ -354,6 +354,12 @@ public class Model {
|
||||
if(animationCurrent != null){
|
||||
for(String boneName : mask){
|
||||
AnimChannel currentChannel = animationCurrent.getChannel(boneName);
|
||||
if(currentChannel == null){
|
||||
//this happens when we have an animation key for a bone that is not on this model
|
||||
//this can happen if, for example, you model a character, animate it, then delete a bone after the fact
|
||||
//if the animation key hasn't explicitly been removed in blender, it will show up here for the non-existant bone
|
||||
continue;
|
||||
}
|
||||
Bone currentBone = boneMap.get(currentChannel.getNodeID());
|
||||
currentChannel.setTime(time);
|
||||
// System.out.println(currentChannel + " " + currentBone);
|
||||
|
||||
@ -68,7 +68,7 @@ public class MicroSimulation {
|
||||
|
||||
//
|
||||
//simulate behavior trees
|
||||
if(dataCell.getScene().getBehaviorTrees().size() > 0){
|
||||
if(dataCell.getScene().getNumBehaviorTrees() > 0){
|
||||
dataCell.getScene().simulateBehaviorTrees((float)Globals.engineState.timekeeper.getSimFrameTime());
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user