Zay-ES-Net

ok, Thank you verry much :slight_smile:

I still dindt got the point where the problem is :stuck_out_tongue:
I made a easy example (server client, 1 filter and 1 component) to try it out again, it sitll dosent works. If you have a little free time could you have a look on it? If you want to, i packed it and uploadet it here .

thx

I donā€™t know if I will get to look at your project. If you find the time to post the major portions of code right to the forum in code tags then I can see if there is anything obvious that might cause the issue.

I will try to confirm that Monkey Trap is still working properly, though, since I already have that project loaded and ready.

@linardschwendener10 Did you ever get a resolution for this? Iā€™ve just started using the Zay-ES and have the same problem, the client seems to only return true for entitySet.applyChanges() when entities components are added on the server. I can not get this method to return true when components are removed/changed

@Paul_Culkin Sadly not :frowning: sorry. Pleas tell me if you find out what the problem was.

I can assure you that in normal usage this does workā€¦ Iā€™m writing a game that relies on it right now and I see it work all the time.

So I think you will have to show us some code. The simpler the test case the better.

Ok. It works for me now that Iā€™ve built more functionality into the game and more messages are being sent.

The problem seems to be some kind of buffer threshold before updates are sent. Iā€™ve written a simple test cases to demonstrate this.

  1. After starting the server and client, the client receives the initial message component which was set on the server, and displays the message on the console

  2. Press space bar on the server window to update the the message component in the ES

Expected behaviour is that the client receives the changed component and displays the new message on the console.
Actual behaviour is that the component is only synchronised after 21 changes to the component (Space bar presses)

@pspeed you may well be aware of this (intended?) behaviour so may not be a bug, but is there any way to lower or remove this threshold?

Cheers

EDIT:

@pspeed Sorry, looks like this is intended. Iā€™ve just seen the method to set this batch size and works perfectly now :smile:

@linardschwendener10 if you set entityHost.setMaxChangeBatchSize(0); does this solve the problem for you too?

public class TestServerES extends SimpleApplication implements ActionListener{

private final EntityData entityData;
private final EntityDataHostService entityHost;

public TestServerES() throws IOException {
    EntitySerializers.initialize();
    Serializer.registerClass(TestComponentES.class);
    
    final Server server = Network.createServer(5555);
    server.addChannel(5556);
    server.start();
    
    this.entityData = new DefaultEntityData();
    entityHost = new EntityDataHostService(server, 0, entityData);
    
    start();
}

private int count = 0;

@Override
public void simpleInitApp() {
    createEntity = entityData.createEntity();
    entityData.setComponent(createEntity, new TestComponentES("Hello there"));
    inputManager.addMapping("SEND MESSAGE", new KeyTrigger(KeyInput.KEY_SPACE));
    inputManager.addListener(this, new String[]{"SEND MESSAGE"});
}
private EntityId createEntity;

@Override
public void update() {
    super.update();
    entityHost.sendUpdates();
}

public static void main(String[] args) throws IOException{
    new TestServerES();
}

@Override
public void onAction(String name, boolean isPressed, float tpf) {
    if (!isPressed) {
        if (name.equals("SEND MESSAGE")) {
            entityData.setComponent(createEntity, new TestComponentES("Hello there " + count));
            count++;
        }
    }
}

}

public class TestClientES extends SimpleApplication{

private final EntityData entityData;
private EntitySet entities;

public TestClientES() throws IOException {
    EntitySerializers.initialize();
    Serializer.registerClass(TestComponentES.class);
    
    final Client client = Network.connectToServer("localhost", 5555);
    client.start();
    
    this.entityData = new RemoteEntityData(client, 0);
    
    start(JmeContext.Type.Headless);
}


@Override
public void simpleInitApp() {
    entities = entityData.getEntities(TestComponentES.class);
}

@Override
public void update() {
    super.update();
    if(entities.applyChanges()){
        entities.forEach((t) -> {
            System.out.println(t.get(TestComponentES.class).getMessage());
        });
    }
}


public static void main(String[] args) throws IOException{
    new TestClientES();
}

}

@Serializable
public class TestComponentES implements EntityComponent {

private String message;

public TestComponentES() {
}

public TestComponentES(String message) {
    this.message = message;
}

public String getMessage() {
    return message;
}

}

Noā€¦ pretty sure itā€™s not supposed to work this way. The batch size is to control the max updates sent in one message but all pending updates should be sent when sentUpdates() is called. Iā€™ve looked at the code and it always flushes the last pending changesā€¦

Ok, so I looked at the revisions to see when this change was made and it looks like the fix for sending changes was done the same day as the releaseā€¦ but right after the release.

The change was made in r1213:
https://code.google.com/p/jmonkeyplatform-contributions/source/diff?spec=svn1213&r=1213&format=side&path=/trunk/zay-es/extensions/Zay-ES-Net/src/com/simsilica/es/server/HostedEntityData.java&old_path=/trunk/zay-es/extensions/Zay-ES-Net/src/com/simsilica/es/server/HostedEntityData.java&old=1207

But the release jar was r1208:
https://code.google.com/p/jmonkeyplatform-contributions/source/browse/trunk/zay-es/release

So it seems like I could fix your issue by pushing a new release. If you get impatient (I may not get to it until this weekend) then you can also try to build from source.

No worries, at least we know what the problem is now. Thanks for your time.

EDIT:

The entity system is awesome btw. I wonā€™t forget to credit you if this game ever goes anywhere :smile:

Thanks. I will try to mention in this thread if/when I push a new version. If too much time goes by then try to remind me. Life distracts often.

I have run into the same problem now and would be really glad to have a new release of Zay-ES.
Do two months qualify as enough passed time to remind you of a new release? :smile:

As far as i Know there are many new releases since then?

https://code.google.com/p/jmonkeyplatform-contributions/source/browse/trunk/zay-es/release?r=1581

r1581??

I dont know if it is fixed though

Unfortunately thatā€™s only the txt files. The jars are still from October '13.

But I checked out the latest code now and built it myself. Works like a charm. :+1:

Glad it worked.

At the end of June, my wife fell and sprained some ligaments in her foot. Since she already has trouble walking because of brain tumors this pretty much puts her in a wheel chair whenever we go anywhere and it also adds a whole new bunch of doctors to our normal weekly mix.

ā€¦suffice it to say, my free time as been at an all time low lately.

Just a follow-up as I happened to notice this thread when looking for something else and remembered I promised to try to post when I made a release.

Zay-ES and Zay-ES-Net got a new release sometime back after I moved the project to github: