Giter Club home page Giter Club logo

zay-es's Introduction

zay-es

Zay-ES (pronounced like Doctor Zaius from Planet of the Apes) is a high-performance Java-based Entity-Component-System that manages to side-step most/all of the typical disadvantages of an ES architecture without sacrificing ES "purity".

Zay-ES-Net is the add-on extension that provies client/server networking.

See also:

zay-es's People

Contributors

ali-rs avatar assofohdz avatar aymandf avatar domenicdev avatar mitm001 avatar pesegato avatar pspeed42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zay-es's Issues

Issue with entity removal

When I remove an entity from EntityData using removeEntity() method, it publishes an EntityChange event for ALL the component types even if that entity does not have the component at all. It is because the removeComponent() method does not check the result from handler to see if the remove operation is valid or not before it publishes the event in this line:

boolean result = handler.removeComponent(entityId);
// Can now update the entity sets that care
entityChange(new EntityChange(entityId, type));

Supporting primitive array field type for sql components

Hi
Array type is supported in standard sql as well in hsqldb. See http://hsqldb.org/web/howToArrays.html.
In the above link it describes an example of using array is to store Polygons which is exactly my usecase.

I am using a dynamic polygonal path finding library, there we need to create obstacles out of polygons or polylines and add the to navigation space.
I need to save polygon vertices for obstacle in a float [] field in Obstacle component.
Please take a look at the readme for this project https://github.com/implicit-invocation/jwalkable.

Regards

zay-es-net: NPE when receiving EntityData, but there is no active set anymore.

I had NPE while using zay-es-net. It appears that the client is receiving an EntityDataMessage, but there is no corresponding activeSet for the received ID anymore. This could be the case if the client calls EntitySet.release(), but then receives some new data for this set.

I use a custom network connection via Steam P2P. Maybe this forces the NPE if a message takes more time than usual to get to the client.

Stack trace:

2020-04-07 22:56:46,964 [ERROR] [com.jme3.network.kernel.p2p.SteamP2PConnector@616fd629] NetworkClient - handleError: 
java.lang.RuntimeException: Error executing:public void com.simsilica.es.client.RemoteEntityData$EntityMessageHandler.entityData(com.simsilica.es.net.EntityDataMessage)
    at com.simsilica.es.net.AbstractMessageDelegator.messageReceived(AbstractMessageDelegator.java:238) ~[zay-es-net-1.4.2.jar:?]
    at com.simsilica.es.net.AbstractMessageDelegator.messageReceived(AbstractMessageDelegator.java:59) ~[zay-es-net-1.4.2.jar:?]
    at com.jme3.network.base.MessageListenerRegistry.messageReceived(MessageListenerRegistry.java:81) ~[jme3-networking.jar:?]
    at com.jme3.network.base.P2PClient.dispatch(P2PClient.java:565) [classes/:?]
    at com.jme3.network.base.P2PClient$Redispatch.messageReceived(P2PClient.java:574) [classes/:?]
    at com.jme3.network.base.ConnectorAdapter.dispatch(ConnectorAdapter.java:132) [jme3-networking.jar:?]
    at com.jme3.network.base.ConnectorAdapter.run(ConnectorAdapter.java:174) [jme3-networking.jar:?]
Caused by: java.lang.NullPointerException
    at com.simsilica.es.client.RemoteEntityData$EntityMessageHandler.entityData(RemoteEntityData.java:694) ~[zay-es-net-1.4.2.jar:?]
    at jdk.internal.reflect.GeneratedMethodAccessor37.invoke(Unknown Source) ~[?:?]
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
    at com.simsilica.es.net.AbstractMessageDelegator.messageReceived(AbstractMessageDelegator.java:233) ~[zay-es-net-1.4.2.jar:?]
    ... 6 more

IllegalAccessException when using “protected” no-arg constructor for PersistentComponent

Hi

Using a “protected” no-arg constructor for my PersistentComponents I get an IllegalAccessException when requesting the component from EntityData.

It would be nice to add support for “protected” no-arg constructors in the Zay-ES persistence module.

Exception stack trace:

17:18:01,690 ERROR [KernelAdapter] Unhandled error, endpoint:NioEndpoint[1, java.nio.channels.SocketChannel[connected local=/127.0.0.1:4273 remote=/127.0.0.1:42606]], context:GetEntitySetMessage[2, null, [class com.dalwiestudio.rpg.core.es.ViewType, class com.dalwiestudio.rpg.core.es.ModelInfo, class com.dalwiestudio.rpg.physics.es.BodyPosition]]
java.lang.RuntimeException: Error executing:public void com.simsilica.es.server.HostedEntityData.getEntitySet(com.jme3.network.HostedConnection,com.simsilica.es.net.GetEntitySetMessage)
	at com.simsilica.es.net.AbstractMessageDelegator.messageReceived(AbstractMessageDelegator.java:238) ~[zay-es-net-1.4.3.jar:?]
	at com.simsilica.es.net.AbstractMessageDelegator.messageReceived(AbstractMessageDelegator.java:59) ~[zay-es-net-1.4.3.jar:?]
	at com.jme3.network.base.MessageListenerRegistry.messageReceived(MessageListenerRegistry.java:81) ~[jme3-networking-3.4.0-beta4.jar:3.4.0-beta4]
	at com.jme3.network.base.DefaultServer.dispatch(DefaultServer.java:343) ~[jme3-networking-3.4.0-beta4.jar:3.4.0-beta4]
	at com.jme3.network.base.DefaultServer$Redispatch.messageReceived(DefaultServer.java:676) ~[jme3-networking-3.4.0-beta4.jar:3.4.0-beta4]
	at com.jme3.network.base.DefaultServer$Redispatch.messageReceived(DefaultServer.java:671) ~[jme3-networking-3.4.0-beta4.jar:3.4.0-beta4]
	at com.jme3.network.base.KernelAdapter.dispatch(KernelAdapter.java:190) [jme3-networking-3.4.0-beta4.jar:3.4.0-beta4]
	at com.jme3.network.base.KernelAdapter.createAndDispatch(KernelAdapter.java:243) [jme3-networking-3.4.0-beta4.jar:3.4.0-beta4]
	at com.jme3.network.base.KernelAdapter.run(KernelAdapter.java:287) [jme3-networking-3.4.0-beta4.jar:3.4.0-beta4]
