Amalgam Engine 1.2 Release Notes
Motivation
This update brings a major new feature to the engine: scriptable entities! These can be used to make dynamic objects and NPCs through the following workflow:
- Open build mode and choose the new "Entity" tool.
- Choose an entity template and place it in the world.
- Customize its name and sprite, if desired.
- Customize its "initialization script" (init script).
Init scripts are Lua scripts that get ran on the entity, and allow you to add Interactions (things that happen when you click on the entity, e.g. "Examine") and Behaviors (things that happen automatically, e.g. AI).
With this, we now have NPCs and interactables. See the video above for more info, and look forward to the next update: items and inventory!
Release Notes
Live Lua scripting
Non-client entities now can accept an "initialization script": a Lua script that gets ran when they're constructed.
The init script interface features Interactions (things that happen when you click on the entity, e.g. "Examine") and Behaviors (things that happen automatically, e.g. AI).
Lua bindings are mostly left up to the project, but should follow the concepts of "Interactions" and "Behaviors".
Interactions
(See above for details.)
In Repose, the sunflowers have been rebuilt using entities, and now feature a "Replant" interaction. When a sunflower dies, you can left-click on it to replant it as a sapling (must be in range).
Behaviors (AI, etc)
(See above for details.)
In Repose's build area, you can now use the Entity build mode tool to place an entity and assign it an init script. Currently, the Lua interface only features a test function "addRandomWalkerAIBehavior(3)".
Automatic Entity Component Networking
In C++, there are now two lists of component types: ReplicatedComponentTypes, and ObservedComponentTypes.
Adding types to these lists cause them to be automatically networked with clients, meaning it's now trivially easy to add new components. There's a slight performance penalty to using this path, so performance-sensitive systems such as movement will still handle their components manually.
Behind-the-scenes Improvements
- Refactored movement for another large performance boost. We now can easily support 200 entities in 1 area, moving at 4 inputs/second. We can probably go even higher, I haven't tried yet.
- Refactored entity handling to support non-client entities (this update is our first time dealing with any entities that don't belong to a client).
- Added messages to handle changing an entity's name and sprite, with project hooks for allowing/rejecting the change. This lets a project's build mode send already-hooked-up messages for the entity data that it's likely to support changing in the UI.
These changes are now live in The World of Repose. Feel free to walk to the sunflower garden or the build area and play around with them.
Net_