diff --git a/_posts/2024-02-29-creating-the-perfect-modding-language.md b/_posts/2024-02-29-creating-the-perfect-modding-language.md index e8d6084..f42ac2a 100644 --- a/_posts/2024-02-29-creating-the-perfect-modding-language.md +++ b/_posts/2024-02-29-creating-the-perfect-modding-language.md @@ -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`.