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

View File

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

View File

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