theRAPTLab / gsgo

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

Feature: Select Character Type for pozyx tags #776

Closed benloh closed 9 months ago

benloh commented 9 months ago

Addresses #760

Features

screenshot_1336

To Test/Implement

Test Mapping

  1. Make sure one blueprint has # TAG isPozyxControllable true set to true. This will be the default blueprint that any new tag is set to. (You can set more than one isPozyxControllable. If there is more than one, one of the isPozyxControllable blueprints will be picked at random.)
  2. Start Main
  3. Move some pozyx tags around (or use the pozyx Gateway simulator to generate some fake tags).
  4. A list of active tags will show in the "CHARACTER CONTROLLERS" area.
  5. The active tags will default to the first isPozyxControllable blueprint.
  6. FakeTrack inputs will default to the first blueprint, since it ignores isPozyxControllable.
  7. Select any other blueprint from the popup menu for each tag to select a new blueprint type.
  8. The old agent will be removed and a new agent created in its place.
  9. The old agent state will be lost -- data is not ported from the old blueprint instance to the new blueprint instance.

Test "No Controllable Tag" Tracking

  1. Set isPozyxControllable and isPTrackControllable for all blueprints to false.
  2. Run the simulation.
  3. The console should not generate any errors
  4. Pozyx and PTrack inputs should use a random default blueprint -- this will be randomly selected
  5. FakeTrack inputs should default to the first blueprint on the list .

Caveats


Technical Background

During each sim loop, inputs coming from PTrack, Pozyx, Character Controllers, and FakeTrack are mapped to agent instance definitions and agents are then created. We tap into that flow by introducing a way to dynamically select a new agent instance from the list of available agents. The process is something like this (see the input to agent flow whimsical diagram):

  1. pozyx tags are updated with inputs.
  2. We detect when a new tag has been added. When a tag is added, we update a new instances state group called tags that lists all of the available PTrack, Pozyx, and FakeTrack inputs and their corresponding blueprint names.
  3. Those tags are listed on the "CHARACTER CONTROLLERS" panel on Main, along with a menu selector for all of the blueprint types that are available.
  4. By default, pozyx tags use the default blueprint specified with a isPozyxControllable tag.
  5. When a tag is selected on the "CHARACTER CONTROLLERS" panel on Main, we update the tags group of the instances state with a new blueprint id.
  6. During the regular simloop update in dc-inputs, we add or change the agent definitions using the tags table.
  7. Later during the sim-inputs phase, the agent definitions are mapped to agent instances, either updating or adding a new agent as necessary. The old agent is removed, and a new agent is created. State is not maintained across the two agents.

NOTE: WIth this system, ANY blueprint can be controlled by a pozyx tag. The # TAG isPozyxControllable tag is not necessary to make it controllable. The corollary to this is that we are not excluding any blueprints either. If exclusion is necessary, we'll need to add a filter to do that.


TO DO

benloh commented 9 months ago

@jdanish Here's a first pass at selecting character types. I'm still doing QA and documentation, but I think it basically works. Please give dev-bl/character-type a whirl to see if this does what you want.

jdanish commented 9 months ago

In wetlands_beaver_building, the dropdown list includes all characters (not just pozyx enabled ones) and when I switch to predator using fake track, it generates this error and pops back to beaver.

Screenshot 2023-10-04 at 8 38 55 PM

Also note the character name is split on two lines so takes up a lot of space?

Screenshot 2023-10-04 at 8 40 55 PM
benloh commented 9 months ago

Ah. I had implemented it so that ANY blueprint could be selected. I'll add in the filter.

The predator bug looks odd. But I'll take a look.

benloh commented 9 months ago

@jdanish regarding the character name split issue, because the character names and the tag ids are potentially quite long, and we don't really want to make the stage area any smaller, the only solution is to truncate or make the tag or character name shorter. I don't want to reduce the size of the font too much or it will be hard to read on screen. Are you OK with truncating the name? Or do you want to increase the width of the left sidebar? We can probably get away with reducing the right sidebar.

jdanish commented 9 months ago

I’m ok with truncating the name. Thanks!

jdanish commented 9 months ago

Gabby reports that this mostly works well. However, if you click setup to change the map, and then save, the character controller characters do not reappear unless you reload the screen. I have a video from her if you need, but I think that's clear?

benloh commented 9 months ago

All currently reported issues should be addressed:

benloh commented 9 months ago

One addition note for the record:

Errors coming from dynamically switching a tag's blueprints touch the following features: