amethyst / editor-core

Crate that allows an Amethyst game to communicate with an editor.
Other
44 stars 10 forks source link

Create and destroy entities at runtime #29

Open randomPoison opened 6 years ago

randomPoison commented 6 years ago

Add support for allowing the editor to request that a new entity be added to the game world.

Similarly, to support destroying entities at runtime we'll need to add a variant to IncomingMessage called DestroyEntities that takes a list of entities to be destroyed. The list of destroyed entities does not need to be sent back to the editor, though.

mh84 commented 6 years ago

As this is less or more needed by or blocking https://github.com/randomPoison/amethyst-editor/issues/38, i can take care of this too.

randomPoison commented 6 years ago

Yup, you'll need to do both! The core functionality is implemented in amethyst-editor-sync, and then you only need to add the corresponding UI elements to the Electron editor and have them send the right messages back to the game.

mh84 commented 6 years ago

I made some progress in refactoring a lot of the code (after a lack in spare time to work on this) in general to do something like:

Receive editor input -> Update states -> read new states -> send updated data back to the editor

I will do some refactoring of the code base now too, and then add the few lines for entity creation/deleting too. I will make an PR this weekend regarding the first part for review, maybe the second too. :)