theRAPTLab / gsgo

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

Make it possible to change character type #760

Closed jdanish closed 9 months ago

jdanish commented 11 months ago

It'd be really nice to dynamically change character type. Primary use case would be to hard-code certain pozyx tags. While it is always possible to use a flag to embed multiple behaviors in one character we think it's easier for kids to grok if they are separate. Therefore I can imagine other cases we'd want this like a caterpillar becoming a butterfly.

benloh commented 11 months ago

I'm not sure what you're referring to here. Could you give an example. Are we talk about ScriptEditor or InstanceEditor?

jdanish commented 11 months ago

I'm not sure what you're referring to here. Could you give an example. Are we talk about ScriptEditor or InstanceEditor?

Dynamically via script. So we might make a Starter character that has a circle costume and is assigned to pozyx. Then in init it says something like: IfProp Starter.trackerId equal 1 [[ Starter.changeTo Rabbit

And then the system would remove the starter, make a Rabbit, connect it to the same pozyx, and trigger init.

benloh commented 11 months ago

Is this more about changing costumes? Or is it more about behavioral actions tied to specific characters?

So let me see if I understand...

  1. You have x number of pozyx trackers with a fixed id.
  2. Instead of generically marking a character as pozyx-controllable, you want to assign a specific character to a specific id.
  3. ...and you want to do this dynamically? So fixed id 32 might be Rabbit in one run, but then via instance editing, it might be a Fox in another run?

Or are you saying that you want a look up table? e.g. id 1 is always Rabbit, id 3 is always fox? And so our character definition now becomes a generic agent script that be a rabbit or a fox (using visuals and shared behaviors)?

Maybe I'm missing something but I feel like we need full example of what you're wanting to do.

jdanish commented 11 months ago

It might help to know that in the current VU food web, there are literally like 10 different characters (snail, gopher, snake, rabbit, hawk, etc.). Currently, each of those is a different character type.

In theory, we could make an Organism character, and then have lots of ifProp code, but that's much harder for kids to read and makes it a bit unwieldy. Also, students with less coding experience find it harder to set those models up.

Currently, the VU team handles the setup by using the "pickCharacters" option and having all of these unique characters sitting on-screen. However, with a crowded screen caused by having loads of characters, it a) takes a while, and b) kids make mistakes and there is no easy way to undo it.

SO, yes, it'd be easier to give a kid the snail tag, or gopher tag. Currently, the only way to do that is to know that tag ID 1 should be a snail, and tag ID 2 should be. a gopher. However, that will only work if we have a generic Organism script, and inside of that we check and if character ID is 1, set the costume to snail, etc.

However, the problem with that approach is that it means if we want different behaviors for the snail and gopher, we have loads of if statements instead which make it harder to just edit and understand a single character.

A lookup table that is part of the round / model setup would work and might be best short-term, but long-term, the ability to say "Change my Character Type from Picker to Snail" would be more flexible and support other ways of modeling "transformation".

benloh commented 11 months ago

OK, let's try this again then...sorry if I'm not quite following...

Ideally you want...

When is the character type selected? During the "Pick a Character" stage?
And how to they do the selection? Are we proposing a new function for selecting the character? e.g. in CharControl we have a popup menu for selecting the character type so it's relatively easy for a CharControl to select a character, but there isn't a mechanism for a tag to arbitrarily select a character type. We'd need to figure out a new UI for identifying a id with a character type? Or am I missing something obvious?

One idea is to use the tags that support buttons, so we could potentially use button pushes to toggle between character types (assuming we don't end up with too many mistaken button pushes). But that is still slow.

So the key design challenge is figuring out how to quickly assign 10 different types for each id?

Would we want to revisit the idea of something like a transporter area, so you have 10 transporters, each corresponding to a character type? And kids just stand in the box corresponding to the character type they want?

benloh commented 11 months ago

Also, trying to make sure we're not talking about using cursors to inhabit a character? e.g. cursor is e.g. you start out with 10 agents already on screen. You use a pozyx id to move a cursor over an agent to inhabit the character type, and then your movement is tracked by the cursor/agent pairing? This is similar to what you want except that we have the extra indirect mapping to a generic cursor agent.

jdanish commented 11 months ago

Ahh, OK I think I see some of the dilemma. Some clarifications / making sure we are on the same page:

1) Currently, yes, if we want to use different characters, the character picker / "cursor is" function is the only way to do that. But, that takes a while (socially, not from a code perspective).

2) If you don't use that, all pozyz users are mapped to the same character type. So everyone has to be a gopher or a player or whatever.

3) We actually aren't thinking about kids changing technically, but socially. So the way we'd do this is to determine at coding time (whether us or kids) that ID 1 is a gopher, and 2 is a snail. Then we'd decide who is the gopher and hand them tag 1. Whoever the snail is gets 2. Etc. That seems much faster and easier than any code / UI solution.

4) Therefore, ideally, we just have a list somewhere (or set of if statements) that basically say "IfProp Player.trackerId equal 1 [[ changeCharacterTo 'gopher' ]] etc.

5) Right now, if I make all kids use a Player character, and just set the costume, I can do that all in the # PROGRAM INIT which would be ideal. I suggested making it a function because I can imagine later wanting a case where instead of switching modes, you switch whole characters. But we don't have a current need for that. If we do set it up this way, ideally it'd mirror the population spawning functionality in terms of passing info into the init if desired.

6) I think you said that it'd be hard to change character type once pozyx detects the characters, so maybe doing it in the Round Init would work? It doesn't need to be a table or other new UI element because of how we'd set it in advance. So simply using gem-script is fine. Though if a table or drop-down are easier... sure.

Hopefully that helps?

benloh commented 11 months ago

So, what if we add a #TAG PozyxId 32 line to the InstanceEditor. So you would create your instances, e.g. add a snail, gopher, etc. Place it on the map, and then use the Instance Editor to add a # TAG PozyxId 32 for snail and # TAG PozyxId 42 for the gopher.

This way you can also have two snails, e.g. with one id set to 32 and one to 33.

The caveats are:

On the other hand, if we bake it into the gemscript, you'd be limited to one id per character type (or have a long series of if statements to test every id).

I think we'll have to do some other shenanigans to get ids to line up correct too but we can figure that out after we get the use model nailed.

jdanish commented 10 months ago

The stage editing is a bit to slow, distracting. I think we are better off having a long series of id test statements (I can move that into a feature to collapse it to one line).

The IDs line up fine on my end, in that if I know the ID, and test for it and change the costume based on trackingID it works fine.

benloh commented 9 months ago

Proposed Solution

Add a dropdown menu to the "Character Controllers" list on Main that lists devices (pozyx and character controllers) and allows you to select a character type.

Use cases

Joshua study starts Tuesday 10/3. Noel starts Oct 16th.

benloh commented 9 months ago

Implemented with #776