Comments (6)
For an example, the style I use is a struct of {Atom64, VariantMap}
where Atom64 is a unique identifier (64-bit integer of packed string, but can be whatever is needed, a flyweight string should world) and a VariantMap is just a Mapping of Atom64's to a Variant (which is an in-built list of useful base types, from booleans to integers, string, Vector2/3's, Quaternions, Another VectorMap, etc...), which is conveniently also a good mapping point for scripting layers.
from amethyst.
If systems run on their own threads shouldnt we use channels for events. My naive approach was to use Arc to put dynamically allocated arbitrary message structs on the channels.
We need to dev. a library that provides Request reply and pubsub patterns over channels. But any approach workout dynamic allocation per message will work.
from amethyst.
Channels are one (bruteforce) way to approach this. It's a question if we can put in something more efficient and convenient, perhaps even at the specs
level.
from amethyst.
Quoted directly from Gitter on September 21, 2016 7:34 PM:
Hey everyone. I've been thinking very hard about event handling lately, and I must say, it's really hard to get right! 😄 After reading a lot and looking at what we currently have, I did arrive at a few conclusions:
- I personally dislike the ergonomics of our current event system. The usage is too verbose for my tastes and doesn't allow for the polling of multiple event types at once. Something simpler and more data-driven is definitely needed.
- I do not want
Broadcaster
to become a global switchboard for communicating throughout the entire engine. This is just asking for trouble! I believe we should stick to a small and fixedEvent
enum that allows higher-level code to react to low-level events (user input, window events, etc.) and nothing more. - Gameplay events are supposed to be extensible, while engine-level events don't need to be. By having separate systems for both, gameplay events can be data-driven at the expense of performance, while engine events can be hardcoded and very fast. Also, they can be processed independently of each other.
- I believe that each processor should have its own internal event queue that outside code can poll/subscribe to, instead of every subsystem being tied to one massive global queue. The specifics of how this API should be written are up in the air, but here is a primitive example of what I mean: a
Physics
processor might have anon_collide()
method that accepts a closure like| e1, e2 | { /* Do something... */ }
. These closures could be written in Rust or in script, and could be executed in parallel for better performance.
I would like to hear your thoughts on this, especially since many of you probably have a deeper background in game development than I. Any better ideas?
from amethyst.
I'm might just be speaking gibberish here, as I've not really looked into it.
But you could allow system level events to be extendable to a point.
Somewhere along the line when setting up the engine, you can specify a type for system events. As long as this type implements std::convert::From<Event>
.
This allows the custom event to be turned back into the system event via Into
, as it has a blanket implementation in std.
impl<T, U> Into<U> for T
where U: From<T>
Which of course this simply means, when handling normal system level events, you can call .from on the custom type to turn them into the custom type, or .into to convert them back to the system event when the engines code needs to work with them.
However, this wouldn't be data driven. But the lack of this being data driven could be seen as a way to discourage extending this, except for the cases where you really need something on the level of system level events to represent what you need.
I'm not really involved with the development here, and I fully expect this not to really align with anything, or there being two billion issues I've not thought about and thus it's fine to ignore this :) Just food for thought.
from amethyst.
This issue hasn't been updated in a while, and there isn't as much content to see here compared to #229. Therefore, I will close this issue. Feel free to reopen it if needed!
from amethyst.
Related Issues (20)
- Pong game breaks when using Airpods Pros HOT 5
- Derive proc_macros unnecessarily require the user to import apparently arbitrary types HOT 1
- RenderingBundle has undocumented dependency when used with ApplicationBuilder HOT 2
- RenderToWindow::from_config_path - Parse Errors include filename that couldn't be parsed HOT 2
- Include brew dependencies for MacOS HOT 1
- update amethyst_rendy to use rendy 0.5.1 HOT 1
- Reduce friction to use register_asset_type! macro HOT 1
- Allow use of legion system macros without needing to manually add legion crate HOT 1
- Add example how to add thread local bundle / system with object which can not be send between threads HOT 3
- Most Examples Are breaking, With missing imports HOT 1
- supported platforms? HOT 1
- Examples fail to run second time with error: failed to load manifest for workspace member .assets_db HOT 1
- Custom pipeline properties for rendering (3D-related)
- [Question] is there a way to download all of amethyst for convenient offline use
- the focus screen functionality does not work at all HOT 9
- Amethyst rendy is broken, the build is broken and has been broken for more than a year HOT 4
- Amethyst Roadmaps not updated to reflect project discontinuation
- amethyst was deprecated? if yes, why? HOT 3
- Make tiled windows fullscreen
- Wide layout not resizing with new windows. Requires relaunching.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amethyst.