editor-core icon indicating copy to clipboard operation
editor-core copied to clipboard

Create and destroy entities at runtime

Open randomPoison opened this issue 7 years ago • 3 comments

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

  • Add a new variant to IncomingMessage called CreateEntities for requesting that an entity be created. The variant should carry a field specifying how many entities should be created.
  • Add a new field to outgoing messages "created_entities" that is a list of any entities that were just created at the request of the editor.
  • The list of new entities should be sent as soon as the entities are created, ideally on the same frame.
  • The list of new entities should only be sent once.

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.

randomPoison avatar Oct 20 '18 03:10 randomPoison

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.

mh84 avatar Oct 29 '18 21:10 mh84

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.

randomPoison avatar Oct 29 '18 22:10 randomPoison

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. :)

mh84 avatar Nov 22 '18 21:11 mh84