Caused by: java.lang.RuntimeException: Error in table mapping
	at com.simsilica.es.sql.ComponentTable.getComponent(ComponentTable.java:325) ~[zay-es-1.3.2.jar:?]
	at com.simsilica.es.sql.SqlComponentHandler.getComponent(SqlComponentHandler.java:94) ~[zay-es-1.3.2.jar:?]
	at com.simsilica.es.base.DefaultEntityData.getComponent(DefaultEntityData.java:163) ~[zay-es-1.3.2.jar:?]
	at com.simsilica.es.server.EntityDataWrapper.getComponent(EntityDataWrapper.java:139) ~[zay-es-net-1.4.3.jar:?]
	at com.simsilica.es.base.DefaultEntitySet.loadEntities(DefaultEntitySet.java:148) ~[zay-es-1.3.2.jar:?]
	at com.simsilica.es.server.EntityDataWrapper$LocalEntitySet.loadEntities(EntityDataWrapper.java:354) ~[zay-es-net-1.4.3.jar:?]
	at com.simsilica.es.server.EntityDataWrapper.getEntities(EntityDataWrapper.java:255) ~[zay-es-net-1.4.3.jar:?]
	at com.simsilica.es.server.HostedEntityData.getEntitySet(HostedEntityData.java:272) ~[zay-es-net-1.4.3.jar:?]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[?:?]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.base/java.lang.reflect.Method.invoke(Method.java:567) ~[?:?]
	at com.simsilica.es.net.AbstractMessageDelegator.messageReceived(AbstractMessageDelegator.java:231) ~[zay-es-net-1.4.3.jar:?]
	... 8 more
Caused by: java.lang.IllegalAccessException: class com.simsilica.es.sql.ComponentTable cannot access a member of class com.dalwiestudio.rpg.core.es.ViewType with modifiers "protected"
	at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:385) ~[?:?]
	at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:687) ~[?:?]
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:489) ~[?:?]
	at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128) ~[?:?]
	at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:350) ~[?:?]
	at java.base/java.lang.Class.newInstance(Class.java:642) ~[?:?]
	at com.simsilica.es.sql.ComponentTable.getComponent(ComponentTable.java:314) ~[zay-es-1.3.2.jar:?]
	at com.simsilica.es.sql.SqlComponentHandler.getComponent(SqlComponentHandler.java:94) ~[zay-es-1.3.2.jar:?]
	at com.simsilica.es.base.DefaultEntityData.getComponent(DefaultEntityData.java:163) ~[zay-es-1.3.2.jar:?]
	at com.simsilica.es.server.EntityDataWrapper.getComponent(EntityDataWrapper.java:139) ~[zay-es-net-1.4.3.jar:?]
	at com.simsilica.es.base.DefaultEntitySet.loadEntities(DefaultEntitySet.java:148) ~[zay-es-1.3.2.jar:?]
	at com.simsilica.es.server.EntityDataWrapper$LocalEntitySet.loadEntities(EntityDataWrapper.java:354) ~[zay-es-net-1.4.3.jar:?]
	at com.simsilica.es.server.EntityDataWrapper.getEntities(EntityDataWrapper.java:255) ~[zay-es-net-1.4.3.jar:?]
	at com.simsilica.es.server.HostedEntityData.getEntitySet(HostedEntityData.java:272) ~[zay-es-net-1.4.3.jar:?]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[?:?]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.base/java.lang.reflect.Method.invoke(Method.java:567) ~[?:?]
	at com.simsilica.es.net.AbstractMessageDelegator.messageReceived(AbstractMessageDelegator.java:231) ~[zay-es-net-1.4.3.jar:?]
	... 8 more

Regards

get a NullPointerException

Hi
I want to make a patch for this issue https://hub.jmonkeyengine.org/t/understanding-stringindex-interface-in-package-com-simsilica-es/37143/5?u=ali_rs
If getStringId("some string", false) can not find id for "some string" it will return null Integer result.
Now, the result has to be unboxed again to int, because the return type of the method is int. If you unbox an Integer that is null, you get a NullPointerException.

There is two way to fix it:
1- Change return type to Integer instead of int
2- or return -1 if result is null
Which one do you prefer ?

Suggestion of adding ed.removeComponents()

It would be nice to add EntityData.removeComponents(EntityId entityId, Class<T>... types) for ease of removing multiple components at once.

Currently, I am doing something like

Stream.of(ComponentA.class, ComponentB.class, ComponentC.class)
                        .forEach(component -> ed.removeComponent(eId, component));

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.