ubc-minetest-classroom / minetest_classroom

Repo for Mintest Classroom game
GNU General Public License v3.0
10 stars 6 forks source link

Feature: Custom magnifying glass tool #6

Closed pauldpickell closed 2 years ago

pauldpickell commented 2 years ago

TODO: Fill out this issue stub

Lowie375 commented 2 years ago

Some ideas to consider:

DannyA98 commented 2 years ago

Good call on the metadata implementation, I think that's a great idea!

I would think a blurb should be enough rather than an external link to prevent players from leaving the game too much during a group task, but either should work at the moment

Lowie375 commented 2 years ago

Small update: metadata may not work well as intended, since it would result in a lot of data duplication. Some JSON or Lua table files containing the information for each plant would be better for storage

DannyA98 commented 2 years ago

Nanjou found that custom fields can be added to node definitions and we will be moving forward with that idea.

This allows us to differentiate the retrieved data to store in variables for building our formspec of each plant node available in-game or to be created down the line

pauldpickell commented 2 years ago

Nanjou found that custom fields can be added to node definitions and we will be moving forward with that idea.

This allows us to differentiate the retrieved data to store in variables for building our formspec of each plant node available in-game or to be created down the line

One caveat with this approach is that it would require redefining existing nodes in default (and others) and some species might have several node types associated with them (think: bark + leaves or leaf-on/leaf-off or berries present/absent or flowers present/absent, etc). Instead of storing the metadata in each node you should be able to use mod storage. This way, you can store the pertinent info in the mod storage table and the retrieve via a lookup table.

Would also be nice if this were an extensible framework that could easily be updated with additional species, information, etc via a formspec from the teacher menu.

Lowie375 commented 2 years ago

One caveat with this approach is that it would require redefining existing nodes in default (and others) and some species might have several node types associated with them (think: bark + leaves or leaf-on/leaf-off or berries present/absent or flowers present/absent, etc). Instead of storing the metadata in each node you should be able to use mod storage. This way, you can store the pertinent info in the mod storage table and the retrieve via a lookup table.

The issue of species with several node types was brought up in discussions between Daniel and I, and a lookup table seems like a good idea. Will also look into using mod storage instead of external files, though I worry that it may not offer persistence between server launches which could be cumbersome for classrooms that have a lot of nodes and do frequent restarts. UPDATE: mod storage should offer persistence (as evident by the "report" feature in mc_student/mc_teacher), so it should work well, as long as we set up the lookup tables well

Would also be nice if this were an extensible framework that could easily be updated with additional species, information, etc via a formspec from the teacher menu.

This sounds like a good idea, will look into doing that once the core functionality of the magnifying glass is complete.

Lowie375 commented 2 years ago

Would also be nice if this were an extensible framework that could easily be updated with additional species, information, etc via a formspec from the teacher menu.

Daniel and I have noted that images can't be uploaded through formspecs, so teachers would have to manually add images to the textures folder if they wanted to add their own species. However, everything else should work fine, from the looks of things

Lowie375 commented 2 years ago

UPDATE: Our first prototype is working! Will push to new branch magnify as part of the magnify mod shortly

pauldpickell commented 2 years ago

Prototype has been merged with develop. Looks good! One thing to note is that students can currently drop the tool, which means they would have to leave the server and rejoin to get the tool again if they lost it.

DannyA98 commented 2 years ago

Would also be nice if this were an extensible framework that could easily be updated with additional species, information, etc via a formspec from the teacher menu.

Nanjou and I were thinking how to implement the teacher-side formspec, it would be straightforward to ask for Common, Scientific Names and other text-based information but the image can't be uploaded by user input.

Assuming the instructor would know to put a file in the textures folder we would still have to make sure it is assigned to the correct plant species, we'll continue to brainstorm a solution to this

Lowie375 commented 2 years ago

We've begun implementing some teacher-side features - they are currently incomplete. Will continue to push progress to magnify as it is made, and will provide more updates as development continues

pauldpickell commented 2 years ago

Assuming the instructor would know to put a file in the textures folder we would still have to make sure it is assigned to the correct plant species, we'll continue to brainstorm a solution to this

I wonder if a teacher interface to input new species is more cumbersome than just providing support for installing new species packs? For example, we can distribute the mod pre-loaded with the plants, trees and fungi that are distributed with default and flowers. Then, we (or anyone) could create expansion packs to add more species via another mod.

Lowie375 commented 2 years ago

That sounds like a better plan, since it would solve some of our issues with image importing and species creation. We'll work on getting that system implemented and making entries for the species in default and flowers then!

We might also replace the "Manage Plant Species" button in the teacher tool with a "View Species Guide" button or something similar that shows a list with all of the plant species that have been registered with the magnify tool system. It might be worth adding that to the student notebook as well, if we do add it

Lowie375 commented 2 years ago

Good news: a system for importing plant information from other mod files has been added to magnify, and it seems to be working well! Will continue to work on improving this system and the magnify tool as development progresses

Bad news: making accurate tables for each of the species present in MineTest is tough. Danny and I have added some tables, though they will likely need to be checked over for factual accuracy, since a lot of the species present in the game are more generic and we don't have a lot of background knowledge to help us determine which specific species we should classify each one as. Needless to say, some help with classifying more generic species in the game, building tables, and finding reliable resources for reference would be greatly appreciated.

