Skip to content

Commit c3cd2ac

Browse files
authored
LGME: Adding in items.json for lab, fixing build-assets (#111)
* Adding in items.json for lab * Syncing code with docs, adding banners to alerts * Fixing alert
1 parent 0e05839 commit c3cd2ac

File tree

5 files changed

+843
-6
lines changed

5 files changed

+843
-6
lines changed

.github/scripts/build-assets.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@
7373
with ZipFile('battle-royale.zip', 'w') as workshop_zip:
7474
for pyscript in glob.glob('./scripts/*.py'):
7575
workshop_zip.write(pyscript)
76+
for js_script in glob.glob('./scripts/*.json'):
77+
workshop_zip.write(js_script)
7678
shutil.move(os.path.join(os.getcwd(), 'battle-royale.zip'), os.path.join(dest_root, 'assets', 'battle-royale.zip'))
7779

7880
#Create Global Serverless ZIP

content/game-player-data/core-usage/Step2.en.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ The code you downloaded in the initial steps include a Python script in the **sc
1313

1414
```py
1515
import boto3
16+
1617
dynamodb = boto3.client('dynamodb')
1718

1819
try:
@@ -42,14 +43,14 @@ try:
4243
"ReadCapacityUnits": 1,
4344
"WriteCapacityUnits": 1
4445
}
45-
)
46-
print("Table 'battle-royale' created successfully.")
46+
)
47+
print("Table 'battle-royale' created successfully.")
4748
except Exception as e:
4849
print("Could not create table. Error:")
4950
print(e)
5051
```
5152

52-
::alert[Edit **scripts/create_table.py**, set both `ReadCapacityUnits` and `WriteCapacityUnits` to **100** for *battle-royale* table.]
53+
::alert[Edit **scripts/create_table.py**, set both `ReadCapacityUnits` and `WriteCapacityUnits` to **100** for *battle-royale* table and save the file.]{header="Change the capacity units."}
5354

5455
The preceding script uses the [CreateTable](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_CreateTable.html) operation using [Boto 3](https://boto3.amazonaws.com/v1/documentation/api/latest/index.html), the AWS SDK for Python. The operation declares two attribute definitions, which are typed attributes to be used in the primary key. Though DynamoDB is [schemaless](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/SQLtoNoSQL.CreateTable.html), you must declare the names and types of attributes that are used for primary keys. The attributes must be included on every item that is written to the table and thus must be specified as you are creating a table.
5556

content/game-player-data/join-games/Step2.en.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ python scripts/start_game.py
7575
You should see output in your terminal indicating that the game was started successfully.
7676

7777
```text
78-
Started game:
79-
Game: c6f38a6a-d1c5-4bdf-8468-24692ccc4646 Map: Urban Underground
78+
Started game: Game: c6f38a6a-d1c5-4bdf-8468-24692ccc4646 Map: Urban Underground
8079
```
8180

8281
Try to run the script a second time in your terminal. This time, you should see an error message that indicates you could not start the game. This is because you have already started the game, so the `start_time` attribute exists. As a result, the request failed the conditional check on the entity.

content/game-player-data/open-games/Step2.en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ except Exception as e:
6060
print(e)
6161
```
6262

63-
::alert[Edit **scripts/add_secondary_index.py**, set both `ReadCapacityUnits` and `WriteCapacityUnits` to **100** for `OpenGamesIndex`.]
63+
::alert[Edit **scripts/add_secondary_index.py**, set both `ReadCapacityUnits` and `WriteCapacityUnits` to **100** for `OpenGamesIndex`. Then, save the file.]{header="Change the capacity units"}
6464

6565
Whenever attributes are used in a primary key for a table or secondary index, they must be defined in `AttributeDefinitions`. Then, you `Create` a new GSI in the `GlobalSecondaryIndexUpdates` property. For this GSI, you specify the index name, the schema of the primary key, the provisioned throughput, and the attributes you want to project.
6666

0 commit comments

Comments
 (0)