use of org.apollo.game.sync.task.NpcSynchronizationTask in project apollo by apollo-rsps.
the class SequentialClientSynchronizer method synchronize.
@Override
public void synchronize(MobRepository<Player> players, MobRepository<Npc> npcs) {
Map<RegionCoordinates, Set<RegionUpdateMessage>> encodes = new HashMap<>(), updates = new HashMap<>();
for (Player player : players) {
SynchronizationTask task = new PrePlayerSynchronizationTask(player, encodes, updates);
task.run();
}
for (Npc npc : npcs) {
SynchronizationTask task = new PreNpcSynchronizationTask(npc);
task.run();
}
for (Player player : players) {
SynchronizationTask task = new PlayerSynchronizationTask(player);
task.run();
task = new NpcSynchronizationTask(player);
task.run();
}
for (Player player : players) {
SynchronizationTask task = new PostPlayerSynchronizationTask(player);
task.run();
}
for (Npc npc : npcs) {
SynchronizationTask task = new PostNpcSynchronizationTask(npc);
task.run();
}
}
use of org.apollo.game.sync.task.NpcSynchronizationTask in project apollo by apollo-rsps.
the class ParallelClientSynchronizer method synchronize.
@Override
public void synchronize(MobRepository<Player> players, MobRepository<Npc> npcs) {
int playerCount = players.size();
int npcCount = npcs.size();
Map<RegionCoordinates, Set<RegionUpdateMessage>> encodes = new ConcurrentHashMap<>();
Map<RegionCoordinates, Set<RegionUpdateMessage>> updates = new ConcurrentHashMap<>();
phaser.bulkRegister(playerCount);
for (Player player : players) {
SynchronizationTask task = new PrePlayerSynchronizationTask(player, encodes, updates);
executor.submit(new PhasedSynchronizationTask(phaser, task));
}
phaser.arriveAndAwaitAdvance();
phaser.bulkRegister(npcCount);
for (Npc npc : npcs) {
SynchronizationTask task = new PreNpcSynchronizationTask(npc);
executor.submit(new PhasedSynchronizationTask(phaser, task));
}
phaser.arriveAndAwaitAdvance();
phaser.bulkRegister(playerCount);
for (Player player : players) {
SynchronizationTask task = new PlayerSynchronizationTask(player);
executor.submit(new PhasedSynchronizationTask(phaser, task));
}
phaser.arriveAndAwaitAdvance();
phaser.bulkRegister(playerCount);
for (Player player : players) {
SynchronizationTask task = new NpcSynchronizationTask(player);
executor.submit(new PhasedSynchronizationTask(phaser, task));
}
phaser.arriveAndAwaitAdvance();
phaser.bulkRegister(playerCount);
for (Player player : players) {
SynchronizationTask task = new PostPlayerSynchronizationTask(player);
executor.submit(new PhasedSynchronizationTask(phaser, task));
}
phaser.arriveAndAwaitAdvance();
phaser.bulkRegister(npcCount);
for (Npc npc : npcs) {
SynchronizationTask task = new PostNpcSynchronizationTask(npc);
executor.submit(new PhasedSynchronizationTask(phaser, task));
}
phaser.arriveAndAwaitAdvance();
}
Aggregations