Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Worldbuilder MTurk task #323

Open
wants to merge 1,433 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1433 commits
Select commit Hold shift + click to select a range
e6a8814
Proper serialization and deserialization of UseEvent
JackUrb May 3, 2021
f68beda
dozing fix
JackUrb May 3, 2021
52b31df
added image styles for tutorial page
JustinPinero May 3, 2021
561b8b5
added sizing styles to experience points system topic images
JustinPinero May 3, 2021
b732718
added image styles to character basics
JustinPinero May 3, 2021
bb9c65a
Death message
JackUrb May 3, 2021
d7d30c9
Death has better messaging
JackUrb May 3, 2021
097cd04
added and styled action images
JustinPinero May 3, 2021
f87d417
resized tutorial header subheader and text classes
JustinPinero May 3, 2021
03a2071
styled tutorial text
JustinPinero May 3, 2021
dda1b21
removed tutorial header
JustinPinero May 3, 2021
71c28e9
added back link to tutorial pagee
JustinPinero May 3, 2021
4fc698c
added Character header to soulspawn event
JustinPinero May 3, 2021
57028c2
styled stars and added shrinking animation and slide animation to mes…
JustinPinero May 4, 2021
b49d9db
added character map util function for default character emojis
JustinPinero May 4, 2021
22675a6
fixed images being transparent with background
JustinPinero May 4, 2021
8fb9433
removed inline styling and added soulspawn-subheader class
JustinPinero May 4, 2021
a76b3c8
comment out previous code for emoji mapping for later use
JustinPinero May 4, 2021
7a1d5df
Merge pull request #212 from facebookresearch/soulspawn-fix
JustinPinero May 4, 2021
3e8be24
Merge pull request #211 from facebookresearch/tutorialpage
JustinPinero May 4, 2021
b2d42f0
Merge pull request #214 from facebookresearch/default-emojis
JustinPinero May 4, 2021
3df0bb9
Merge pull request #213 from facebookresearch/star-animation
JustinPinero May 4, 2021
014d927
Merge pull request #215 from facebookresearch/pre-alpha-fixes3
JustinPinero May 4, 2021
248a7fa
Merge pull request #210 from facebookresearch/more-pre-launch-fixes
JackUrb May 4, 2021
ee65fe0
fixed type in exprience points system
JustinPinero May 4, 2021
ae53d5d
fixed character subheader placement
JustinPinero May 4, 2021
11a39ee
Merge pull request #216 from facebookresearch/tutorialpage
JustinPinero May 4, 2021
e7f2b03
Merge pull request #217 from facebookresearch/soulspawn-fix
JustinPinero May 4, 2021
a657ccd
update help commands
jaseweston May 4, 2021
6432d55
Merge pull request #218 from facebookresearch/bugz7
JackUrb May 4, 2021
2cb9bb9
added modal component and instruction modal state
JustinPinero May 4, 2021
79a13a7
Fixing doubled context on unsafe message
JackUrb May 4, 2021
4d42294
Parsing events with capitalization
JackUrb May 4, 2021
2e52e1f
Fixing grammar in leave and arrive events
JackUrb May 4, 2021
0d830ff
Merge pull request #219 from facebookresearch/more-pre-launch-fixes-2
JackUrb May 4, 2021
15fcda4
added header to instruction modal content
JustinPinero May 4, 2021
dcfa168
added copy to modal and back functionality to tutorial page back button
JustinPinero May 4, 2021
2b580c7
styled instruction modal and added tutorial screenshots
JustinPinero May 4, 2021
e009d1d
added closes functionality to modal
JustinPinero May 4, 2021
dad4476
added new back button to terms and about pages
JustinPinero May 4, 2021
de37591
Merge pull request #220 from facebookresearch/instruction-modal
JackUrb May 4, 2021
fa9e6b7
set modal to not render unless player xp<=10
JustinPinero May 4, 2021
5880a1d
Merge pull request #221 from facebookresearch/instruction-modal
JackUrb May 4, 2021
251063d
fixed typo in minitutorial
JustinPinero May 5, 2021
829b561
Update index.js
JackUrb May 5, 2021
d2508ab
Merge pull request #222 from facebookresearch/copy-corrections
JackUrb May 5, 2021
0fb7dd2
added help entry
JustinPinero May 5, 2021
73c96ef
updated styles
JustinPinero May 5, 2021
1bce452
Merge pull request #223 from facebookresearch/help-entry
JustinPinero May 5, 2021
291172d
added send button and styles to chat input component
JustinPinero May 6, 2021
76333ab
generative start features
jaseweston May 6, 2021
0202de5
moar
jaseweston May 6, 2021
70f4aca
Merge pull request #225 from facebookresearch/bugz7
jaseweston May 7, 2021
6e28b8d
requirements change
jaseweston May 7, 2021
565dd76
Merge pull request #227 from facebookresearch/requirements2
jaseweston May 7, 2021
67ccfae
Merge pull request #224 from facebookresearch/sendbutton
JustinPinero May 7, 2021
46d197d
aadded play button to bottom of tutorial page
JustinPinero May 10, 2021
a00596c
added status entry
JustinPinero May 10, 2021
586ec95
humanz (#228)
jaseweston May 10, 2021
d039da1
added and styled inventory message entry
JustinPinero May 10, 2021
bc2d41f
added button revisions
JustinPinero May 11, 2021
9d6da90
Update Actions.js
JackUrb May 11, 2021
515312d
fixed mobile styling for entry
JustinPinero May 11, 2021
0c559e1
Merge pull request #230 from facebookresearch/status-entry
JustinPinero May 11, 2021
73027b4
Merge pull request #229 from facebookresearch/tutorial-button
JustinPinero May 11, 2021
972d725
Merge branch 'entry-button-revisions' into inventory-message
JustinPinero May 11, 2021
5d132d0
resolved conflicts
JustinPinero May 11, 2021
7a211d6
restyled inventory message and made it responsive
JustinPinero May 11, 2021
8f67ce5
Merge pull request #231 from facebookresearch/inventory-message
JustinPinero May 11, 2021
fafb2f7
refactored status message
JustinPinero May 11, 2021
6c8f474
restyled help entry with requested revisions
JustinPinero May 11, 2021
20e5726
Added and styled Quest component and added it to entry component
JustinPinero May 11, 2021
47b59b9
Merge pull request #232 from facebookresearch/help-entry
JustinPinero May 11, 2021
3d283e8
Merge branch 'entry-button-revisions' into quest-entry
JustinPinero May 11, 2021
27e98c4
merged other entries and removed console logs
JustinPinero May 11, 2021
33b51d4
Merge pull request #233 from facebookresearch/quest-entry
JustinPinero May 11, 2021
b429296
merged all branches
JustinPinero May 11, 2021
73c9c04
restyled home page
JustinPinero May 12, 2021
b4fa629
fixed sizing bug
JustinPinero May 12, 2021
036a2bf
refactored landing app
JustinPinero May 12, 2021
7a3c4fc
restyled aboutpage
JustinPinero May 12, 2021
a031a3d
restyled tutorialpage
JustinPinero May 12, 2021
51e2752
restyled terms page
JustinPinero May 12, 2021
ad55310
restyled login page
JustinPinero May 12, 2021
75661be
restyled error page and logout page
JustinPinero May 12, 2021
dd577ea
styling gameapp
JustinPinero May 12, 2021
1ac36ff
Merge pull request #234 from facebookresearch/entry-button-revisions
JustinPinero May 12, 2021
bf267c7
restyling chatlog for mobile
JustinPinero May 12, 2021
5e2c71e
added media queries to entry styles
JustinPinero May 12, 2021
8450929
added isMobile state and restyled modal
JustinPinero May 12, 2021
3ac2298
added drawer feature
JustinPinero May 12, 2021
270a8fa
added resize state and event listener
JustinPinero May 12, 2021
631bbae
added glowing button component removed typos in gameapp/styles.css bu…
JustinPinero May 13, 2021
ba159f0
added mobile frame header
JustinPinero May 13, 2021
80efa4c
added toggleswitch, header, and buttons to mobile frame
JustinPinero May 13, 2021
bc95170
connected mobile frame to gameapp
JustinPinero May 13, 2021
b200afd
styled toggle and header
JustinPinero May 13, 2021
bbf8b5d
fixed responsive sizing in mobile frame
JustinPinero May 13, 2021
b352064
fixed speech bubble tails responsiveness
JustinPinero May 13, 2021
e2cd944
fixed chat icon positioning in mobile view
JustinPinero May 13, 2021
fb47886
fixing chatlog styles
JustinPinero May 13, 2021
7e5fde6
fixed chat alignment issues in mobile ui
JustinPinero May 13, 2021
0225c65
Merge pull request #235 from facebookresearch/mobile-gameapp
JustinPinero May 13, 2021
7aeac58
Merge pull request #236 from facebookresearch/mobile-landingapp
JustinPinero May 13, 2021
18e217c
added tooltip and lable to sidebar toggle switch
JustinPinero May 13, 2021
b6fcec3
Merge pull request #237 from facebookresearch/mobile-restyling
JustinPinero May 13, 2021
a46d00b
fixed spacing issue from help message (#238)
JustinPinero May 14, 2021
02ec6ed
Mobile restyling Fixes (#239)
JustinPinero May 17, 2021
1073970
fixed fonts on level dispaly and progress bar, changed logout button …
JustinPinero May 26, 2021
4c1e578
fixed sizing of messages, sizing of text, send button styling
JustinPinero May 26, 2021
475ea76
Merge pull request #242 from facebookresearch/ui-fixes-3
JustinPinero Jun 10, 2021
643bb5d
parse actions with wierd quotes (#244)
JackUrb Jun 14, 2021
7b9b396
Updating parser for multithreading (#251)
JackUrb Aug 9, 2021
7fa6605
added say and do buttons added documentation
JustinPinero Aug 20, 2021
6e53c89
removed unused code and added more documentation to chatdisplay compo…
JustinPinero Aug 20, 2021
118a438
adding mobile style fixes to progress bar and level display
JustinPinero Aug 23, 2021
33868e8
wired tell feature
JustinPinero Aug 24, 2021
ae54785
fixed repsonsive styling of player info icons on mobile
JustinPinero Aug 24, 2021
66244c4
adding redux
JustinPinero Aug 25, 2021
d902725
added redux and redux toolkit
JustinPinero Aug 31, 2021
e93bf67
added typescript to game app
JustinPinero Aug 31, 2021
817e784
Server data browsing scripts and fixes (#255)
JackUrb Sep 1, 2021
9a9be9d
Requirements fix (#258)
JackUrb Sep 1, 2021
475ffba
Human to player (#259)
JackUrb Sep 1, 2021
d3837c2
Crowdsourcing UI (#261)
JackUrb Sep 1, 2021
68640bc
Fixing npc assignment bug (#263)
JackUrb Sep 7, 2021
c83984e
added redux foundation, added personal info slices, added xp, giftxp,…
JustinPinero Sep 8, 2021
65746ea
added increaseXp and decrementGiftXp to reducer actions
JustinPinero Sep 8, 2021
e9d4f2f
added foundation for redux websocket integration
JustinPinero Sep 9, 2021
13a8a70
added documentation to slices, wired xp and giftxp redux state into e…
JustinPinero Sep 10, 2021
13b8a2e
removed passed props from experience info components
JustinPinero Sep 10, 2021
12506bd
added sessioninfo section to features, added session xp slice, added …
JustinPinero Sep 10, 2021
4547328
removed xp props from sidebar
JustinPinero Sep 10, 2021
5c42499
fixed emoji picker redux action, added view slice
JustinPinero Sep 13, 2021
9cc7403
Added documentation to GamePage for new state and useEffects, removed…
JustinPinero Sep 13, 2021
f4496b0
added chatInput Slice
JustinPinero Sep 13, 2021
90f79e1
restructured messages and types, restyling messages
JustinPinero Sep 13, 2021
fc69fed
fixed overlapping system messages
JustinPinero Sep 13, 2021
eb89633
restructured message types and styles, fixed help message overlap bug…
JustinPinero Sep 14, 2021
a6d2e00
restyled help message for both mobile and desktop
JustinPinero Sep 14, 2021
784c85e
Multi-agent chat first pass (#264)
JackUrb Sep 14, 2021
519f3cb
removed console logs, unused code, added substantial documentation, r…
JustinPinero Sep 14, 2021
6cfcb03
added styling for safari browser, added styling for mobile, fixed mai…
JustinPinero Sep 14, 2021
2b9ddb7
building tutorial popover
JustinPinero Sep 16, 2021
32f15cb
added info button
JustinPinero Sep 16, 2021
c369b33
added tutorial popover component, added gamecopy file with tutorial c…
JustinPinero Sep 16, 2021
f5a42d5
added tooltips to both chat display and sidebar
JustinPinero Sep 16, 2021
9b4f8c9
added help mode, added on click tool tips to playerinfo, Character i…
JustinPinero Sep 22, 2021
9713b81
added tooltips and animations to quest message, status message, agent…
JustinPinero Sep 22, 2021
ea63ee3
added tooltips and animations for inventory, send button, chat input,…
JustinPinero Sep 22, 2021
7d14f99
added infobutton component, added render condition to infobutton in s…
JustinPinero Sep 24, 2021
0350863
fixed toggle to clear tooltips during switch when in help mode
JustinPinero Sep 24, 2021
be8a582
added and styled final tool tips, fixed cycle tooltips on chat bar, f…
JustinPinero Sep 24, 2021
79eeed9
Merge pull request #267 from facebookresearch/help-mode
JustinPinero Sep 24, 2021
73a0935
Merge pull request #265 from facebookresearch/gameapp-ui-update4
JustinPinero Sep 27, 2021
1b841e4
added redux
JustinPinero Sep 30, 2021
1f48ff8
added player world slice
JustinPinero Oct 4, 2021
d4ce730
building modals, added modal slice to redux state
JustinPinero Oct 5, 2021
145d647
Connected modal redux state to world row icons
JustinPinero Oct 5, 2021
b76ccc6
added create world button, styled homepage buttons and layout
JustinPinero Oct 6, 2021
71f2211
building editworldpage, added stat block, added nav buttons for editw…
JustinPinero Oct 6, 2021
d310926
styling modals, connected modal content to selected world redux state
JustinPinero Oct 7, 2021
b7c0841
added world edit routes
JustinPinero Oct 11, 2021
e96c5e7
connected EditWorldFrame buttons to navigation
JustinPinero Oct 11, 2021
dbe34a9
added breadcrumbs component
JustinPinero Oct 11, 2021
768b1f0
added buttongroups component
JustinPinero Oct 11, 2021
7b6f1f4
fixed side navigation
JustinPinero Oct 11, 2021
f5d5c55
added sidebar component
JustinPinero Oct 11, 2021
5b40d10
added sidebar feature slice, built sidebar
JustinPinero Oct 12, 2021
cee8d88
Added lightqa readme that shows how to run seq2seq2seq interactively …
leox1v Oct 13, 2021
ae75d8d
Creating a light world object from an instance of the old graph (#269)
mojtaba-komeili Oct 14, 2021
8b62f36
Updated lightqa readme with new checkpoints. (#270)
leox1v Oct 15, 2021
ea1a560
fixed edit world sections, added general table, added dummydata
JustinPinero Oct 18, 2021
4549eec
added filter to search bar
JustinPinero Oct 18, 2021
dd22b2b
building rooms page, added bread crumb, added 2 generate fields
JustinPinero Oct 18, 2021
395c5d4
added slider component
JustinPinero Oct 18, 2021
ab492b8
added slider and button toggle to room form
JustinPinero Oct 18, 2021
f051a33
Clarifying the equipped objects (#271)
mojtaba-komeili Oct 20, 2021
c5d3918
added map to map page, added properly structured dummy-data to act as…
JustinPinero Oct 20, 2021
5e5759e
added rooms, objectsm, and characters redux slices
JustinPinero Nov 4, 2021
34a3e02
Added new map components, tile, grid, utils, building tile, connected…
JustinPinero Nov 11, 2021
94b356d
worldbuilder map rework, fetching and sorting room data in map page l…
JustinPinero Nov 12, 2021
816c0b4
added border calculator
JustinPinero Nov 12, 2021
47898f4
added and tested grid data generator and room checker utility functions
JustinPinero Nov 12, 2021
e2c70cd
rebuilt grid and map components without using grid-layout library
JustinPinero Nov 22, 2021
b296683
fixing dimensions on tiles
JustinPinero Nov 30, 2021
46ac14a
styling paths
JustinPinero Nov 30, 2021
7af9d36
added sidebar, connected sidebar to selectedroom slice, connected til…
JustinPinero Dec 1, 2021
4982f38
connected advanced edit to basiceditmodal
JustinPinero Dec 1, 2021
634dd11
added numberbuttoninput to tool bar
JustinPinero Dec 1, 2021
1995cf3
added and connected floor selector
JustinPinero Dec 1, 2021
caad94e
added neighbor props to tile component, set conditional rendering for…
JustinPinero Dec 2, 2021
5668653
refactoring typeahead tokenizer
JustinPinero Dec 3, 2021
3db3a50
fixed tokenizer
JustinPinero Dec 8, 2021
7a94fac
various map fixes, added character route, added cog click route, conn…
JustinPinero Dec 14, 2021
68a3677
fixed centering of map
JustinPinero Dec 14, 2021
e7f8bae
added extra columns and rows at beginning and end of both axis of map
JustinPinero Dec 29, 2021
2ef6020
fixed starting position with new grid data
JustinPinero Dec 29, 2021
8c50bf8
Fixing tile color update function
JustinPinero Dec 30, 2021
69f46e0
fixing color change state
JustinPinero Dec 30, 2021
18b1b9c
Fixed local storage update, refactored add, delete, update reducer ac…
JustinPinero Jan 17, 2022
0effec5
fixed color selection, added direct updates to draft on tile click wh…
JustinPinero Jan 17, 2022
74bf7ad
added id generation to character, room, and object creation
JustinPinero Jan 17, 2022
38366f3
fixed simple additions for basic edit for both characters and items
JustinPinero Jan 17, 2022
283e87f
built advanced edit pages, fixed slider and generate forms, fixing pa…
JustinPinero Jan 20, 2022
8721a3c
fixed map loading error
JustinPinero Jan 20, 2022
450cc11
began styling tiles, fixing path update bug:
JustinPinero Jan 20, 2022
87e2711
Documentation time (#273)
JackUrb Jan 24, 2022
cd09544
Creating `light` master script for ParlAI tooling (#274)
JackUrb Jan 24, 2022
3f9dcd5
fixed breadcrumbs, fixed local storage, added add room feature, added…
JustinPinero Jan 25, 2022
44d366e
adding common sense + world builder code
Alex-Gurung Jan 27, 2022
8825dd5
fixed edit room switch on creation, fixed edit room rerender on delet…
JustinPinero Jan 31, 2022
fab859a
fixed add character clearing list bug
JustinPinero Jan 31, 2022
bdec85f
fixed delete functions and associated state changes for both room an…
JustinPinero Jan 31, 2022
e33dc86
Merging in teachers and code for RL-Quests paper. (#275)
JackUrb Jan 31, 2022
b302099
Rl quests merge (#276)
JackUrb Jan 31, 2022
5a65bed
updated grid data generator helper function to include above and belo…
JustinPinero Feb 1, 2022
8fbaa1b
added footer and stair components to tile
JustinPinero Feb 3, 2022
85a9497
fixed wiring for advanced room editor
JustinPinero Feb 9, 2022
ea2098b
connected advanced edit forms to state
JustinPinero Feb 11, 2022
600ca76
added inlinetext insert component to character and object pages
JustinPinero Feb 15, 2022
efa0673
Intro code for new project (#279)
JackUrb Feb 15, 2022
cab6d82
Merge branch 'main' into commonsense-merge
Alex-Gurung Feb 15, 2022
4301100
Merge pull request #278 from facebookresearch/commonsense-merge
Alex-Gurung Feb 15, 2022
760cc68
fixed breadcrumbs
JustinPinero Feb 21, 2022
0ec064d
set object prefix defaults and plural defaults
JustinPinero Feb 22, 2022
20d84b0
added character prefix state and defaults
JustinPinero Feb 22, 2022
0923f51
added and tested nested delete util function to edit objects page
JustinPinero Feb 22, 2022
fbba766
added content remover helper function
JustinPinero Feb 24, 2022
3696e01
Task lightgame (#281)
JustinPinero Mar 16, 2022
717d6f0
Pre-authorized worker login (#282)
JackUrb Mar 24, 2022
e22f91d
Gameapp instruction modal removal (#285)
JustinPinero Apr 11, 2022
20f8e87
Tutorial world, full implementation (#266)
JackUrb Apr 12, 2022
e1ca97a
Single model, reusing ActionParser (#286)
JackUrb Apr 12, 2022
badc60d
World hotfix
JackUrb Apr 12, 2022
cd4e2cc
Small deploy-related fixes (#287)
JackUrb Apr 14, 2022
3983f6a
LIGHT Tutorial fixes (#289)
JackUrb Apr 19, 2022
4d6ca24
Merge branch 'main' of https://github.com/facebookresearch/LIGHT into…
JackUrb May 6, 2022
be55a9d
Stubs for world builder MTurk task
JackUrb May 6, 2022
dd6850f
Worldbuilder update (#272)
JustinPinero May 6, 2022
467c955
Merge branch 'main' into worldbuilder-task
JackUrb May 6, 2022
2222d21
Merge branch 'main' into worldbuilder-task
JackUrb Aug 31, 2022
2f578bf
Removing files that shouldn't persist
JackUrb Aug 31, 2022
a0d4e91
Adding copyright headers
JackUrb Aug 31, 2022
897ea2d
Dropping duplcate copyrights
JackUrb Aug 31, 2022
517a83e
more copyright fixes
JackUrb Aug 31, 2022
a44edb2
Merge branch 'main' into worldbuilder-task
JackUrb Aug 31, 2022
53cce37
a few more copyrights
JackUrb Aug 31, 2022
e32261d
no longer existent file
JackUrb Aug 31, 2022
3342592
Cherrypicking more up-to-date custom_world_interactions code
JackUrb Aug 31, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#@package _global_
defaults:
- base
game_url: "https://www.light-rpg.ai/"
preauth_secret: "TODO"
num_tasks: 50
mephisto:
blueprint:
onboarding_qualification: "light-gameplay-onboarding"
task:
allowed_concurrent: 1
task_name: light-gameplay-task-pilot
task_title: "Pretend to be a character in a fantasy text-adventure world"
task_description: >
You will be provided a character to play as in a text adventure game.
After a brief tutorial, you can navigate the world and interact with other characters in the world.
Try to stay in character and accomplish your goal.
You must do 15 actions and have 15 turns of dialogue minimum to submit the task.
task_reward: 4.00
task_tags: "fantasy,text,role-playing,adventure,dialogue"
maximum_units_per_worker: 3
max_num_concurrent_units: 15
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#@package _global_
defaults:
- base
game_url: "https://www.light-rpg.ai/"
preauth_secret: "TODO"
num_tasks: 10
mephisto:
blueprint:
onboarding_qualification: "light-gameplay-onboarding-sandbox-2"
152 changes: 152 additions & 0 deletions crowdsourcing/environment/world_builder/run_task.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
#!/usr/bin/env python3

# Copyright (c) Meta Platforms, Inc. and affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

import os
import hashlib

from mephisto.operations.operator import Operator
from mephisto.tools.scripts import (
build_custom_bundle,
task_script,
)
from mephisto.operations.hydra_config import build_default_task_config
from mephisto.abstractions.blueprints.remote_procedure.remote_procedure_blueprint import (
SharedRemoteProcedureTaskState,
RemoteProcedureAgentState,
)

from omegaconf import DictConfig, MISSING
from typing import List, Any, Dict
from dataclasses import dataclass, field

MAX_INCORRECT = 3


def get_salted_hash(in_string, salt):
"""Return a hash string for the given string using sha-256"""
salted_string = in_string + salt + in_string
res = hashlib.sha256(salted_string.encode("utf-8")).hexdigest()[:20]
return res


@dataclass
class BuilderTaskConfig(build_default_task_config("local")): # type: ignore
game_url: str = field(
default=MISSING,
metadata={"help": "Complete URL to use for the version of the game running"},
)


def validate_unit(unit):
agent = unit.get_assigned_agent()
if agent is None:
return

data = agent.state.get_data()

if data["final_submission"] is None:
return

final_data = data["final_submission"]["data"]

# TODO validate
return


@task_script(config=BuilderTaskConfig)
def main(operator: Operator, cfg: DictConfig) -> None:
tasks: List[Dict[str, Any]] = [{"url": cfg.game_url}] * cfg.num_tasks

def validate_onboarding(onboarding_data):
# TODO implement once we have an onboarding
return True

# TODO initialize agent as necessary for the below

def suggest_room(
_request_id: str, args: Dict[str, Any], agent_state: RemoteProcedureAgentState
):
# Use add_room_description and add_room_backstory to fill these
# from a title alone
room_graph = args["room_graph"]
pass

def suggest_room_contents(
_request_id: str, args: Dict[str, Any], agent_state: RemoteProcedureAgentState
):
room_graph = args["room_graph"]
target_room = args["target_room"]
# Use `add_object` and `add_character` to generate a list of suggestions for
# objects and characters
pass

def suggest_character_contents(
_request_id: str, args: Dict[str, Any], agent_state: RemoteProcedureAgentState
):
room_graph = args["room_graph"]
target_room = args["target_room"]
# Use `add_character_wearing`, `add_character_wielding`, `add_character_carrying`
# to create three lists of suggestions
pass

def suggest_object_contents(
_request_id: str, args: Dict[str, Any], agent_state: RemoteProcedureAgentState
):
room_graph = args["room_graph"]
target_room = args["target_room"]
# Use `add_object_contains` to create a list of object suggestions
pass

def fill_object(
_request_id: str, args: Dict[str, Any], agent_state: RemoteProcedureAgentState
):
# Fill the attributes and contents of object_id with `add_all_static_attributes`
# and `add_all_object_attributes`
room_graph = args["room_graph"]
room_graph = args["object_id"]
pass

def fill_character(
_request_id: str, args: Dict[str, Any], agent_state: RemoteProcedureAgentState
):
# Fill the attributes and contents of character_id with `add_all_character_attributes`
room_graph = args["room_graph"]
room_graph = args["character_id"]
pass

def fill_room(
_request_id: str, args: Dict[str, Any], agent_state: RemoteProcedureAgentState
):
# Use add_object, add_character, fill_object, and fill_character to fill out this room
room_graph = args["room_graph"]
pass

function_registry = {
"suggest_room_contents": suggest_room_contents,
"suggest_character_contents": suggest_character_contents,
"suggest_object_contents": suggest_object_contents,
"suggest_room": suggest_room,
"fill_object": fill_object,
"fill_character": fill_character,
"fill_room": fill_room,
}

shared_state = SharedRemoteProcedureTaskState(
static_task_data=tasks,
function_registry=function_registry,
validate_onboarding=validate_onboarding,
on_unit_submitted=validate_unit,
)

task_dir = cfg.task_dir
build_custom_bundle(task_dir)

operator.launch_task_run(cfg.mephisto, shared_state)
operator.wait_for_runs_then_shutdown(skip_input=True, log_rate=30)


if __name__ == "__main__":
main()
41 changes: 41 additions & 0 deletions crowdsourcing/environment/world_builder/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env python3

# Copyright (c) Meta Platforms, Inc. and affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

import re

"""
Contains various utilities that make it easier to parse through the data
and prepare it for processing.
"""


def get_spawns(dialogue_data):
spawns = []

for turn in dialogue_data:
text = turn["text"].strip()
if turn["caller"] == "SoulSpawnEvent":
spawns.append(text)

return spawns


def was_tutorial(dialogue_data):
spawns = get_spawns(dialogue_data)
return (
"You are, well, yourself... a wandering soul who has yet to become someone in the full LIGHT "
"world. Perhaps you may be granted admission by the dungeon master?"
) in "\n".join(spawns)


def had_full_game(dialogue_data):
spawns = get_spawns(dialogue_data)
spawn_string = "\n".join(spawns)
NON_TUTORIAL_INIT_REGEX = "(?!.* You\.)Your soul possesses (.*?). Roleplay well, my friend, and earn experience points!"
for line in spawn_string.split("\n"):
if bool(re.match(NON_TUTORIAL_INIT_REGEX, line)):
return True
return False
79 changes: 79 additions & 0 deletions crowdsourcing/environment/world_builder/view_results.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/usr/bin/env python3

# Copyright (c) Meta Platforms, Inc. and affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

from mephisto.abstractions.databases.local_database import LocalMephistoDB
from mephisto.tools.examine_utils import run_examine_or_review, print_results
from mephisto.data_model.worker import Worker
from light.colors import Colors as C
from utils import was_tutorial, had_full_game

db = LocalMephistoDB()


def format_data_for_printing(data):
worker_name = Worker.get(db, data["worker_id"]).worker_name
duration = data["task_end"] - data["task_start"]
metadata_string = (
f"Worker: {worker_name}\nUnit: {data['unit_id']}\n"
f"Duration: {int(duration) / 60.0}\nStatus: {data['status']}\n"
)

dialogue_string = ""
dialogue_data = data["data"]["final_submission"]["data"]
feedback = data["data"]["final_submission"]["comments"]

curr_actor = None

says = 0
dos = 0
for turn in dialogue_data:
text = turn["text"].strip()
if turn["caller"] == "SoulSpawnEvent":
curr_actor = turn["actor"]
dialogue_string += f"{text}\n"
elif turn.get("actor") is None:
c = None
if text.endswith('"'):
says += 1
c = C.BOLD_GREEN
else:
dos += 1
c = C.BOLD_BLUE
dialogue_string += f"{c}{text}{C.RESET}\n"
elif turn.get("actor") == curr_actor:
text = text.replace("\n", "\n ")
dialogue_string += f" {text}\n"
else:
text = text.replace("\n", "\n ")
dialogue_string += f" {C.PURPLE}{text}{C.RESET}\n"

dialogue_had_tutorial = was_tutorial(dialogue_data)
dialogue_had_full_game = had_full_game(dialogue_data)
episode_type = f"{C.BOLD_PURPLE}UNKNOWN{C.RESET}"
if dialogue_had_tutorial:
if dialogue_had_full_game:
episode_type = f"{C.BOLD_GREEN}COMPELTED TUTORIAL{C.RESET}"
else:
episode_type = f"{C.BOLD_RED}FAILED TUTORIAL{C.RESET}"
elif dialogue_had_full_game:
episode_type = f"{C.BOLD_BLUE}RETURNING WORKER{C.RESET}"

return (
f"{metadata_string}"
f"Says: {says}, Dos: {dos}\n"
f"Type: {episode_type}\n"
f"Feedback: {feedback}\n\n"
f"{dialogue_string}-----------\n\n"
)


def main():
db = LocalMephistoDB()
run_examine_or_review(db, format_data_for_printing)


if __name__ == "__main__":
main()
4 changes: 4 additions & 0 deletions crowdsourcing/environment/world_builder/webapp/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["@babel/env", "@babel/preset-react"],
"plugins": ["@babel/plugin-proposal-class-properties"]
}
3 changes: 3 additions & 0 deletions crowdsourcing/environment/world_builder/webapp/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["react-app"]
}
23 changes: 23 additions & 0 deletions crowdsourcing/environment/world_builder/webapp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
Loading