Skip to content

Commit

Permalink
Update 2024-02-29-creating-the-perfect-modding-language.md
Browse files Browse the repository at this point in the history
  • Loading branch information
MyNameIsTrez authored Sep 23, 2024
1 parent 7dd9c9d commit 8fb2315
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion _posts/2024-02-29-creating-the-perfect-modding-language.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,16 @@ In this video:
2. The gun's `on_fire()` function increments the counter's "shots" map value by 1.
3. The counter's `on_tick()` function prints its "shots" map value.

Instead, or additionally, entities could send each other messages. Here is what the code from the video could look like, when using messages:
Instead, or additionally, entities could send each other messages.

Here is what the code from the video could look like, when using messages:

![Screenshot from 2024-09-23 18-39-42](https://github.com/user-attachments/assets/ea791e2a-5f89-4e06-9b0b-0ae1765d9e30)

There is a big difference between the options of giving every entity a map, and letting entities send messages to each other:
- Entity A can put something in the map of entity B, even when entity B doesn't ever look at that thing.
- With messages, entity B can choose to ignore a message.

## Documentation, security, and type checking in one

The game developer is responsible for maintaining a `mod_api.json` file, which declares which entities and game functions modders are allowed to call. This ensures that malicious modders have no way of calling functions that might compromise the security of the user. It also allows `grug.c` to catch any potential issues in mods, like passing an `i32` to a game function that expects a `string`.
Expand Down

0 comments on commit 8fb2315

Please sign in to comment.