ginny-hang commented 2 years ago

I can help with providing some context for the plants, trees and fungi. I am assuming that it is possible to change the name of the plants, for instance 'Black Tulip' can be changed to 'Chocolate Lily' (Fritillaria affinis) which is native to BC. I am thinking it would be a good idea to obtain the descriptions from UBC Botanical Garden. So for the Chocolate Lily, I could summarize the information from the Botanical Garden's website. Would it be okay if I send you a table in excel or word with the generic default names from Minetest, the common and scientific name for an associated appropriate BC species in another, and then a description (blurb) for each plant? I'll use my best judgement and try to select native species.

Lowie375 commented 2 years ago

Yes, that would be great! Please send it to myself or Danny once it's ready (there's no big rush), then we'll begin filling in some data tables for each species

Lowie375 commented 2 years ago

Update: the species viewer has been implemented into the teacher tool, and looks to be working very well! We're still working on tidying it up and importing more species into it, so hopefully that'll get done very soon. Do also note that the refactor from #10 needed to be introduced to the magnify branch to prevent circular dependency issues, so that has been preemptively merged into magnify as of now. If #10 is ultimately rejected in favour of a better alternative, magnify will be refactored as necessary. (#10 was approved)

Lowie375 commented 2 years ago

Danny and I added some more species to magnify_default_nodes and magnify_flowers_nodes, but are still in the process of importing the remaining species and finding images for each species that we can legally use without running into copyright issues.

Additionally, there's still more that can be done to improve the magnify mod and its associated components:

For the most part, though, magnify is feature-complete. The tasks above are primarily for quality-of-life; the magnify mod itself will run regardless of the status of those tasks.

pauldpickell commented 2 years ago

Commit 00b6bd69fa78bbf6833316a484d846ab380d893f now adds a 3D model viewer to the formspec. The model formspec element is documented here.

I have temporarily disabled the default image element in the magnify formspec to illustrate how this could work. We might revert this if we do not like it. I used the meshport mod to extract an acacia tree as a wavefront.obj file and then identified the ordered list of texture files in blender for the model element:

"model[12.4,0.4;5.4,5.4;test_tree;tree_test.obj;default_acacia_tree_top.png,default_dry_grass_2.png,default_dry_dirt.png^default_dry_grass_side.png,default_acacia_leaves.png,default_acacia_tree.png,default_dry_grass_1.png,default_dry_grass_3.png,default_dry_grass_4.png,default_dry_grass.png;0,180;false;true;;]"

Lowie375 commented 2 years ago

I personally really like the addition of a 3D model to the species viewer! This would make the plant compendium a lot more useful, since you would then be able to match a model of a MineTest plant to a plant in the MineTest world. Plus, it's really cool to be able to see what a plant looks like in 3D. If we plan on keeping the model viewer, the general magnifying tool formspec will need to be edited to accomodate for it, but that shouldn't be too difficult to do - we'd just need to adjust the size and move some things around. Will get started on that once some other, more important tasks have been handled

Lowie375 commented 2 years ago

In other news, the plant compendium has been moved to the player inventory, and mc_teacher is now decoupled from magnify!

It's worth noting that these changes have made the species viewing formspecs pop out from the inventory, and there doesn't seem to be a way to re-open the inventory via Lua (at least, not in the MineTest documentation). However, it seems that the inventory menus themselves can be updated, so it may be worth trying to integrate the formspecs into the inventory itself rather than have them pop out in the future.

pauldpickell commented 2 years ago

If we plan on keeping the model viewer, the general magnifying tool formspec will need to be edited to accomodate for it, but that shouldn't be too difficult to do - we'd just need to adjust the size and move some things around. Will get started on that once some other, more important tasks have been handled

Yes, one thing that has become evident is a table will be needed to define the textures that need to be included in the formspec model element. I have added all the default trees as models to work with and the associated model elements need to be constructed as follows (to give you an idea about how to create the table entry):

"model[0,1;7,7;acacia_tree;tree_test.obj;default_acacia_tree_top.png,default_dry_grass_2.png,default_dry_dirt.png^default_dry_grass_side.png,default_acacia_leaves.png,default_acacia_tree.png,default_dry_grass_1.png,default_dry_grass_3.png,default_dry_grass_4.png,default_dry_grass.png;0,180;false;true;;]"
"model[0,1;7,7;apple_tree;apple_tree.obj;default_tree_top.png,default_leaves.png,default_tree.png,default_apple.png,default_dirt.png;0,180;false;true;;]"
"model[0,1;7,7;jungle_tree;jungle_tree.obj;default_jungleleaves.png,default_jungletree_top.png,default_jungletree.png,default_dirt.png;0,180;false;true;;]"
"model[0,1;7,7;pine_tree;pine_tree.obj;default_pine_needles.png,default_pine_tree_top.png,default_pine_tree.png,default_dirt.png;0,180;false;true;;]"
"model[0,1;7,7;aspen_tree;aspen_tree.obj;default_aspen_tree.png,default_aspen_tree_top.png,default_aspen_leaves.png,default_dirt.png;0,180;false;true;;]"
Lowie375 commented 2 years ago

As of now, magnify is feature-complete. Further updates to the magnify mod from this point forward will most likely be API, GUI, or backend improvements to optimize it and/or improve its overall quality.

Additionally, the API methods available in magnify have been documented in its README file.