convert scene tag datastructure
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-08-13 14:12:17 -04:00
parent 0b2086a1d4
commit 4cf34d162c
3 changed files with 20 additions and 19 deletions

View File

@ -15,7 +15,7 @@
+ fix the vibes + fix the vibes
Attack animation feels slow Attack animation feels slow
Hitboxes between server and client feel wayyyy off Stability
+ bug fixes + bug fixes

View File

@ -552,6 +552,7 @@ Movement tweaks
(08/13/2024) (08/13/2024)
Hitbox support offsets now Hitbox support offsets now
Multiple hitboxes per bone Multiple hitboxes per bone
Potential fix for client concurrency issue
# TODO # TODO

View File

@ -4,12 +4,12 @@ import electrosphere.engine.Globals;
import electrosphere.entity.btree.BehaviorTree; import electrosphere.entity.btree.BehaviorTree;
import electrosphere.entity.types.attach.AttachUtils; import electrosphere.entity.types.attach.AttachUtils;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CopyOnWriteArraySet;
/** /**
* A game scene * A game scene
@ -24,22 +24,22 @@ public class Scene {
List<BehaviorTree> behaviorTreeList = new CopyOnWriteArrayList<BehaviorTree>(); List<BehaviorTree> behaviorTreeList = new CopyOnWriteArrayList<BehaviorTree>();
public Scene(){ public Scene(){
tagEntityMap.put(EntityTags.BONE_ATTACHED, new HashSet<Entity>()); tagEntityMap.put(EntityTags.BONE_ATTACHED, new CopyOnWriteArraySet<Entity>());
tagEntityMap.put(EntityTags.COLLIDABLE, new HashSet<Entity>()); tagEntityMap.put(EntityTags.COLLIDABLE, new CopyOnWriteArraySet<Entity>());
tagEntityMap.put(EntityTags.SPRINTABLE, new HashSet<Entity>()); tagEntityMap.put(EntityTags.SPRINTABLE, new CopyOnWriteArraySet<Entity>());
tagEntityMap.put(EntityTags.MOVEABLE, new HashSet<Entity>()); tagEntityMap.put(EntityTags.MOVEABLE, new CopyOnWriteArraySet<Entity>());
tagEntityMap.put(EntityTags.ATTACKER, new HashSet<Entity>()); tagEntityMap.put(EntityTags.ATTACKER, new CopyOnWriteArraySet<Entity>());
tagEntityMap.put(EntityTags.TARGETABLE, new HashSet<Entity>()); tagEntityMap.put(EntityTags.TARGETABLE, new CopyOnWriteArraySet<Entity>());
tagEntityMap.put(EntityTags.LIFE_STATE, new HashSet<Entity>()); tagEntityMap.put(EntityTags.LIFE_STATE, new CopyOnWriteArraySet<Entity>());
tagEntityMap.put(EntityTags.CREATURE, new HashSet<Entity>()); tagEntityMap.put(EntityTags.CREATURE, new CopyOnWriteArraySet<Entity>());
tagEntityMap.put(EntityTags.UI, new HashSet<Entity>()); tagEntityMap.put(EntityTags.UI, new CopyOnWriteArraySet<Entity>());
tagEntityMap.put(EntityTags.DRAWABLE, new HashSet<Entity>()); tagEntityMap.put(EntityTags.DRAWABLE, new CopyOnWriteArraySet<Entity>());
tagEntityMap.put(EntityTags.DRAW_INSTANCED, new HashSet<Entity>()); tagEntityMap.put(EntityTags.DRAW_INSTANCED, new CopyOnWriteArraySet<Entity>());
tagEntityMap.put(EntityTags.LIGHT, new HashSet<Entity>()); tagEntityMap.put(EntityTags.LIGHT, new CopyOnWriteArraySet<Entity>());
tagEntityMap.put(EntityTags.ITEM, new HashSet<Entity>()); tagEntityMap.put(EntityTags.ITEM, new CopyOnWriteArraySet<Entity>());
tagEntityMap.put(EntityTags.GRAVITY, new HashSet<Entity>()); tagEntityMap.put(EntityTags.GRAVITY, new CopyOnWriteArraySet<Entity>());
tagEntityMap.put(EntityTags.PARTICLE, new HashSet<Entity>()); tagEntityMap.put(EntityTags.PARTICLE, new CopyOnWriteArraySet<Entity>());
tagEntityMap.put(EntityTags.TRANSFORM_ATTACHED, new HashSet<Entity>()); tagEntityMap.put(EntityTags.TRANSFORM_ATTACHED, new CopyOnWriteArraySet<Entity>());
} }
/** /**
@ -62,7 +62,7 @@ public class Scene {
if(tagEntityMap.containsKey(tag)){ if(tagEntityMap.containsKey(tag)){
tagEntityMap.get(tag).add(e); tagEntityMap.get(tag).add(e);
} else { } else {
Set<Entity> newEntityList = new HashSet<Entity>(); Set<Entity> newEntityList = new CopyOnWriteArraySet<Entity>();
newEntityList.add(e); newEntityList.add(e);
tagEntityMap.put(tag,newEntityList); tagEntityMap.put(tag,newEntityList);
} }