Compare commits
2 Commits
3d6b71bf01
...
ab17254a02
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab17254a02 | ||
|
|
6088080257 |
25
docs/src/highlevel-design/chemisty/chemistrydesign.md
Normal file
25
docs/src/highlevel-design/chemisty/chemistrydesign.md
Normal file
@ -0,0 +1,25 @@
|
||||
@page chemistrydesign Chemistry System Design
|
||||
|
||||
Design notes for the chemistry system
|
||||
|
||||
|
||||
Ideas for the chemistry system:
|
||||
- fire
|
||||
- water
|
||||
- electricity
|
||||
- ice
|
||||
- gravity
|
||||
- stabilization
|
||||
- metal parts / conductivity
|
||||
- light
|
||||
- mirrors
|
||||
- plants burning
|
||||
- plants growing really fast
|
||||
- flight
|
||||
- springiness/catapults (eg tree catapulting something)
|
||||
- spinning mechanisms and gears
|
||||
- weighing things down and measuring scales w/ weight
|
||||
- trampolines
|
||||
- Wind/fans
|
||||
- Weight
|
||||
- Music
|
||||
6
docs/src/highlevel-design/chemisty/chemistryindex.md
Normal file
6
docs/src/highlevel-design/chemisty/chemistryindex.md
Normal file
@ -0,0 +1,6 @@
|
||||
@page chemistryindex Chemistry
|
||||
|
||||
Pages on the chemistry system
|
||||
|
||||
[TOC]
|
||||
- @subpage chemistrydesign
|
||||
@ -17,12 +17,6 @@ A list of all creatures that are targets for the game, and what their status of
|
||||
- [X] Data
|
||||
|
||||
|
||||
## Rat Man
|
||||
- [ ] 3d Model
|
||||
- [ ] Viewmodel
|
||||
- [ ] Data
|
||||
|
||||
|
||||
## Deer
|
||||
- [ ] 3d Model
|
||||
- [ ] Data
|
||||
@ -51,6 +45,11 @@ A list of all creatures that are targets for the game, and what their status of
|
||||
- [ ] Data
|
||||
|
||||
|
||||
## Horse
|
||||
- [ ] 3d Model
|
||||
- [ ] Data
|
||||
|
||||
|
||||
## Elf
|
||||
- [X] Copy of Human
|
||||
- [ ] Attributes 0/?
|
||||
@ -63,6 +62,12 @@ A list of all creatures that are targets for the game, and what their status of
|
||||
- [ ] Data
|
||||
|
||||
|
||||
## Rat Man
|
||||
- [ ] 3d Model
|
||||
- [ ] Viewmodel
|
||||
- [ ] Data
|
||||
|
||||
|
||||
## Frog Man
|
||||
- [ ] 3d Model
|
||||
- [ ] Viewmodel
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
@page skeletonprogres Skeleton
|
||||
@page skeletonprogress Skeleton
|
||||
|
||||
Progress on the skeleton creature
|
||||
|
||||
|
||||
@ -11,6 +11,7 @@ Discussion of, at a high game-design level, how everything should work and conne
|
||||
- @subpage streamintegrationideas
|
||||
- @subpage magicindex
|
||||
- @subpage creaturesindex
|
||||
- @subpage chemistryindex
|
||||
- @subpage macrosimtimeline
|
||||
- @subpage narrativemanager
|
||||
- @subpage itemsindex
|
||||
|
||||
@ -38,6 +38,7 @@
|
||||
|
||||
+ bug fixes
|
||||
Fix skeleton right strafe
|
||||
Fix block tree preventing initiating an attack
|
||||
Fix return to title menu synchronization bug
|
||||
|
||||
+ unreproducible bugs
|
||||
|
||||
@ -796,6 +796,11 @@ New katana icon
|
||||
UI fix
|
||||
Initial hitstun implementation
|
||||
|
||||
(09/18/2024)
|
||||
Migrate documentation
|
||||
Netcode generator qol fixes
|
||||
Combat Stances Component
|
||||
Remove geometry shader support
|
||||
|
||||
# TODO
|
||||
|
||||
|
||||
@ -636,7 +636,7 @@ public class Globals {
|
||||
assetManager.addModelPathToQueue("Models/basic/geometry/unitplane.fbx");
|
||||
assetManager.addModelPathToQueue("Models/basic/geometry/unitcube.fbx");
|
||||
imagePlaneModelID = assetManager.registerModel(RenderUtils.createPlaneModel("Shaders/core/plane/plane.vs", "Shaders/core/plane/plane.fs"));
|
||||
assetManager.addShaderToQueue("Shaders/core/plane/plane.vs", null, "Shaders/core/plane/plane.fs");
|
||||
assetManager.addShaderToQueue("Shaders/core/plane/plane.vs", "Shaders/core/plane/plane.fs");
|
||||
solidPlaneModelID = assetManager.registerModel(RenderUtils.createInWindowPanel("Shaders/ui/plainBox/plainBox.vs", "Shaders/ui/plainBox/plainBox.fs"));
|
||||
|
||||
//image panel
|
||||
@ -645,11 +645,11 @@ public class Globals {
|
||||
Globals.assetManager.addShaderToQueue("Shaders/ui/plainBox/plainBox.vs", "Shaders/ui/plainBox/plainBox.fs");
|
||||
|
||||
//window content shader
|
||||
assetManager.addShaderToQueue("Shaders/ui/windowContent/windowContent.vs", null, "Shaders/ui/windowContent/windowContent.fs");
|
||||
assetManager.addShaderToQueue("Shaders/ui/windowContent/windowContent.vs", "Shaders/ui/windowContent/windowContent.fs");
|
||||
|
||||
//debug shaders
|
||||
assetManager.addShaderToQueue("Shaders/ui/debug/windowBorder/windowBound.vs", null, "Shaders/ui/debug/windowBorder/windowBound.fs");
|
||||
assetManager.addShaderToQueue("Shaders/ui/debug/windowContentBorder/windowContentBound.vs", null, "Shaders/ui/debug/windowContentBorder/windowContentBound.fs");
|
||||
assetManager.addShaderToQueue("Shaders/ui/debug/windowBorder/windowBound.vs", "Shaders/ui/debug/windowBorder/windowBound.fs");
|
||||
assetManager.addShaderToQueue("Shaders/ui/debug/windowContentBorder/windowContentBound.vs", "Shaders/ui/debug/windowContentBorder/windowContentBound.fs");
|
||||
|
||||
//as these assets are required for the renderer to work, we go ahead and
|
||||
//load them into memory now. The loading time penalty is worth it I think.
|
||||
|
||||
@ -120,18 +120,11 @@ public class AssetManager {
|
||||
LoggerInterface.loggerEngine.DEBUG_LOOP("AssetManager - Load shaders");
|
||||
for(ActorShaderMask currentShader : shadersInQueue){
|
||||
shadersInQueue.remove(currentShader);
|
||||
String key = getShaderKey(currentShader.getVertexShaderPath(),currentShader.getGeometryShaderPath(),currentShader.getFragmentShaderPath());
|
||||
if(currentShader.getGeometryShaderPath() == null){
|
||||
shadersLoadedIntoMemory.put(
|
||||
key,
|
||||
ShaderProgram.loadSpecificShader(currentShader.getVertexShaderPath(),currentShader.getFragmentShaderPath())
|
||||
);
|
||||
} else {
|
||||
shadersLoadedIntoMemory.put(
|
||||
key,
|
||||
ShaderProgram.loadSpecificShader(currentShader.getVertexShaderPath(),currentShader.getGeometryShaderPath(),currentShader.getFragmentShaderPath())
|
||||
);
|
||||
}
|
||||
String key = getShaderKey(currentShader.getVertexShaderPath(),currentShader.getFragmentShaderPath());
|
||||
shadersLoadedIntoMemory.put(
|
||||
key,
|
||||
ShaderProgram.loadSpecificShader(currentShader.getVertexShaderPath(),currentShader.getFragmentShaderPath())
|
||||
);
|
||||
}
|
||||
//pose models
|
||||
LoggerInterface.loggerEngine.DEBUG_LOOP("AssetManager - Load pose models");
|
||||
@ -396,15 +389,11 @@ public class AssetManager {
|
||||
//SHADERS
|
||||
//
|
||||
public void addShaderToQueue(String vertexShader, String fragmentShader){
|
||||
shadersInQueue.add(new ActorShaderMask("","",vertexShader,null,fragmentShader));
|
||||
shadersInQueue.add(new ActorShaderMask("","",vertexShader,fragmentShader));
|
||||
}
|
||||
|
||||
public void addShaderToQueue(String vertexShader, String geometryShader, String fragmentShader){
|
||||
shadersInQueue.add(new ActorShaderMask("","",vertexShader,geometryShader,fragmentShader));
|
||||
}
|
||||
|
||||
public ShaderProgram fetchShader(String vertexPath, String geometryShader, String fragmentPath){
|
||||
String path = getShaderKey(vertexPath,geometryShader,fragmentPath);
|
||||
public ShaderProgram fetchShader(String vertexPath, String fragmentPath){
|
||||
String path = getShaderKey(vertexPath,fragmentPath);
|
||||
ShaderProgram rVal = null;
|
||||
if(shadersLoadedIntoMemory.containsKey(path)){
|
||||
rVal = shadersLoadedIntoMemory.get(path);
|
||||
@ -412,8 +401,8 @@ public class AssetManager {
|
||||
return rVal;
|
||||
}
|
||||
|
||||
static String getShaderKey(String vertexPath, String geometryPath, String fragmentPath){
|
||||
return vertexPath + "-" + geometryPath + "-" + fragmentPath;
|
||||
static String getShaderKey(String vertexPath, String fragmentPath){
|
||||
return vertexPath + "-" + fragmentPath;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -422,10 +411,7 @@ public class AssetManager {
|
||||
public void forceReloadAllShaders(){
|
||||
for(String shaderKey : shadersLoadedIntoMemory.keySet()){
|
||||
String shaderPaths[] = shaderKey.split("-");
|
||||
if(shaderPaths[1].equals("null")){
|
||||
shaderPaths[1] = null;
|
||||
}
|
||||
shadersInQueue.add(new ActorShaderMask("","",shaderPaths[0],shaderPaths[1],shaderPaths[2]));
|
||||
shadersInQueue.add(new ActorShaderMask("","",shaderPaths[0],shaderPaths[1]));
|
||||
}
|
||||
shadersLoadedIntoMemory.clear();
|
||||
}
|
||||
|
||||
@ -317,6 +317,12 @@ public class EntityDataStrings {
|
||||
public static final String TREE_CLIENTWALKTREE = "treeClientWalkTree";
|
||||
public static final String TREE_SERVERWALKTREE = "treeServerWalkTree";
|
||||
|
||||
/**
|
||||
* Weapon stance
|
||||
*/
|
||||
public static final String TREE_CLIENTSTANCECOMPONENT = "treeClientStanceComponent";
|
||||
public static final String TREE_SERVERSTANCECOMPONENT = "treeServerStanceComponent";
|
||||
|
||||
/*
|
||||
Entity categories
|
||||
*/
|
||||
|
||||
@ -45,8 +45,10 @@ public class ClientSprintTree implements BehaviorTree {
|
||||
Entity parent;
|
||||
|
||||
/**
|
||||
* Gets the state of the tree
|
||||
* @return The state
|
||||
* <p> Automatically generated </p>
|
||||
* <p>
|
||||
* Gets state.
|
||||
* </p>
|
||||
*/
|
||||
public SprintTreeState getState(){
|
||||
return state;
|
||||
|
||||
@ -51,8 +51,10 @@ public class ServerSprintTree implements BehaviorTree {
|
||||
int staminaCurrent = 0;
|
||||
|
||||
/**
|
||||
* Gets the state of the tree
|
||||
* @return The state of the tree
|
||||
* <p> Automatically generated </p>
|
||||
* <p>
|
||||
* Gets state.
|
||||
* </p>
|
||||
*/
|
||||
public SprintTreeState getState(){
|
||||
return state;
|
||||
|
||||
@ -217,4 +217,14 @@ public class ClientWalkTree implements BehaviorTree {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p> Automatically generated </p>
|
||||
* <p>
|
||||
* Gets state.
|
||||
* </p>
|
||||
*/
|
||||
public WalkState getState(){
|
||||
return state;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -83,11 +83,13 @@ public class ServerWalkTree implements BehaviorTree {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state
|
||||
* @return The state
|
||||
* <p> Automatically generated </p>
|
||||
* <p>
|
||||
* Gets state.
|
||||
* </p>
|
||||
*/
|
||||
public WalkState getState(){
|
||||
return this.state;
|
||||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -0,0 +1,206 @@
|
||||
package electrosphere.entity.state.stance;
|
||||
|
||||
|
||||
import electrosphere.entity.btree.BehaviorTree;
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.entity.EntityDataStrings;
|
||||
import electrosphere.net.synchronization.server.ServerSynchronizationManager;
|
||||
import electrosphere.net.parser.net.message.SynchronizationMessage;
|
||||
import electrosphere.net.synchronization.enums.BehaviorTreeIdEnums;
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.net.synchronization.annotation.SyncedField;
|
||||
import electrosphere.net.synchronization.annotation.SynchronizableEnum;
|
||||
import electrosphere.net.synchronization.annotation.SynchronizedBehaviorTree;
|
||||
|
||||
/**
|
||||
* Tracks the weapon/combat stance of the entity
|
||||
*/
|
||||
@SynchronizedBehaviorTree(
|
||||
name = "clientStanceComponent",
|
||||
isServer = false,
|
||||
correspondingTree = "serverStanceComponent",
|
||||
genStartInt = true
|
||||
)
|
||||
public class ClientStanceComponent implements BehaviorTree {
|
||||
|
||||
@SynchronizableEnum
|
||||
public static enum CombatStance {
|
||||
/**
|
||||
* Not in attacking stance
|
||||
*/
|
||||
IDLE,
|
||||
/**
|
||||
* No weapon equipped, in attacking stance
|
||||
*/
|
||||
UNARMED,
|
||||
/**
|
||||
* Weapon equipped, in attacking stance
|
||||
*/
|
||||
ARMED,
|
||||
}
|
||||
|
||||
@SyncedField
|
||||
CombatStance state = CombatStance.IDLE;
|
||||
|
||||
/**
|
||||
* The parent entity
|
||||
*/
|
||||
Entity parent;
|
||||
|
||||
/**
|
||||
* <p> (initially) Automatically generated </p>
|
||||
* <p>
|
||||
* Attaches this tree to the entity.
|
||||
* </p>
|
||||
* @param entity The entity to attach to
|
||||
* @param tree The behavior tree to attach
|
||||
* @param params Optional parameters that will be provided to the constructor
|
||||
*/
|
||||
public static ClientStanceComponent attachTree(Entity parent, Object ... params){
|
||||
ClientStanceComponent rVal = new ClientStanceComponent(parent,params);
|
||||
//!!WARNING!! from here below should not be touched
|
||||
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
||||
parent.putData(EntityDataStrings.TREE_CLIENTSTANCECOMPONENT, rVal);
|
||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
||||
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTSTANCECOMPONENT_ID);
|
||||
return rVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p> Automatically generated </p>
|
||||
* <p>
|
||||
* Detatches this tree from the entity.
|
||||
* </p>
|
||||
* @param entity The entity to detach to
|
||||
* @param tree The behavior tree to detach
|
||||
*/
|
||||
public static void detachTree(Entity entity, BehaviorTree tree){
|
||||
Globals.entityValueTrackingService.detatchTreeFromEntity(entity, BehaviorTreeIdEnums.BTREE_CLIENTSTANCECOMPONENT_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p> (initially) Automatically generated </p>
|
||||
* <p> Private constructor to enforce using the attach methods </p>
|
||||
* <p>
|
||||
* Constructor
|
||||
* </p>
|
||||
* @param parent The parent entity of this tree
|
||||
* @param params Optional parameters that can be provided when attaching the tree. All custom data required for creating this tree should be passed in this varargs.
|
||||
*/
|
||||
public ClientStanceComponent(Entity parent, Object ... params){
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Gets the ClientStanceComponent of the entity
|
||||
* </p>
|
||||
* @param entity the entity
|
||||
* @return The ClientStanceComponent
|
||||
*/
|
||||
public static ClientStanceComponent getClientStanceComponent(Entity entity){
|
||||
return (ClientStanceComponent)entity.getData(EntityDataStrings.TREE_CLIENTSTANCECOMPONENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p> Automatically generated </p>
|
||||
* <p>
|
||||
* Requests that the server start this btree
|
||||
* </p>
|
||||
*/
|
||||
public void start(){
|
||||
Globals.clientConnection.queueOutgoingMessage(
|
||||
SynchronizationMessage.constructClientRequestBTreeActionMessage(
|
||||
Globals.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
||||
BehaviorTreeIdEnums.BTREE_CLIENTSTANCECOMPONENT_ID,
|
||||
ServerSynchronizationManager.SERVER_SYNC_START
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p> Automatically generated </p>
|
||||
* <p>
|
||||
* Requests that the server start this btree
|
||||
* </p>
|
||||
*/
|
||||
public void interrupt(){
|
||||
Globals.clientConnection.queueOutgoingMessage(
|
||||
SynchronizationMessage.constructClientRequestBTreeActionMessage(
|
||||
Globals.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
||||
BehaviorTreeIdEnums.BTREE_CLIENTSTANCECOMPONENT_ID,
|
||||
ServerSynchronizationManager.SERVER_SYNC_INTERRUPT
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p> Automatically generated </p>
|
||||
* <p>
|
||||
* Sets state and handles the synchronization logic for it.
|
||||
* </p>
|
||||
* @param state The value to set state to.
|
||||
*/
|
||||
public void setState(CombatStance state){
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p> Automatically generated </p>
|
||||
* <p>
|
||||
* Converts a short to the equivalent enum value
|
||||
* </p>
|
||||
* @param shortVal The short value
|
||||
* @return The enum value
|
||||
*/
|
||||
public static CombatStance getCombatStanceShortAsEnum(short shortVal){
|
||||
switch(shortVal){
|
||||
case 0:
|
||||
return CombatStance.IDLE;
|
||||
case 1:
|
||||
return CombatStance.UNARMED;
|
||||
case 2:
|
||||
return CombatStance.ARMED;
|
||||
default:
|
||||
return CombatStance.IDLE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p> Automatically generated </p>
|
||||
* <p>
|
||||
* Converts this enum type to an equivalent short value
|
||||
* </p>
|
||||
* @param enumVal The enum value
|
||||
* @return The short value
|
||||
*/
|
||||
public static short getCombatStanceEnumAsShort(CombatStance enumVal){
|
||||
switch(enumVal){
|
||||
case IDLE:
|
||||
return 0;
|
||||
case UNARMED:
|
||||
return 1;
|
||||
case ARMED:
|
||||
return 2;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void simulate(float deltaTime) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'simulate'");
|
||||
}
|
||||
|
||||
/**
|
||||
* <p> Automatically generated </p>
|
||||
* <p>
|
||||
* Gets state.
|
||||
* </p>
|
||||
*/
|
||||
public CombatStance getState(){
|
||||
return state;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,129 @@
|
||||
package electrosphere.entity.state.stance;
|
||||
|
||||
|
||||
import electrosphere.entity.btree.BehaviorTree;
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.entity.EntityDataStrings;
|
||||
import electrosphere.net.synchronization.enums.FieldIdEnums;
|
||||
import electrosphere.server.datacell.utils.DataCellSearchUtils;
|
||||
import electrosphere.net.parser.net.message.SynchronizationMessage;
|
||||
import electrosphere.net.synchronization.enums.BehaviorTreeIdEnums;
|
||||
import electrosphere.server.datacell.utils.ServerBehaviorTreeUtils;
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.state.stance.ClientStanceComponent.CombatStance;
|
||||
import electrosphere.net.synchronization.annotation.SyncedField;
|
||||
import electrosphere.net.synchronization.annotation.SynchronizedBehaviorTree;
|
||||
|
||||
/**
|
||||
* Tracks the weapon/combat stance of the entity
|
||||
*/
|
||||
@SynchronizedBehaviorTree(
|
||||
name = "serverStanceComponent",
|
||||
isServer = true,
|
||||
correspondingTree = "clientStanceComponent"
|
||||
)
|
||||
public class ServerStanceComponent implements BehaviorTree {
|
||||
|
||||
@SyncedField
|
||||
CombatStance state = CombatStance.IDLE;
|
||||
|
||||
/**
|
||||
* The parent entity of this component
|
||||
*/
|
||||
Entity parent;
|
||||
|
||||
/**
|
||||
* <p> (initially) Automatically generated </p>
|
||||
* <p>
|
||||
* Attaches this tree to the entity.
|
||||
* </p>
|
||||
* @param entity The entity to attach to
|
||||
* @param tree The behavior tree to attach
|
||||
* @param params Optional parameters that will be provided to the constructor
|
||||
*/
|
||||
public static ServerStanceComponent attachTree(Entity parent, Object ... params){
|
||||
ServerStanceComponent rVal = new ServerStanceComponent(parent,params);
|
||||
//!!WARNING!! from here below should not be touched
|
||||
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
||||
ServerBehaviorTreeUtils.attachBTreeToEntity(parent, rVal);
|
||||
parent.putData(EntityDataStrings.TREE_SERVERSTANCECOMPONENT, rVal);
|
||||
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_SERVERSTANCECOMPONENT_ID);
|
||||
return rVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p> Automatically generated </p>
|
||||
* <p>
|
||||
* Detatches this tree from the entity.
|
||||
* </p>
|
||||
* @param entity The entity to detach to
|
||||
* @param tree The behavior tree to detach
|
||||
*/
|
||||
public static void detachTree(Entity entity, BehaviorTree tree){
|
||||
Globals.entityValueTrackingService.detatchTreeFromEntity(entity, BehaviorTreeIdEnums.BTREE_SERVERSTANCECOMPONENT_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p> (initially) Automatically generated </p>
|
||||
* <p> Private constructor to enforce using the attach methods </p>
|
||||
* <p>
|
||||
* Constructor
|
||||
* </p>
|
||||
* @param parent The parent entity of this tree
|
||||
* @param params Optional parameters that can be provided when attaching the tree. All custom data required for creating this tree should be passed in this varargs.
|
||||
*/
|
||||
public ServerStanceComponent(Entity parent, Object ... params){
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Gets the ServerStanceComponent of the entity
|
||||
* </p>
|
||||
* @param entity the entity
|
||||
* @return The ServerStanceComponent
|
||||
*/
|
||||
public static ServerStanceComponent getServerStanceComponent(Entity entity){
|
||||
return (ServerStanceComponent)entity.getData(EntityDataStrings.TREE_SERVERSTANCECOMPONENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p> Automatically generated </p>
|
||||
* <p>
|
||||
* Sets state and handles the synchronization logic for it.
|
||||
* </p>
|
||||
* @param state The value to set state to.
|
||||
*/
|
||||
public void setState(CombatStance state){
|
||||
this.state = state;
|
||||
int value = ClientStanceComponent.getCombatStanceEnumAsShort(state);
|
||||
if(DataCellSearchUtils.getEntityDataCell(parent) != null){
|
||||
DataCellSearchUtils.getEntityDataCell(parent).broadcastNetworkMessage(SynchronizationMessage.constructUpdateClientStateMessage(parent.getId(), BehaviorTreeIdEnums.BTREE_SERVERSTANCECOMPONENT_ID, FieldIdEnums.TREE_SERVERSTANCECOMPONENT_SYNCEDFIELD_STATE_ID, value));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void simulate(float deltaTime) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'simulate'");
|
||||
}
|
||||
|
||||
public void start(){
|
||||
|
||||
}
|
||||
|
||||
public void interrupt(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* <p> Automatically generated </p>
|
||||
* <p>
|
||||
* Gets state.
|
||||
* </p>
|
||||
*/
|
||||
public CombatStance getState(){
|
||||
return state;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
package electrosphere.net.synchronization.client;
|
||||
|
||||
|
||||
import electrosphere.entity.state.stance.ClientStanceComponent;
|
||||
import electrosphere.entity.state.movement.sprint.ClientSprintTree;
|
||||
import electrosphere.entity.state.equip.ClientEquipState;
|
||||
import electrosphere.entity.state.movement.jump.ClientJumpTree;
|
||||
import electrosphere.entity.state.movement.walk.ClientWalkTree;
|
||||
import electrosphere.entity.state.life.ClientLifeTree;
|
||||
@ -203,6 +203,14 @@ public class ClientSynchronizationManager {
|
||||
} break;
|
||||
}
|
||||
} break;
|
||||
case BehaviorTreeIdEnums.BTREE_SERVERSTANCECOMPONENT_ID: {
|
||||
switch(message.getfieldId()){
|
||||
case FieldIdEnums.TREE_SERVERSTANCECOMPONENT_SYNCEDFIELD_STATE_ID:{
|
||||
ClientStanceComponent tree = ClientStanceComponent.getClientStanceComponent(entity);
|
||||
tree.setState(ClientStanceComponent.getCombatStanceShortAsEnum((short)message.getbTreeValue()));
|
||||
} break;
|
||||
}
|
||||
} break;
|
||||
case BehaviorTreeIdEnums.BTREE_SERVERGROUNDMOVEMENTTREE_ID: {
|
||||
switch(message.getfieldId()){
|
||||
case FieldIdEnums.TREE_SERVERGROUNDMOVEMENTTREE_SYNCEDFIELD_FACING_ID:{
|
||||
|
||||
@ -17,6 +17,8 @@ public class BehaviorTreeIdEnums {
|
||||
public static final int BTREE_SERVERIDLE_ID = 9;
|
||||
public static final int BTREE_CLIENTLIFETREE_ID = 6;
|
||||
public static final int BTREE_SERVERLIFETREE_ID = 13;
|
||||
public static final int BTREE_CLIENTSTANCECOMPONENT_ID = 20;
|
||||
public static final int BTREE_SERVERSTANCECOMPONENT_ID = 21;
|
||||
public static final int BTREE_CLIENTGROUNDMOVEMENTTREE_ID = 10;
|
||||
public static final int BTREE_SERVERGROUNDMOVEMENTTREE_ID = 11;
|
||||
public static final int BTREE_CLIENTJUMPTREE_ID = 14;
|
||||
|
||||
@ -21,6 +21,8 @@ public class FieldIdEnums {
|
||||
public static final int TREE_SERVERIDLE_SYNCEDFIELD_STATE_ID = 13;
|
||||
public static final int TREE_CLIENTLIFETREE_SYNCEDFIELD_STATE_ID = 10;
|
||||
public static final int TREE_SERVERLIFETREE_SYNCEDFIELD_STATE_ID = 17;
|
||||
public static final int TREE_CLIENTSTANCECOMPONENT_SYNCEDFIELD_STATE_ID = 28;
|
||||
public static final int TREE_SERVERSTANCECOMPONENT_SYNCEDFIELD_STATE_ID = 29;
|
||||
public static final int TREE_CLIENTGROUNDMOVEMENTTREE_SYNCEDFIELD_FACING_ID = 14;
|
||||
public static final int TREE_SERVERGROUNDMOVEMENTTREE_SYNCEDFIELD_FACING_ID = 15;
|
||||
public static final int TREE_CLIENTJUMPTREE_SYNCEDFIELD_STATE_ID = 18;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package electrosphere.net.synchronization.server;
|
||||
|
||||
|
||||
import electrosphere.entity.state.stance.ServerStanceComponent;
|
||||
import electrosphere.entity.state.movement.sprint.ServerSprintTree;
|
||||
import electrosphere.logger.LoggerInterface;
|
||||
|
||||
@ -89,6 +90,17 @@ public class ServerSynchronizationManager {
|
||||
*/
|
||||
private void updateEntityState(Entity entity, int bTreeId, SynchronizationMessage message){
|
||||
switch(bTreeId){
|
||||
case BehaviorTreeIdEnums.BTREE_CLIENTSTANCECOMPONENT_ID: {
|
||||
ServerStanceComponent tree = ServerStanceComponent.getServerStanceComponent(entity);
|
||||
switch(message.getbTreeValue()){
|
||||
case ServerSynchronizationManager.SERVER_SYNC_START: {
|
||||
tree.start();
|
||||
} break;
|
||||
case ServerSynchronizationManager.SERVER_SYNC_INTERRUPT: {
|
||||
tree.interrupt();
|
||||
} break;
|
||||
}
|
||||
} break;
|
||||
case BehaviorTreeIdEnums.BTREE_CLIENTJUMPTREE_ID: {
|
||||
ServerJumpTree tree = ServerJumpTree.getServerJumpTree(entity);
|
||||
switch(message.getbTreeValue()){
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
package electrosphere.net.synchronization.transport;
|
||||
|
||||
|
||||
import electrosphere.entity.state.stance.ServerStanceComponent;
|
||||
import electrosphere.entity.state.stance.ClientStanceComponent;
|
||||
import electrosphere.entity.state.movement.sprint.ServerSprintTree;
|
||||
import electrosphere.entity.state.movement.sprint.ClientSprintTree;
|
||||
import electrosphere.entity.state.equip.ClientEquipState;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@ -13,7 +14,6 @@ import electrosphere.entity.state.attack.ClientAttackTree;
|
||||
import electrosphere.entity.state.attack.ServerAttackTree;
|
||||
import electrosphere.entity.state.block.ClientBlockTree;
|
||||
import electrosphere.entity.state.block.ServerBlockTree;
|
||||
import electrosphere.entity.state.equip.ServerEquipState;
|
||||
import electrosphere.entity.state.gravity.ClientGravityTree;
|
||||
import electrosphere.entity.state.gravity.ServerGravityTree;
|
||||
import electrosphere.entity.state.idle.ClientIdleTree;
|
||||
@ -79,9 +79,6 @@ public class StateCollection {
|
||||
collection.setValue(new SynchronizedFieldValue(BehaviorTreeIdEnums.BTREE_SERVERBLOCKTREE_ID,FieldIdEnums.TREE_SERVERBLOCKTREE_SYNCEDFIELD_STATE_ID,ClientBlockTree.getBlockStateEnumAsShort(tree.getState())));
|
||||
collection.setValue(new SynchronizedFieldValue(BehaviorTreeIdEnums.BTREE_SERVERBLOCKTREE_ID,FieldIdEnums.TREE_SERVERBLOCKTREE_SYNCEDFIELD_CURRENTBLOCKVARIANT_ID,tree.getCurrentBlockVariant()));
|
||||
} break;
|
||||
case BehaviorTreeIdEnums.BTREE_SERVEREQUIPSTATE_ID: {
|
||||
ServerEquipState tree = ServerEquipState.getServerEquipState(entity);
|
||||
} break;
|
||||
case BehaviorTreeIdEnums.BTREE_SERVERGRAVITY_ID: {
|
||||
ServerGravityTree tree = ServerGravityTree.getServerGravityTree(entity);
|
||||
collection.setValue(new SynchronizedFieldValue(BehaviorTreeIdEnums.BTREE_SERVERGRAVITY_ID,FieldIdEnums.TREE_SERVERGRAVITY_SYNCEDFIELD_STATE_ID,ClientGravityTree.getGravityTreeStateEnumAsShort(tree.getState())));
|
||||
@ -94,6 +91,10 @@ public class StateCollection {
|
||||
ServerLifeTree tree = ServerLifeTree.getServerLifeTree(entity);
|
||||
collection.setValue(new SynchronizedFieldValue(BehaviorTreeIdEnums.BTREE_SERVERLIFETREE_ID,FieldIdEnums.TREE_SERVERLIFETREE_SYNCEDFIELD_STATE_ID,ClientLifeTree.getLifeStateEnumEnumAsShort(tree.getState())));
|
||||
} break;
|
||||
case BehaviorTreeIdEnums.BTREE_SERVERSTANCECOMPONENT_ID: {
|
||||
ServerStanceComponent tree = ServerStanceComponent.getServerStanceComponent(entity);
|
||||
collection.setValue(new SynchronizedFieldValue(BehaviorTreeIdEnums.BTREE_SERVERSTANCECOMPONENT_ID,FieldIdEnums.TREE_SERVERSTANCECOMPONENT_SYNCEDFIELD_STATE_ID,ClientStanceComponent.getCombatStanceEnumAsShort(tree.getState())));
|
||||
} break;
|
||||
case BehaviorTreeIdEnums.BTREE_SERVERGROUNDMOVEMENTTREE_ID: {
|
||||
ServerGroundMovementTree tree = ServerGroundMovementTree.getServerGroundMovementTree(entity);
|
||||
collection.setValue(new SynchronizedFieldValue(BehaviorTreeIdEnums.BTREE_SERVERGROUNDMOVEMENTTREE_ID,FieldIdEnums.TREE_SERVERGROUNDMOVEMENTTREE_SYNCEDFIELD_FACING_ID,ClientGroundMovementTree.getMovementRelativeFacingEnumAsShort(tree.getFacing())));
|
||||
@ -154,11 +155,6 @@ public class StateCollection {
|
||||
} break;
|
||||
}
|
||||
} break;
|
||||
case BehaviorTreeIdEnums.BTREE_SERVEREQUIPSTATE_ID: {
|
||||
ClientEquipState tree = ClientEquipState.getClientEquipState(entity);
|
||||
switch(syncedValue.getFieldId()){
|
||||
}
|
||||
} break;
|
||||
case BehaviorTreeIdEnums.BTREE_SERVERGRAVITY_ID: {
|
||||
ClientGravityTree tree = ClientGravityTree.getClientGravityTree(entity);
|
||||
switch(syncedValue.getFieldId()){
|
||||
@ -183,6 +179,14 @@ public class StateCollection {
|
||||
} break;
|
||||
}
|
||||
} break;
|
||||
case BehaviorTreeIdEnums.BTREE_SERVERSTANCECOMPONENT_ID: {
|
||||
ClientStanceComponent tree = ClientStanceComponent.getClientStanceComponent(entity);
|
||||
switch(syncedValue.getFieldId()){
|
||||
case(FieldIdEnums.TREE_SERVERSTANCECOMPONENT_SYNCEDFIELD_STATE_ID): {
|
||||
tree.setState(ClientStanceComponent.getCombatStanceShortAsEnum(((Double)syncedValue.getValue()).shortValue()));
|
||||
} break;
|
||||
}
|
||||
} break;
|
||||
case BehaviorTreeIdEnums.BTREE_SERVERGROUNDMOVEMENTTREE_ID: {
|
||||
ClientGroundMovementTree tree = ClientGroundMovementTree.getClientGroundMovementTree(entity);
|
||||
switch(syncedValue.getFieldId()){
|
||||
|
||||
@ -613,18 +613,7 @@ public class Actor {
|
||||
* @param fragmentShader the fragment shader to apply
|
||||
*/
|
||||
public void maskShader(String mesh, String vertexShader, String fragmentShader){
|
||||
shaderMasks.add(new ActorShaderMask(this.modelPath, mesh, vertexShader, null, fragmentShader));
|
||||
}
|
||||
|
||||
/**
|
||||
* Masks a shader with another shader
|
||||
* @param mesh the mesh to apply the mask on
|
||||
* @param vertexShader the vertex shader to apply
|
||||
* @param geometryShader the geometry shader to apply
|
||||
* @param fragmentShader the fragment shader to apply
|
||||
*/
|
||||
public void maskShader(String mesh, String vertexShader, String geometryShader, String fragmentShader){
|
||||
shaderMasks.add(new ActorShaderMask(this.modelPath, mesh, vertexShader, geometryShader, fragmentShader));
|
||||
shaderMasks.add(new ActorShaderMask(this.modelPath, mesh, vertexShader, fragmentShader));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -11,8 +11,6 @@ public class ActorShaderMask {
|
||||
String meshName;
|
||||
//the vertex shader
|
||||
String vertexShaderPath;
|
||||
//the geometry shader
|
||||
String geometryShaderPath;
|
||||
//the fragment shader
|
||||
String fragmentShaderPath;
|
||||
|
||||
@ -21,14 +19,12 @@ public class ActorShaderMask {
|
||||
* @param modelName
|
||||
* @param meshName
|
||||
* @param vertexShaderPath
|
||||
* @param geometryShaderPath
|
||||
* @param fragmentShaderPath
|
||||
*/
|
||||
public ActorShaderMask(String modelName, String meshName, String vertexShaderPath, String geometryShaderPath, String fragmentShaderPath){
|
||||
public ActorShaderMask(String modelName, String meshName, String vertexShaderPath, String fragmentShaderPath){
|
||||
this.modelName = modelName;
|
||||
this.meshName = meshName;
|
||||
this.vertexShaderPath = vertexShaderPath;
|
||||
this.geometryShaderPath = geometryShaderPath;
|
||||
this.fragmentShaderPath = fragmentShaderPath;
|
||||
}
|
||||
|
||||
@ -56,14 +52,6 @@ public class ActorShaderMask {
|
||||
return vertexShaderPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the geometry shader path
|
||||
* @return the geometry shader path
|
||||
*/
|
||||
public String getGeometryShaderPath(){
|
||||
return geometryShaderPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the fragment shader path
|
||||
* @return the fragment shader path
|
||||
|
||||
@ -84,7 +84,7 @@ public class InstanceManager {
|
||||
data.fillBuffers();
|
||||
|
||||
//fetch model/shader and draw if both available
|
||||
ShaderProgram shader = Globals.assetManager.fetchShader(data.getVertexShader(), null, data.getFragmentShader());
|
||||
ShaderProgram shader = Globals.assetManager.fetchShader(data.getVertexShader(), data.getFragmentShader());
|
||||
Model model = Globals.assetManager.fetchModel(modelPath);
|
||||
if(model != null && shader != null){
|
||||
openGLState.setActiveShader(renderPipelineState, shader);
|
||||
|
||||
@ -62,7 +62,7 @@ public class TextureInstancedActor {
|
||||
*/
|
||||
public void draw(RenderPipelineState renderPipelineState, OpenGLState openGLState){
|
||||
Model model = Globals.assetManager.fetchModel(modelPath);
|
||||
ShaderProgram shader = Globals.assetManager.fetchShader(vertexShaderPath, null, fragmentShaderPath);
|
||||
ShaderProgram shader = Globals.assetManager.fetchShader(vertexShaderPath, fragmentShaderPath);
|
||||
if(model != null && shader != null){
|
||||
//setup render pipeline
|
||||
boolean instancedState = renderPipelineState.getInstanced();
|
||||
|
||||
@ -65,7 +65,7 @@ public class DebugRendering {
|
||||
planeModel = Globals.assetManager.fetchModel(Globals.imagePlaneModelID);
|
||||
}
|
||||
if(elementDrawDebugProgram == null){
|
||||
elementDrawDebugProgram = Globals.assetManager.fetchShader("Shaders/ui/debug/windowContentBorder/windowContentBound.vs", null, "Shaders/ui/debug/windowContentBorder/windowContentBound.fs");
|
||||
elementDrawDebugProgram = Globals.assetManager.fetchShader("Shaders/ui/debug/windowContentBorder/windowContentBound.vs", "Shaders/ui/debug/windowContentBorder/windowContentBound.fs");
|
||||
}
|
||||
if(elementDrawDebugProgram != null && planeModel != null){
|
||||
parentFramebuffer.bind(Globals.renderingEngine.getOpenGLState());
|
||||
@ -89,7 +89,7 @@ public class DebugRendering {
|
||||
planeModel = Globals.assetManager.fetchModel(Globals.imagePlaneModelID);
|
||||
}
|
||||
if(windowDrawDebugProgram == null){
|
||||
windowDrawDebugProgram = Globals.assetManager.fetchShader("Shaders/ui/debug/windowBorder/windowBound.vs", null, "Shaders/ui/debug/windowBorder/windowBound.fs");
|
||||
windowDrawDebugProgram = Globals.assetManager.fetchShader("Shaders/ui/debug/windowBorder/windowBound.vs", "Shaders/ui/debug/windowBorder/windowBound.fs");
|
||||
}
|
||||
if(windowDrawDebugProgram != null && planeModel != null){
|
||||
parentFramebuffer.bind(Globals.renderingEngine.getOpenGLState());
|
||||
|
||||
@ -259,7 +259,7 @@ public class Model {
|
||||
if(shaderMask.containsKey(mesh.getMeshName())){
|
||||
ActorShaderMask specificMask = shaderMask.get(mesh.getMeshName());
|
||||
ShaderProgram overwriteShader = null;
|
||||
if((overwriteShader = Globals.assetManager.fetchShader(specificMask.getVertexShaderPath(), specificMask.getGeometryShaderPath(), specificMask.getFragmentShaderPath())) != null){
|
||||
if((overwriteShader = Globals.assetManager.fetchShader(specificMask.getVertexShaderPath(), specificMask.getFragmentShaderPath())) != null){
|
||||
rVal = overwriteShader;
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ public class OutlineNormalsPipeline implements RenderPipeline {
|
||||
//
|
||||
|
||||
RenderingEngine.normalsOutlineFrambuffer.bind(openGLState);
|
||||
ShaderProgram program = Globals.assetManager.fetchShader("Shaders/core/anime/outlineNormals.vs", null, "Shaders/core/anime/outlineNormals.fs");
|
||||
ShaderProgram program = Globals.assetManager.fetchShader("Shaders/core/anime/outlineNormals.vs", "Shaders/core/anime/outlineNormals.fs");
|
||||
if(program != null){
|
||||
openGLState.setActiveShader(renderPipelineState, program);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user