Space Engineers

Space Engineers

Not enough ratings
NextBots Modding Guide
By Jakaria
This is a modding guide for my NextBots Mod.
This guide expects you to already have some knowledge in how modding works for Space Engineers, especially SBC/XML modding.
   
Award
Favorite
Favorited
Unfavorite
Initial Setup
This guide expects you to already have some knowledge in how modding works for Space Engineers, especially SBC/XML modding.


To start, create a file called EXACTLY NextBotsModDefinitions.xml inside YourModRootFolder/Data/.
The file name and path must be exact or my API will not be able to locate it.

This is how the file should look in explorer.
Inside the folder NextBotsModDefinitions.xml that you created, copy/paste this.
<?xml version="1.0" encoding="utf-16"?> <NextBotsModDefinitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <NextBots> <NextBotDefinition> <SubtypeId>RoniBotSubtype</SubtypeId> <DisplayName>Roni Bot</DisplayName> <Texture>RoniBotTexture</Texture> <UVSize> <X>1</X> <Y>1</Y> </UVSize> <FrameTime>0</FrameTime> <Frames>0</Frames> <Radius>1</Radius> <Perspective>true</Perspective> <BlendType>LDR</BlendType> <Lit>true</Lit> <Alpha>1</Alpha> <AmbientSound>RoniBotAmbient</AmbientSound> <KillSound>RoniBotKill</KillSound> <SpawnWeight>1</SpawnWeight> <KillRadius>1</KillRadius> <MaxSpeed>10</MaxSpeed> <LightRadius>1</LightRadius> <DoorRadius>1</DoorRadius> </NextBotDefinition> </NextBots> </NextBotsModDefinitions>

To create multiple next bots in the same mod, duplicate the text from <NextBotDefinition> to </NextBotDefinition>. You can see how I do it in my mods definitions.

Another note, SubtypeIds must be unique. If they are not unique, they will overwrite another Nextbot. For instance, if there are two bots with the SubtypeId of "Foo", only one of those bots will be added to the game. This enables the ability for you to disable bots by setting the SpawnWeight of a certain SubtypeId to zero.
NextBot Definition (Render)
The following fields are related to render. For creating TransparentMaterials, see this documentation[semref.atlassian.net]. For my own bots, I really just have this for a single texture:
<?xml version="1.0"?> <Definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <TransparentMaterials> <TransparentMaterial> <Id> <TypeId>TransparentMaterialDefinition</TypeId> <SubtypeId>JMunci</SubtypeId> </Id> <CanBeAffectedByOtherLights>false</CanBeAffectedByOtherLights> <Texture>Data\Textures\Munci.dds</Texture> <Reflectivity>0.0</Reflectivity> </TransparentMaterial> </TransparentMaterials> </Definitions>

Texture
The SubtypeId of a TransparentMaterialDefinition

UVSize
<X>1</X>
<Y>1</Y>
</UVSize>
The size of a a single texture/frame within the Texture material (0-1). If you are not using an animation/sprite sheet, there is no need to mess with this.

FrameTime
The amount of time spent on a single animation frame in seconds.

Frames
The number of frames present on the animation/sprite sheet.

Radius
The radius in meters of the entity billboard. Does not affect collisions.

Perspective
When true, the render of the billboard will be oriented with facing direction of the entity. When false, the render will face the camera completely.

BlendType
How the billboard should be rendered:
  • LDR
  • Standard
  • PostPP
  • AdditiveTop
  • AdditiveBottom

Lit
When true, the render will become darker at night

Alpha
Alpha transparency of the billboard. 0-1 with zero being invisible.
NextBot Definition (Audio)
For creating the .XWM audio files, you may want to look at other modding guides. A guide for sound blocks should work.

AmbientSound
The SubtypeId of a sound that loops for ambience.

KillSound
The SubtypeId of a sound that plays when a player is killed.
NextBot Definition (Gameplay)
SpawnWeight
How frequent the NextBot should spawn. Higher values increase the chance of this NextBot spawning. A weight of 0 will never spawn naturally

When testing, I recommend making the SpawnWeight a very large number so you can guarantee your bot will spawn.

KillRadius
Radius in meters around the entity that characters will be killed. Keep the kill radius less than or equal to the render radius for fairness.

MaxSpeed
The maximum speed the NextBot can move in m/s. Defaults to character definition's max speed

LightRadius
The radius around the entity that lights are effected, in meters. Affected lights will invert their enabled state and turn red. When the entity leaves the area, the lights are reset to how they were originally. This is not a destructive behavior.

DoorRadius
The radius around the entity that doors automatically open in meters.
Example Mod
Here is an example of a mod that adds a custom NextBot using animations.
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2994214911
Scripting API
There is also a scripting API you can use. It is located at:
Data\Scripts\NextBots\API\NextBotsAPI.cs

Create the object in LoadData and dispose it in UnloadData.