theRAPTLab / gsgo

GEM-STEP Foundation repo migrated from GitLab June 2023
1 stars 1 forks source link

Feature: Map Editor - [merged] #498

Closed benloh closed 1 year ago

benloh commented 3 years ago

Merges dev-bl/mapeditor -> dev

This implements a rudimentary Map Editor so that users can define the number of instances and initial properties for a given model.

How This Works

A few key points:

To Test

  1. Check out dev-bl/mapeditor
  2. npm run bootstrap && npm run gem
  3. Open a Map Editor page with the aquatic model: http://localhost/app/mapeditor?model=aquatic
  4. You should see 3 fish and 4 algae defined and displayed on the screen.
  5. The starting instances are defined in gs_packages/gem-srv/src/app/data/aquatic.js in the instances array.

To Add a New Instance

  1. Click on a blueprint button in the "ADD BLUEPRINTS" panel to add a new instance.
  2. A new agent should appear approximately in the center of the screen.
  3. Click on the blueprint button again and a second instance will appear, with slight random offset.

To Edit an Instance

  1. Click the instance in the "MAP INSTANCES" panel to Edit it.
  2. Type any number.
  3. Hit "Enter" to assign the value and force a screen update. You should see the agent move to a new location.
  4. Select another instance and change the value.
  5. Hit "Tab" to change focus and force update.
  6. Select another instance and change the value.
  7. Click anywhere on the instance to force an update.
  8. Select another instance and change the value.
  9. Select another instance to force the update.
  10. Try typing non-numeric characters -- you shouldn't be allowed to.
  11. Try directly dragging an instance -- you should see the parameters update when you drop the instance.

Still To Do

This is more of a proof of concept than anything. There are still many significant features and systems to build.

...and many more...

Known Issues

See #18 for Design Discussion.

benloh commented 3 years ago

@daveseah Please review and suggest edits, or accept if it works. No rush.

benloh commented 3 years ago

added 1 commit

Compare with previous version

benloh commented 3 years ago

added 1 commit

Compare with previous version

benloh commented 3 years ago

In GitLab by @daveseah on Mar 4, 2021, 15:07

@benloh it seems to compile and run! Accepting merge.

benloh commented 3 years ago

In GitLab by @daveseah on Mar 4, 2021, 15:07

mentioned in commit 8f23b7b6a932fea787a43af4d34389090b994c29

benloh commented 3 years ago

In GitLab by @jdanish on Mar 6, 2021, 06:57

Awesome. Two quick comments: 1) I don't think we need to add multiple instances programatically. It can happen via normal script operations once we have spawn, but I don't see any benefit in complicating the current screen / process which works nicely.

2) One thing I noticed in my tinkering is that the sim in the mapeditor will, at some points, run. That is, fish start getting hungry and eventually die. I assume we don't want this to run as it makes it really confusing when trying to determine what you are putting and where it'll be ? I realize this might be a bug or not yet implemented but wanted to comment in case it wasn't on your radar.

Looking forward to seeing what's next!

benloh commented 3 years ago

Thanks for testing, Joshua.

  1. Multiple instance UI: Great! I'll just leave things as-is and if we decide we need to add one later we will.

  2. Inadvertent runs: This was a temporary hack to get things to show up when the map editor first loads: we basically ran the sim for a fraction of a second. It has now been properly implemented with !56.

benloh commented 3 years ago

In GitLab by @jdanish on Mar 6, 2021, 10:04

Awesome. Should have known you’d be one step ahead.