A consumer of an Event aware on how to retrieve relevant data ... a business model barrier?

0

Actually we have only Event script with a small payload to be sent, that excludes for example containers like a map.

But a consumer of an Event should know/be aware on how to retrieve relevant data from other sources, like with big containers.

It seems that it misses a kind of component to do it (like a kind of database component) ?

And we don't have the possibilty to do it directly through globals for example.

I only see actually to make it with the need to communicate back to the event producer entity, so we’ll need to create new event producers in our consumer entity and new consumers in our firstly producer entity to handle this kind of database query.

This could lead to a significant increase in the number of events and complexity.

What could be the best and easyest way to do it ?

asked 4 years ago189 views
14 Answers
0

It's now reasonable to think that if there's no answer about several questions about global variables in this forum, it's because we're at the border with Amazon services, that is in occurence the AWS Data Exchange ... through the fundamental introduction to building games on AWS using Amazon Lumberyard (free course e-learning training), it describes well the architectural benefits of integrating Lumberyard with other AWS services and should perhaps be the first step to take before using Lumberyard. I'm sorry I didn't follow it from the beginning :roll_eyes:

answered 4 years ago
0

Hi @REDACTEDUSER

It depends what your goals are, DynamoDB is a good place for global data storage if you need the data cloud based, which is often the case in many games nowadays. A client side system for persistent storage of user settings can be found in the SaveData gem, this is useful for things such as Save Games.

If you need transient data storage that only lasts throughout the game or simulation session you can use Script Canvas with Script Events. You create an entity that works as the storage and has a Script Canvas graph that receives notifications of value updates through Script Events, you use these to update your variables or request their values.

Hopefully one of these methods is useful for your goals, for me the best situation would be a "Persistent Data" gem that provides all of these services in a convenient location, unfortunately we don't have something like that at the moment.

answered 4 years ago
0

Hi Luis @REDACTEDUSER

answered 4 years ago
0

@REDACTEDUSER It seems to me on the contrary that when you re-enter a script with calling through an Event, it has lost all the variables values that was set by a the previously assignement of it's local variables... all Variable are cleared when coming back into the script. 💥

If it's really the case, unless there is a way to make these Script Variables persistent, we can't do what you propose as all local variables are lost when you try to read them.

answered 4 years ago
0

Hi @REDACTEDUSER

I tried this locally just now and it appears to work correctly, I would have to know more how your scripts are being used, one thing you want to avoid is deactivating the entity that is holding your storage for example.

For my test I used two scripts on two separate entities, one I called VariableStorage and one VariableQuery.

VariableStorage: REMOVEDUPLOAD

VariableQuery:

REMOVEDUPLOAD

(Script Canvas) - STORED: 1.0000
(Script Canvas) - QUERY RETURNED: 1.0000
(Script Canvas) - STORED: 2.0000
(Script Canvas) - QUERY RETURNED: 2.0000
(Script Canvas) - STORED: 3.0000
(Script Canvas) - QUERY RETURNED: 3.0000

Edit: here's the Script Event setup I used:

REMOVEDUPLOAD

answered 4 years ago
0

I've seen @REDACTEDUSER

answered 4 years ago
0

@REDACTEDUSER

But in reality, when using global data, it's for relatively static data but bigger than a simple Variable number and we can't use even simple like Variable Arrays in the parameters inside the Node Event.

As you asked more on the script I'm doing, one thing effectively I want is "to avoid deactivating the entity that is holding my storage ".

In brief to tell you more about my scripts, I have a Parent-Children hierarchy of entities that call successively each other in cascade in order to require a treatment on a data at a below level.

The event-driven approach is always the same with a raise of a request Event from the top Entity; then Entities Services that are listening to that Event raise a Confirmed Event when they have done their job after calling their chidren entities ... thus a cascade of Events that works perfectly well.

As I wrote, when you come back with a new Event inside a script already activated during a precedent Event, it's local variables aren't persistent any more and those variables are numbers and Arrays of numbers (by the way, the "For Each" node could return the index value on Array ....)

As when @REDACTEDUSER

Thus the scope of Variables and persistency is at the center of this discussion and should be covered by an event-driven design explainations with a kind of cook book/best practices in LY scripts that's currently missing from the LY doc.

answered 4 years ago
0

@REDACTEDUSER

answered 4 years ago
0

Mr @REDACTEDUSER

answered 4 years ago
0

Mr @REDACTEDUSER Hundreds of artificial intelligence or 1,000 enemies artificial intelligence are attacking me. The grenade must examine/explode their distance and radius with the array of enemies positions(less 5 meter + foreach+Vector3D.Distance(Grenade.Position,arrary[index].Position)), if not we must think Sphere raycast or Cube raycast for GetListEnemies... I hope you understand what I mean, excuse me , I can not write english very well 😊

answered 4 years ago
0

For info, I'm already playing with vertex inside a mesh of an entity that serves as a big array of global/persitent data.

It already exists a VertexContainer, that is a container of vertices of variable length, with all of what we need like get, set, clear, remove, ...

Each vertex point of the mesh has a position that you can get/set through it's index and thus mesh can serve as a very big global Array.

The starting point is here for updating the global Array with an index: /** * Update a vertex at a particular index. * @REDACTEDUSER * @REDACTEDUSER * @REDACTEDUSER */ virtual bool UpdateVertex(size_t index, const Vertex& vertex) = 0;

or getting a value from this global Array /** * Get a vertex at a particular index. * @REDACTEDUSER * @REDACTEDUSER * @REDACTEDUSER */ virtual bool GetVertex(size_t index, Vertex& vertex) const = 0;

It's in the VertexContainerInterface.h file.

As an example, the VertexContainerInterface is also already implemented by the Spline component and Polygon Prism component EBuses.

The simplest way is to reuse this example in Lua seen here https://docs.aws.amazon.com/lumberyard/latest/userguide/component-vertex-container.html ) ... thus reusing this EBus Request Bus Interface Example.

This solution is uncompromisingly fast and easy to use and it's the raison why I proposed Luis @REDACTEDUSER

answered 4 years ago
0

Last solution but not least solution : we can introduce our glogal data inside tags, by using the tag component on Entities.

Too those Entities could be generated through spawn in order to create things like Array or Map containers at the size that we need.

For example, each Entity will bring with it several Tags that could simulate keys/data, and we have the existing node that allows us to get entities according to a tag like key in containers, and also delete, clear, ... REMOVEDUPLOAD REMOVEDUPLOAD @REDACTEDUSER

answered 4 years ago
0

Mr @REDACTEDUSER

answered 4 years ago

This post is closed: Adding new answers, comments, and votes is disabled.