Skip to content

Commit 45bbcc6

Browse files
committed
Modified EtherealHost to register Vec3d as a serializable class now that
we require it in object state messages. Modified EtherealHost to pass the client zone extents on to NetworkStateListener. Modified NetworkStateListener to use the supplied client zone extents. Upgraded the dependencies to sim-math 1.1.1.
1 parent ba5b4af commit 45bbcc6

File tree

4 files changed

+38
-4
lines changed

4 files changed

+38
-4
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ buildscript {
1414
apply plugin: 'java'
1515
apply plugin: 'maven'
1616

17-
version='1.2.1'
17+
version='1.2.2-SNAPSHOT'
1818
group='com.simsilica'
1919

2020
ext.jmeVersion = "3.1.0-alpha4"
@@ -53,7 +53,7 @@ dependencies {
5353
compile "org.jmonkeyengine:jme3-networking:$jmeVersion"
5454

5555
// Uses SimMath for bit streaming utilities and transition buffers
56-
compile "com.simsilica:sim-math:1.0.2"
56+
compile "com.simsilica:sim-math:1.1.1"
5757

5858
// Base logging
5959
compile 'org.slf4j:slf4j-api:1.7.15'

release-notes.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
Version 1.2.2 (unreleased)
2+
--------------
3+
* Fixed a bug where the newer state messages would fail if the game hadn't
4+
already registered Vec3d as a serializable class.
5+
* Fixed NetworkStateListener to properly pay attention to zone extents.
6+
* Fixed EtherealHost to pass the specified client zone extents on to the
7+
NetworkStateListener.
8+
* Added additional trace logging to NetworkStateListener.
9+
* Upgraded to sim-math 1.1.1
10+
11+
112
Version 1.2.1
213
--------------
314
* Added EtherealHost.setStateCollectionInterval() to configure how often

src/main/java/com/simsilica/ethereal/EtherealHost.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
import com.jme3.network.HostedConnection;
4040
import com.jme3.network.serializing.Serializer;
41+
import com.jme3.network.serializing.serializers.FieldSerializer;
4142
import com.jme3.network.service.AbstractHostedConnectionService;
4243
import com.jme3.network.service.HostedServiceManager;
4344
import com.jme3.network.util.SessionDataDelegator;
@@ -88,7 +89,8 @@ public EtherealHost( ObjectStateProtocol objectProtocol, ZoneGrid grid, Vec3i cl
8889
this.grid = grid;
8990
this.clientZoneExtents = clientZoneExtents;
9091

91-
Serializer.registerClasses(ClientStateMessage.class, ObjectStateMessage.class);
92+
Serializer.registerClasses(ClientStateMessage.class, ObjectStateMessage.class);
93+
Serializer.registerClass(Vec3d.class, new FieldSerializer());
9294
}
9395

9496
public ZoneManager getZones() {
@@ -191,7 +193,7 @@ public void startHostingOnConnection( HostedConnection hc ) {
191193
return;
192194
}
193195

194-
nsl = new NetworkStateListener(this, hc, grid, 1);
196+
nsl = new NetworkStateListener(this, hc, grid, clientZoneExtents);
195197
hc.setAttribute(NetworkStateListener.ATTRIBUTE_KEY, nsl);
196198

197199
// Now add it to the state collector

src/main/java/com/simsilica/ethereal/NetworkStateListener.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
import com.jme3.network.HostedConnection;
4040
import com.simsilica.mathd.Quatd;
41+
import com.simsilica.mathd.Vec3i;
4142
import com.simsilica.mathd.Vec3d;
4243
import com.simsilica.ethereal.net.ClientStateMessage;
4344
import com.simsilica.ethereal.net.SentState;
@@ -108,6 +109,10 @@ public class NetworkStateListener implements StateListener {
108109
public NetworkStateListener( EtherealHost host, HostedConnection conn, ZoneGrid grid, int zoneRadius ) {
109110
this(host, conn, new LocalZoneIndex(grid, zoneRadius), new IdIndex(10));
110111
}
112+
113+
public NetworkStateListener( EtherealHost host, HostedConnection conn, ZoneGrid grid, Vec3i zoneExtents ) {
114+
this(host, conn, new LocalZoneIndex(grid, zoneExtents), new IdIndex(10));
115+
}
111116

112117
public NetworkStateListener( EtherealHost host, HostedConnection conn, LocalZoneIndex zoneIndex, IdIndex idIndex ) {
113118
this.host = host;
@@ -221,6 +226,10 @@ public void endFrameBlock() {
221226

222227
@Override
223228
public void beginFrame( long time ) {
229+
230+
if( log.isTraceEnabled() ) {
231+
log.trace(self + ":beginFrame(" + time + ") selfPosition:" + selfPosition);
232+
}
224233

225234
// If the zones changed last frame then clear the buffers
226235
if( zonesChanged ) {
@@ -233,6 +242,10 @@ public void beginFrame( long time ) {
233242
@Override
234243
public void endFrame( long time ) {
235244

245+
if( log.isTraceEnabled() ) {
246+
log.trace(self + ":endFrame(" + time + ") selfPosition:" + selfPosition);
247+
}
248+
236249
// See if we've gotten any ACKs to add to our ACK header
237250
ClientStateMessage ackedMsg;
238251
while( (ackedMsg = acked.poll()) != null ) {
@@ -317,6 +330,10 @@ public void endFrame( long time ) {
317330
@Override
318331
public void stateChanged( StateBlock b ) {
319332

333+
if( log.isTraceEnabled() ) {
334+
log.trace(self + ":stateChanged(" + b + ")");
335+
}
336+
320337
// StateBlocks are per zone but contain all of the object
321338
// objects for a particular time step in that zone.
322339

@@ -346,6 +363,10 @@ public void stateChanged( StateBlock b ) {
346363
}
347364
}
348365
}
366+
} else {
367+
if( log.isTraceEnabled() ) {
368+
log.trace(self + ":No updates");
369+
}
349370
}
350371
if( b.getRemovals() != null ) {
351372
for( Long e : b.getRemovals() )

0 commit comments

Comments
 (0)