June 2021
Beginner
344 pages
8h 9m
English
Your game’s entities have a lot in common. For example, they all have a name, starting position, render information, and game stats. Rather than use a custom spawn function for every entity in the game—which is what you’re doing now—you’ll create a common spawn function that reads the game’s data file and adds components using the values found in that file. But first, you need a data file and an appropriate format.
This book will use RON (Rusty Object Notation) files to store your game definition.[65] RON is similar to JSON and other structured data formats, but it’s designed to look like Rust.
Create a new file named resources/template.ron and paste the following game definition into it:
| | Templates( |
| | entities ... |
Read now
Unlock full access