2h katana
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2024-07-24 12:49:44 -04:00
parent 9c53027bf0
commit 570086c2cc
16 changed files with 337 additions and 121 deletions

View File

@ -367,6 +367,30 @@
"name" : "Jump"
}
},
{
"attackMoveId" : "Sword2HSlash1",
"type" : "MELEE_WEAPON_SWING_TWO_HAND",
"attackAnimationName" : "SwordR2HSlash",
"windupFrames" : 2,
"attackFrames" : 5,
"cooldownFrames" : 28,
"firesProjectile" : false,
"nextAttackMoveWindowStart" : 10,
"nextAttackMoveWindowEnd" : 18,
"driftGoal" : 0.03,
"driftFrameStart" : 1,
"driftFrameEnd" : 10,
"initialMove" : true,
"animationFirstPersonWindup" : {
"name" : "HoldItemR2H"
},
"animationFirstPersonHold" : {
"name" : "HoldItemR2H"
},
"animationFirstPersonAttack" : {
"name" : "SwordR2HSlash"
}
},
{
"attackMoveId" : "Bow2HFire",
"type" : "RANGED_WEAPON_BOW_TWO_HAND",

View File

@ -27,6 +27,59 @@
}
]
},
"equipData": {
"equipClass" : "weapon"
},
"tokens" : [
"GRAVITY",
"BLENDER_TRANSFORM",
"MELEE",
"TARGETABLE",
"OUTLINE"
],
"idleAnim" : "Sword|Idle",
"collidable": {
"type" : "CUBE",
"dimension1" : 0.03,
"dimension2" : 0.03,
"dimension3" : 0.2,
"rotX": 0,
"rotY": 0,
"rotZ": 0,
"rotW": 1,
"offsetX" : 0.0,
"offsetY" : 0.05,
"offsetZ" : 0.0
},
"iconPath" : "Textures/icons/itemIconWeapon.png"
},
{
"itemId" : "Katana2H",
"modelPath" : "Models/items/weapons/katana1alt.fbx",
"weaponData" : {
"weaponClass" : "sword2h",
"damage" : 10,
"hitboxes" : [
{
"type": "hit_connected",
"bone": "Blade1",
"radius": 0.04
},
{
"type": "hit_connected",
"bone": "Blade2",
"radius": 0.04
},
{
"type": "hit_connected",
"bone": "Blade3",
"radius": 0.04
}
]
},
"equipData": {
"equipClass" : "weapon"
},
"tokens" : [
"GRAVITY",
"BLENDER_TRANSFORM",
@ -34,7 +87,6 @@
"TARGETABLE",
"OUTLINE"
],
"equipClass" : "weapon",
"idleAnim" : "Sword|Idle",
"collidable": {
"type" : "CUBE",
@ -59,13 +111,15 @@
"damage" : 10,
"projectileModel" : "Models/arrow1.fbx"
},
"equipData": {
"equipClass" : "weapon"
},
"tokens" : [
"GRAVITY",
"RANGED",
"TARGETABLE",
"OUTLINE"
],
"equipClass" : "weapon",
"collidable": {
"type" : "CUBE",
"dimension1" : 0.1,
@ -85,25 +139,8 @@
{
"itemId" : "shorts1",
"modelPath": "Models/items/itemEntityShorts.fbx",
"tokens" : [
"GRAVITY",
"TARGETABLE"
],
"equipData": {
"equipClass" : "clothing",
"collidable": {
"type" : "CUBE",
"dimension1" : 0.1,
"dimension2" : 0.1,
"dimension3" : 0.35,
"rotX": 0,
"rotY": 0,
"rotZ": 0,
"rotW": 1,
"offsetX" : 0,
"offsetY" : 0.05,
"offsetZ" : 0
},
"iconPath" : "Textures/icons/itemIconItemGeneric.png",
"equipWhitelist" : [
{
"creatureId" : "human",
@ -117,10 +154,42 @@
}
]
},
"tokens" : [
"GRAVITY",
"TARGETABLE"
],
"collidable": {
"type" : "CUBE",
"dimension1" : 0.1,
"dimension2" : 0.1,
"dimension3" : 0.35,
"rotX": 0,
"rotY": 0,
"rotZ": 0,
"rotW": 1,
"offsetX" : 0,
"offsetY" : 0.05,
"offsetZ" : 0
},
"iconPath" : "Textures/icons/itemIconItemGeneric.png"
},
{
"itemId" : "hairshort1",
"modelPath": "Models/itemEntityShorts.fbx",
"equipData": {
"equipClass" : "trait",
"equipWhitelist" : [
{
"creatureId" : "human",
"model" : "Models/hairshort1.fbx",
"meshList" : [
"Hair"
],
"meshMaskList" : []
}
]
},
"tokens" : [
"GRAVITY",
"ARMOR",
@ -140,17 +209,7 @@
"offsetY" : 0.05,
"offsetZ" : 0
},
"iconPath" : "Textures/icons/itemIconItemGeneric.png",
"equipWhitelist" : [
{
"creatureId" : "human",
"model" : "Models/hairshort1.fbx",
"meshList" : [
"Hair"
],
"meshMaskList" : []
}
]
"iconPath" : "Textures/icons/itemIconItemGeneric.png"
},
{
@ -161,21 +220,8 @@
"ARMOR",
"TARGETABLE"
],
"equipData": {
"equipClass" : "clothing",
"collidable": {
"type" : "CUBE",
"dimension1" : 0.1,
"dimension2" : 0.1,
"dimension3" : 0.35,
"rotX": 0,
"rotY": 0,
"rotZ": 0,
"rotW": 1,
"offsetX" : 0,
"offsetY" : 0.05,
"offsetZ" : 0
},
"iconPath" : "Textures/icons/itemIconItemGeneric.png",
"equipWhitelist" : [
{
"creatureId" : "human",
@ -189,16 +235,6 @@
}
]
},
{
"itemId" : "shirt1",
"modelPath": "Models/itemEntityShorts.fbx",
"tokens" : [
"GRAVITY",
"ARMOR",
"TARGETABLE"
],
"equipClass" : "clothing",
"collidable": {
"type" : "CUBE",
"dimension1" : 0.1,
@ -212,7 +248,19 @@
"offsetY" : 0.05,
"offsetZ" : 0
},
"iconPath" : "Textures/icons/itemIconItemGeneric.png",
"iconPath" : "Textures/icons/itemIconItemGeneric.png"
},
{
"itemId" : "shirt1",
"modelPath": "Models/itemEntityShorts.fbx",
"tokens" : [
"GRAVITY",
"ARMOR",
"TARGETABLE"
],
"equipData": {
"equipClass" : "clothing",
"equipWhitelist" : [
{
"creatureId" : "human",
@ -226,6 +274,21 @@
]
}
]
},
"collidable": {
"type" : "CUBE",
"dimension1" : 0.1,
"dimension2" : 0.1,
"dimension3" : 0.35,
"rotX": 0,
"rotY": 0,
"rotZ": 0,
"rotW": 1,
"offsetX" : 0,
"offsetY" : 0.05,
"offsetZ" : 0
},
"iconPath" : "Textures/icons/itemIconItemGeneric.png"
}

View File

@ -443,6 +443,10 @@ Word element
Text Wrap handling
Overflow handling
(07/21/2024)
AI scaffolding
Attacker ai tree
# TODO

View File

@ -249,7 +249,7 @@ public class ControlHandler {
boolean shouldRecaptureScreen = false;
//controls whether the camera is first or third person
boolean cameraIsThirdPerson = true;
boolean cameraIsThirdPerson = false;
//The list of window strings that would block main game controls
static String[] controlBlockingWindows = new String[]{

View File

@ -164,10 +164,10 @@ public class Main {
//uncomment to test loading a model into engine
// if(1==1){
// Globals.assetManager.addModelPathToQueue("/Models/baseman9.glb");
// Globals.assetManager.addModelPathToQueue("/Models/creatures/viewmodel.glb");
// Globals.assetManager.loadAssetsInQueue();
// Model model = Globals.assetManager.fetchModel("/Models/baseman9.glb");
// // for(electrosphere.renderer.anim.Animation anim : model.animations){
// electrosphere.renderer.model.Model model = Globals.assetManager.fetchModel("/Models/creatures/viewmodel.glb");
// // for(electrosphere.renderer.anim.Animation anim : model.getAnimations()){
// // if(anim.name.equals("Armature|Idle1")){
// // System.out.println(anim.duration);
// // for(electrosphere.renderer.anim.AnimChannel channel : anim.channels){

View File

@ -202,6 +202,7 @@ public class EntityDataStrings {
public static final String ATTACK_MOVE_TYPE_ACTIVE = "attackMoveTypeActive";
public static final String ATTACK_MOVE_TYPE_MELEE_SWING_ONE_HAND = "MELEE_WEAPON_SWING_ONE_HAND";
public static final String ATTACK_MOVE_TYPE_MELEE_SWING_TWO_HAND = "MELEE_WEAPON_SWING_TWO_HAND";
public static final String ATTACK_MOVE_TYPE_BOW_TWO_HAND = "RANGED_WEAPON_BOW_TWO_HAND";
/**

View File

@ -266,22 +266,26 @@ public class ClientAttackTree implements BehaviorTree {
}
//activate hitboxes
List<Entity> attachedEntities = AttachUtils.getChildrenList(parent);
if(attachedEntities != null){
for(Entity currentAttached : attachedEntities){
if(HitboxCollectionState.hasHitboxState(currentAttached)){
HitboxCollectionState currentState = HitboxCollectionState.getHitboxState(currentAttached);
currentState.setActive(true);
}
}
}
} break;
case COOLDOWN: {
//deactive hitboxes
List<Entity> attachedEntities = AttachUtils.getChildrenList(parent);
if(attachedEntities != null){
for(Entity currentAttached : attachedEntities){
if(HitboxCollectionState.hasHitboxState(currentAttached)){
HitboxCollectionState currentState = HitboxCollectionState.getHitboxState(currentAttached);
currentState.setActive(false);
}
}
}
if(currentMove != null && frameCurrent > currentMove.getWindupFrames() + currentMove.getAttackFrames() + currentMove.getCooldownFrames()){
frameCurrent = 0;
if(parent.containsKey(EntityDataStrings.CLIENT_ROTATOR_TREE)){
@ -317,6 +321,9 @@ public class ClientAttackTree implements BehaviorTree {
case "sword1h":
rVal = EntityDataStrings.ATTACK_MOVE_TYPE_MELEE_SWING_ONE_HAND;
break;
case "sword2h":
rVal = EntityDataStrings.ATTACK_MOVE_TYPE_MELEE_SWING_TWO_HAND;
break;
case "bow2h":
rVal = EntityDataStrings.ATTACK_MOVE_TYPE_BOW_TWO_HAND;
break;

View File

@ -381,6 +381,9 @@ public class ServerAttackTree implements BehaviorTree {
case "sword1h":
rVal = EntityDataStrings.ATTACK_MOVE_TYPE_MELEE_SWING_ONE_HAND;
break;
case "sword2h":
rVal = EntityDataStrings.ATTACK_MOVE_TYPE_MELEE_SWING_TWO_HAND;
break;
case "bow2h":
rVal = EntityDataStrings.ATTACK_MOVE_TYPE_BOW_TWO_HAND;
break;

View File

@ -109,6 +109,14 @@ public class FirstPersonTree implements BehaviorTree {
this.currentAnimation = animationName;
}
/**
* Gets the animation currently playing
* @return The name of the animation
*/
public String getCurrentAnimation(){
return currentAnimation;
}
/**
* If the entity has a first person tree, plays the provided animation
* @param entity The entity

View File

@ -18,6 +18,7 @@ import electrosphere.entity.state.gravity.ClientGravityTree;
import electrosphere.entity.state.gravity.ServerGravityTree;
import electrosphere.entity.state.hitbox.HitboxCollectionState;
import electrosphere.game.data.collidable.CollidableTemplate;
import electrosphere.game.data.item.type.EquipData;
import electrosphere.game.data.item.type.EquipWhitelist;
import electrosphere.game.data.item.type.Item;
import electrosphere.game.data.item.type.WeaponData;
@ -79,9 +80,6 @@ public class ItemUtils {
break;
}
}
if(item.getEquipWhitelist() != null){
rVal.putData(EntityDataStrings.ITEM_EQUIP_WHITELIST, item.getEquipWhitelist());
}
if(item.getIdleAnim() != null){
rVal.putData(EntityDataStrings.ANIM_IDLE,item.getIdleAnim());
}
@ -90,8 +88,20 @@ public class ItemUtils {
} else {
rVal.putData(EntityDataStrings.ITEM_ICON,genericItemIconPath);
}
if(item.getEquipClass() != null){
rVal.putData(EntityDataStrings.ITEM_EQUIP_CLASS,item.getEquipClass());
//
//
// Equip data
//
//
if(item.getEquipData() != null){
EquipData equipData = item.getEquipData();
if(equipData.getEquipWhitelist() != null){
rVal.putData(EntityDataStrings.ITEM_EQUIP_WHITELIST, equipData.getEquipWhitelist());
}
if(equipData.getEquipClass() != null){
rVal.putData(EntityDataStrings.ITEM_EQUIP_CLASS,equipData.getEquipClass());
}
}
rVal.putData(EntityDataStrings.DRAW_CAST_SHADOW, true);
EntityUtils.setEntityType(rVal, ENTITY_TYPE_ITEM);
@ -152,9 +162,6 @@ public class ItemUtils {
break;
}
}
if(item.getEquipWhitelist() != null){
rVal.putData(EntityDataStrings.ITEM_EQUIP_WHITELIST, item.getEquipWhitelist());
}
if(item.getIdleAnim() != null){
rVal.putData(EntityDataStrings.ANIM_IDLE,item.getIdleAnim());
}
@ -163,8 +170,19 @@ public class ItemUtils {
} else {
rVal.putData(EntityDataStrings.ITEM_ICON,genericItemIconPath);
}
if(item.getEquipClass() != null){
rVal.putData(EntityDataStrings.ITEM_EQUIP_CLASS,item.getEquipClass());
//
//
// Equip data
//
//
if(item.getEquipData() != null){
EquipData equipData = item.getEquipData();
if(equipData.getEquipWhitelist() != null){
rVal.putData(EntityDataStrings.ITEM_EQUIP_WHITELIST, equipData.getEquipWhitelist());
}
if(equipData.getEquipClass() != null){
rVal.putData(EntityDataStrings.ITEM_EQUIP_CLASS,equipData.getEquipClass());
}
}
rVal.putData(EntityDataStrings.DRAW_CAST_SHADOW, true);
EntityUtils.setEntityType(rVal, ENTITY_TYPE_ITEM);

View File

@ -7,10 +7,20 @@ import java.util.Map;
import electrosphere.logger.LoggerInterface;
/**
* Resolves attack move ids to lists of chains of attacks
*/
public class AttackMoveResolver {
/**
* The map of attack move id -> attack move object chain
*/
Map<String,List<AttackMove>> attackMovesetMap = new HashMap<String,List<AttackMove>>();
/**
* Constructor
* @param movelist The raw list of attack moves
*/
public AttackMoveResolver(List<AttackMove> movelist){
//get all moves
for(AttackMove move : movelist){
@ -24,16 +34,27 @@ public class AttackMoveResolver {
}
}
//reorder
for(List<AttackMove> toOrder : attackMovesetMap.values()){
reorderMoveset(toOrder);
for(String attackTypeKey : attackMovesetMap.keySet()){
List<AttackMove> currentKeyList = attackMovesetMap.get(attackTypeKey);
reorderMoveset(attackTypeKey, currentKeyList);
}
}
/**
* Gets a chain of attack moves based on the attack type
* @param attackType The type of attack (IE "Sword2HSlash1")
* @return The chain of attack moves if it exists, null otherwise
*/
public List<AttackMove> getMoveset(String attackType){
return attackMovesetMap.get(attackType);
}
void reorderMoveset(List<AttackMove> finalMovelist){
/**
* Reorders the attack moveset list
* @param attackTypeKey The current attack type key (IE "Sword2HSlash1")
* @param finalMovelist The moveset list
*/
void reorderMoveset(String attackTypeKey, List<AttackMove> finalMovelist){
AttackMove currentMove = null;
//solve for initial move
for(AttackMove move : finalMovelist){
@ -67,7 +88,11 @@ public class AttackMoveResolver {
finalMovelist.add(move);
}
} else {
LoggerInterface.loggerEngine.WARNING("FAILED TO LOAD INITIAL MOVE IN AttackMoveResolver");
String message = "FAILED TO LOAD INITIAL MOVE IN AttackMoveResolver\n" +
"The attack move type is: " + attackTypeKey + "\n" +
"This is commonly caused by having your initial move in the attack chain in data not having the field \"initialMove\" set to true!"
;
LoggerInterface.loggerEngine.ERROR(new IllegalArgumentException(message));
}
}

View File

@ -0,0 +1,43 @@
package electrosphere.game.data.item.type;
import java.util.List;
/**
* Data about how this item is equipped (ie, where is it equipped, what slots does it take, who can equip it, etc)
*/
public class EquipData {
//the equip whitelist for this item (what creatures can equip this item?)
List<EquipWhitelist> equipWhitelist;
//the class of item
String equipClass;
//The list of slots that this item takes up when it is equipped
List<String> equipSlots;
/**
* the equip whitelist for this item (what creatures can equip this item?)
* @return
*/
public List<EquipWhitelist> getEquipWhitelist(){
return equipWhitelist;
}
/**
* the class of item
* @return
*/
public String getEquipClass(){
return equipClass;
}
/**
* Gets the list of equip slot ids that are taken up when equipping this item
* @return The list of equip slot ids
*/
public List<String> getEquipSlots(){
return equipSlots;
}
}

View File

@ -17,16 +17,14 @@ public class Item {
List<String> tokens;
//the collidable data for the item
CollidableTemplate collidable;
//the equip whitelist for this item (what creatures can equip this item?)
List<EquipWhitelist> equipWhitelist;
//the idle animation for the item
String idleAnim;
//the path for the icon texture for this item
String iconPath;
//the class of item
String equipClass;
//weapon data for this item if it is an item
WeaponData weaponData;
//The data defining how this item is equipped
EquipData equipData;
/**
* the id of the item
@ -59,14 +57,6 @@ public class Item {
return collidable;
}
/**
* the equip whitelist for this item (what creatures can equip this item?)
* @return
*/
public List<EquipWhitelist> getEquipWhitelist(){
return equipWhitelist;
}
/**
* the idle animation for the item
* @return
@ -83,14 +73,6 @@ public class Item {
return iconPath;
}
/**
* the class of item
* @return
*/
public String getEquipClass(){
return equipClass;
}
/**
* weapon data for this item if it is an item
* @return
@ -99,4 +81,12 @@ public class Item {
return weaponData;
}
/**
* Gets the equip data for the item type
* @return The equip data
*/
public EquipData getEquipData(){
return equipData;
}
}

View File

@ -168,7 +168,6 @@ public class EntityProtocol {
Globals.firstPersonEntity = EntityCreationUtils.createClientSpatialEntity();
EntityCreationUtils.makeEntityDrawable(Globals.firstPersonEntity, viewModelData.getFirstPersonModelPath());
FirstPersonTree.attachTree(Globals.firstPersonEntity, viewModelData.getHeightFromOrigin(), viewModelData.getCameraViewDirOffsetY(), viewModelData.getCameraViewDirOffsetZ());
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.firstPersonEntity,EntityTags.DRAWABLE);
}
}
}

View File

@ -70,10 +70,7 @@ public class MainContentPipeline implements RenderPipeline {
//
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE)){
Vector3d position = EntityUtils.getPosition(currentEntity);
if(
(boolean)currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW) &&
currentEntity.getData(EntityDataStrings.DRAW_SOLID_PASS) != null
){
if(shouldDrawSolidPass(currentEntity)){
//fetch actor
Actor currentActor = EntityUtils.getActor(currentEntity);
//calculate camera-modified vector3f
@ -91,10 +88,7 @@ public class MainContentPipeline implements RenderPipeline {
Globals.clientFoliageManager.draw();
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAW_INSTANCED)){
Vector3d position = EntityUtils.getPosition(currentEntity);
if(
currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW) != null &&
currentEntity.getData(EntityDataStrings.DRAW_SOLID_PASS) != null
){
if(shouldDrawSolidPass(currentEntity)){
//fetch actor
InstancedActor currentActor = InstancedActor.getInstancedActor(currentEntity);
//if the shader attribute for model matrix exists, calculate the model matrix and apply
@ -156,10 +150,7 @@ public class MainContentPipeline implements RenderPipeline {
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE)){
Vector3d position = EntityUtils.getPosition(currentEntity);
if(
(boolean)currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW) &&
currentEntity.getData(EntityDataStrings.DRAW_TRANSPARENT_PASS) != null
){
if(shouldDrawTransparentPass(currentEntity)){
//fetch actor
Actor currentActor = EntityUtils.getActor(currentEntity);
//calculate camera-modified vector3f
@ -176,10 +167,7 @@ public class MainContentPipeline implements RenderPipeline {
}
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAW_INSTANCED)){
Vector3d position = EntityUtils.getPosition(currentEntity);
if(
currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW) != null &&
currentEntity.getData(EntityDataStrings.DRAW_TRANSPARENT_PASS) != null
){
if(shouldDrawTransparentPass(currentEntity)){
//fetch actor
InstancedActor currentActor = InstancedActor.getInstancedActor(currentEntity);
//if the shader attribute for model matrix exists, calculate the model matrix and apply
@ -219,4 +207,47 @@ public class MainContentPipeline implements RenderPipeline {
Globals.profiler.endCpuSample();
}
/**
* Checks if the entity should be drawn
* @param entity The entity
* @return true if should draw, false otherwise
*/
static boolean shouldDrawSolidPass(Entity entity){
return
(
(boolean)entity.getData(EntityDataStrings.DATA_STRING_DRAW) &&
entity.getData(EntityDataStrings.DRAW_SOLID_PASS) != null
) &&
(
!entityBlacklist(entity)
)
;
}
/**
* Checks if the entity should be drawn
* @param entity The entity
* @return true if should draw, false otherwise
*/
static boolean shouldDrawTransparentPass(Entity entity){
return
(
(boolean)entity.getData(EntityDataStrings.DATA_STRING_DRAW) &&
entity.getData(EntityDataStrings.DRAW_TRANSPARENT_PASS) != null
) &&
(
!entityBlacklist(entity)
)
;
}
/**
* Checks whether the entity is on the blacklist for drawing in main pipeline or not
* @param entity The entity
* @return True if in blacklist, false otherwise
*/
static boolean entityBlacklist(Entity entity){
return entity == Globals.firstPersonEntity;
}
}

View File

@ -42,9 +42,9 @@ public class PlayerCharacterCreation {
realm.getServerWorldData().convertRealToChunkSpace(Globals.spawnPoint.z)
));
realm.getDataCellManager().addPlayerToRealm(playerObject);
//set controller id
//parse network messages on client if running
if(playerObject == Globals.clientPlayer){
Globals.playerEntity = newPlayerEntity;
Globals.clientConnection.parseMessages();
}
}