re-enable move behavior tree networking

This commit is contained in:
austin 2021-11-05 19:21:08 -04:00
parent cd6f2cc6b4
commit cc2cd1e1c9
3 changed files with 51 additions and 51 deletions

View File

@ -141,9 +141,6 @@ public class LoadingThread extends Thread {
initServerThread(); initServerThread();
} }
//collision engine
initCollisionEngine(Globals.RUN_SERVER);
//initialize the "virtual" objects simulation //initialize the "virtual" objects simulation
if(Globals.RUN_SERVER){ if(Globals.RUN_SERVER){
initMacroSimulation(); initMacroSimulation();
@ -160,7 +157,10 @@ public class LoadingThread extends Thread {
//init client terrain manager //init client terrain manager
initClientTerrainManager(); initClientTerrainManager();
//collision engine
initCommonWorldData(Globals.RUN_SERVER);
//initialize the cell manager (client) //initialize the cell manager (client)
initDrawCellManager(); initDrawCellManager();
@ -226,7 +226,7 @@ public class LoadingThread extends Thread {
} }
//collision engine //collision engine
initCollisionEngine(Globals.RUN_SERVER); initCommonWorldData(Globals.RUN_SERVER);
//initialize the "virtual" objects simulation //initialize the "virtual" objects simulation
//not really relevant in arena mode //not really relevant in arena mode
@ -371,7 +371,7 @@ public class LoadingThread extends Thread {
Globals.serverWorldData = ServerWorldData.createGameWorld(Globals.serverTerrainManager); Globals.serverWorldData = ServerWorldData.createGameWorld(Globals.serverTerrainManager);
} }
static void initCollisionEngine(boolean FLAG_INIT_SERVER){ static void initCommonWorldData(boolean FLAG_INIT_SERVER){
if(FLAG_INIT_SERVER){ if(FLAG_INIT_SERVER){
Globals.commonWorldData = new CommonWorldData(Globals.serverWorldData, Globals.serverTerrainManager); Globals.commonWorldData = new CommonWorldData(Globals.serverWorldData, Globals.serverTerrainManager);
} else { } else {

View File

@ -96,17 +96,17 @@ public class GroundMovementTree {
switch(message.getMessageSubtype()){ switch(message.getMessageSubtype()){
case MOVE: case MOVE:
position.set(message.getpositionX(), message.getpositionY(), message.getpositionZ()); position.set(message.getpositionX(), message.getpositionY(), message.getpositionZ());
// if(Globals.RUN_SERVER){ if(Globals.RUN_SERVER){
// Globals.server.broadcastMessage( Globals.server.broadcastMessage(
// EntityMessage.constructMoveMessage( EntityMessage.constructMoveMessage(
// parent.getId(), parent.getId(),
// System.currentTimeMillis(), System.currentTimeMillis(),
// message.getpositionX(), message.getpositionX(),
// message.getpositionY(), message.getpositionY(),
// message.getpositionZ() message.getpositionZ()
// ) )
// ); );
// } }
break; break;
case SETFACING: case SETFACING:
break; break;
@ -193,37 +193,37 @@ public class GroundMovementTree {
// 0 // 0
// ) // )
// ); // );
// Globals.dataCellManager.sendNetworkMessageToChunk( Globals.dataCellManager.sendNetworkMessageToChunk(
// EntityMessage.constructmoveUpdateMessage( EntityMessage.constructmoveUpdateMessage(
// parent.getId(), parent.getId(),
// System.currentTimeMillis(), System.currentTimeMillis(),
// (float)newPosition.x, (float)position.x,
// (float)newPosition.y, (float)position.y,
// (float)newPosition.z, (float)position.z,
// movementVector.x, movementVector.x,
// movementVector.y, movementVector.y,
// movementVector.z, movementVector.z,
// velocity, velocity,
// 0 0
// ), ),
// Globals.serverWorldData.convertRealToChunkSpace(newPosition.x), Globals.serverWorldData.convertRealToChunkSpace(position.x),
// Globals.serverWorldData.convertRealToChunkSpace(newPosition.z) Globals.serverWorldData.convertRealToChunkSpace(position.z)
// ); );
} else if(Globals.RUN_CLIENT && parent.getId() == Globals.clientCharacterID){ } else if(Globals.RUN_CLIENT && parent.getId() == Globals.clientCharacterID){
// Globals.clientConnection.queueOutgoingMessage( Globals.clientConnection.queueOutgoingMessage(
// EntityMessage.constructmoveUpdateMessage( EntityMessage.constructmoveUpdateMessage(
// parent.getId(), parent.getId(),
// System.currentTimeMillis(), System.currentTimeMillis(),
// (float)newPosition.x, (float)position.x,
// (float)newPosition.y, (float)position.y,
// (float)newPosition.z, (float)position.z,
// movementVector.x, movementVector.x,
// movementVector.y, movementVector.y,
// movementVector.z, movementVector.z,
// velocity, velocity,
// 0 0
// ) )
// ); );
} }
break; break;
case MOVE: case MOVE:

View File

@ -6,12 +6,12 @@ import java.util.concurrent.Semaphore;
public class ByteStreamUtils { public class ByteStreamUtils {
static ByteBuffer integerCompactor; static ByteBuffer integerCompactor = ByteBuffer.allocate(8);
static Semaphore bufferLock = new Semaphore(1); static Semaphore bufferLock = new Semaphore(1);
static { // static {
integerCompactor = ByteBuffer.allocate(8); // integerCompactor = ByteBuffer.allocate(8);
} // }
public static int popIntFromByteQueue(List<Byte> queue){ public static int popIntFromByteQueue(List<Byte> queue){
int rVal = -1; int rVal = -1;